Create THREE.DEG constant

THREE.DEG = Math.PI / 180

Example:

geometry.rotateY( 90 * THREE.DEG );

looks better and shorter than:

geometry.rotateY( 90 * THREE.Math.DEG2RAD );

And looks semantically correct: “geometry rotate by Y to ninety degrees”
vs: “geometry rotate by Y to math ninety degrees to radians”

There is no any particular reason to pack this constant in Math module, If it is so often used.
And it will not cause confusion, but rather the opposite.

People will not ask the question “is the math, why is it not in THREE.Math ???” because we will not remove THREE.Math.DEG2RAD.

compare yourself:

image

Author: Fantashit

6 thoughts on “Create THREE.DEG constant

  1. Jokes aside…

    There is no any particular reason to pack this constant in Math module, If it is so often used.

    That’s kind of a fair point.

  2. I’m glad somebody else understands the value of using shorter names for APIs–as long as it’s not too ambiguous. The first time I encountered THREE.Math.DEG2RAD, I tried to invoke it as a function 🙂

Comments are closed.