Three.js: Add THREE.deg(rad) and THREE.rad(deg) functions, to convert values

Created on 8 Aug 2016  ·  6Comments  ·  Source: mrdoob/three.js

it will take a little code, but it is useful
image

Most helpful comment

Those methods are already available.

var radians = THREE.Math.degToRad( degrees );
var degrees = THREE.Math.radToDeg( radians );

All 6 comments

Or create just one function, a very common operation:

THREE.deg( deg ) // returns rad

geometry.rotateY( THREE.deg( 90 ) )

Those methods are already available.

var radians = THREE.Math.degToRad( degrees );
var degrees = THREE.Math.radToDeg( radians );

Those methods are already available.

I KNOW!

Create ALIAS to pretty syntax:

THREE.deg = function( deg ) {
  return THREE.Math.degToRad( deg );
}

@WestLangley hello!

three.js is not a Math library...

I would suggest you write the code like this instead:

geometry.rotateY( 90 * THREE.Math.DEG2RAD );
Was this page helpful?
0 / 5 - 0 ratings

Related issues

makc picture makc  ·  3Comments

zsitro picture zsitro  ·  3Comments

ghost picture ghost  ·  3Comments

clawconduce picture clawconduce  ·  3Comments

akshaysrin picture akshaysrin  ·  3Comments