raphaelpaiva/JTrace — Issue #16: ColorRGB value bounds
Author: flaviocdc
Created: 2011-12-31 06:20:58+00:00
State: open

RGB color value is between [0,1].

Right now there's some logic in our setters to "validate" if the value is inside those bounds, if not, set the value to 1 (if the input value is bigger than 1) or 0 (if the input is smaller than 0).

IMHO, this should not be like that for one simple reason: that makes debug/troubleshooting much harder.
Let's say you do some wrong math and this result in a value that is not between 0 and 1. The will result in a improper renderization (wrong color/wrong shading) but it would be veeery hard to track down where the problem occured (since we "fixed" the wrong calculation).

Values out of bound should throw a RuntimeException OR we should at least document that we do some magical transformation if the value is invalid.