phetsims / color-vision

"Color Vision" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/color-vision
GNU General Public License v3.0
1 stars 7 forks source link

screens have different head implements #59

Closed pixelzoom closed 10 years ago

pixelzoom commented 10 years ago

This is related to #46. The head in the 2 screens would appear to have the same requirements, but they are implemented differently. In the RGB screen, there are 4 images involved; in the Single Bulb screen there are only 2 images. If they really need to be different, document why.

aaronsamuel137 commented 10 years ago

RGBHeadNode needs to be different because it has two layers. The photons need to be cut off at a certain part of the head, and having two layers accomplishes this. It isn't necessary in single bulb mode because there is only one beam and it isn't at an angle, so it is easy just to set it to the right length. Hopefully this is clear in the comments now.

I ended up passing the photon beams into RGBHeadNode so they can be added there in between the two head layers. This seemed to be the only way to get the layers added in the right order and still get the encapsulation of the head node.

Assigning to @pixelzoom for review

aaronsamuel137 commented 10 years ago

It would also be possible to use the RGBHeadNode for both screens because it is more general, but it would entail adding two extra images to the single bulb screen that aren't really needed. Maybe its worth it for the sake of simplicity.

aaronsamuel137 commented 10 years ago

After talking with @samreid I decided it is better to use the same implementation for both screens after all. Both screens use HeadNode.js now.

pixelzoom commented 10 years ago

Looks good, closing.