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

scrubs picture scrubs  路  3Comments

fuzihaofzh picture fuzihaofzh  路  3Comments

jlaquinte picture jlaquinte  路  3Comments

filharvey picture filharvey  路  3Comments

Bandit picture Bandit  路  3Comments