mrdoob/three.js — pull request #1536 by ekitson (2012-03-18 01:34:29+00:00)
Title: Fixed potential bugs in z-sorting, frustum culling, and ray intersection

Following discussion from issue #1459.

I implemented the bounding sphere position and in my tests it seems to fix the sorting/culling issues I was finding. Please take a look and let me know your thoughts.

I chose to cache the bounding sphere's position in world space as `Mesh.cog` (center-of-geometry) for better performance. I think that the COG is a useful value in a lot of situations. For instance, you could have a camera center on any given Mesh by calling `camera.lookAt( mesh.cog )`.

I also noticed that `boundRadiusScale` was not being used anywhere in the code. So I updated it to replace world matrix decompositions in `Frustum` and `Ray`. This should be more performant as well as more accurate since the decomposition isn't guaranteed to give you the correct scale value.