[Cg1] Re: RGB Clamp function

Noshaba Cheema s8nochee at stud.uni-saarland.de
Sat Oct 29 23:03:40 CEST 2016


I am very confused now. So should they be separate now or not?

Quoting Nils Lipp <nlipp at hotmail.de>:

> As I said once (i think it was on another "thread"), I would use it  
> almsot as in the short bit of code presented
>
> When I add/subtract 2 colors and go over the boundaries for our RGB  
> values (whatever those are, probably 0-1?),  I can use clamp( ) to  
> either just set values >1 to 1 and values <0 to 0, or scale all  
> values so that they are all in the 0-1 range.
>
>
> ________________________________
> From: Cg1 <cg1-bounces at cg.uni-saarland.de> on behalf of Arsène  
> Pérard-Gayot <perard at cg.uni-saarland.de>
> Sent: Saturday, October 29, 2016 8:00 PM
> To: cg1 at cg.uni-saarland.de
> Subject: [Cg1] Re: [Assignment 1] implementation of equals/unequals operation
>
> Hello,
>
> Just a few remarks. I see that you are sharing code in your mail.
> Please do not do it beyond a few lines of code (what you copied is
> fine, for instance).
>
> This also means no public repository (on GitHub or GitLab, etc...).
> Use git only with private repos (you have some for free as a student
> on GitHub, otherwise use BitBucket).
>
> Now, considering your question, think a bit about how the exercises
> are formulated: We ask you to implement operations like +, -, *,
> etc... And we ask you to implement *separately* a "clamp" function.
> Where do you see that we ask you to combine the two?
>
> Best regards,
>    Arsène Pérard-Gayot
>
> Noshaba Cheema <s8nochee at stud.uni-saarland.de> a écrit :
>
>> 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
>>
>>
>>
>> _______________________________________________
>> Cg1 mailing list
>> Cg1 at cg.uni-saarland.de
>> http://mail.cg.uni-saarland.de/mailman/listinfo/cg1
>
>
>
> Best regards,
>    Arsène Pérard-Gayot
>
> _______________________________________________
> 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