[Cg1] Re: [Assignment 1] implementation of equals/unequals operation

Noshaba Cheema s8nochee at stud.uni-saarland.de
Sat Oct 29 19:13:51 CEST 2016


Ok, so I guess this also means that we probably shouldn't implement  
the RGB operations like this:

RGBColor operator+(const RGBColor& c) const {
     return RGBColor(r + c.r, g + c.g, b + c.b).clamp();
}

but rather without the clamp()?

Quoting Pascal Grittmann <s9pagrit at stud.uni-saarland.de>:

> Hi,
>
> You should not use any kind of epsilon value here. The == and !=  
> operators for vectors are usually only used to detect special cases  
> (e.g. the zero vector), hence you only need (and want) exact  
> comparisons.
>
> Best,
> Pascal Grittmann
>
> Zitat von Noshaba Cheema <s8nochee at stud.uni-saarland.de>:
>
>> Hello,
>>
>> should we check for the epsilon range in the equals/unequals  
>> operations or implement them naively?
>>
>> _______________________________________________
>> Cg1 mailing list
>> Cg1 at cg.uni-saarland.de
>> http://mail.cg.uni-saarland.de/mailman/listinfo/cg1
>
>
>
> _______________________________________________
> Cg1 mailing list
> Cg1 at cg.uni-saarland.de
> http://mail.cg.uni-saarland.de/mailman/listinfo/cg1





More information about the Cg1 mailing list