提交 fe4b07cd 编写于 作者: W WestLangley

Added cartesian conversion methods

上级 4ab873f9
......@@ -617,11 +617,17 @@ Object.assign( Vector3.prototype, {
setFromSpherical: function ( s ) {
var sinPhiRadius = Math.sin( s.phi ) * s.radius;
return this.setFromSphericalCoords( s.radius, s.phi, s.theta );
this.x = sinPhiRadius * Math.sin( s.theta );
this.y = Math.cos( s.phi ) * s.radius;
this.z = sinPhiRadius * Math.cos( s.theta );
},
setFromSphericalCoords: function ( radius, phi, theta ) {
var sinPhiRadius = Math.sin( phi ) * radius;
this.x = sinPhiRadius * Math.sin( theta );
this.y = Math.cos( phi ) * radius;
this.z = sinPhiRadius * Math.cos( theta );
return this;
......@@ -629,9 +635,15 @@ Object.assign( Vector3.prototype, {
setFromCylindrical: function ( c ) {
this.x = c.radius * Math.sin( c.theta );
this.y = c.y;
this.z = c.radius * Math.cos( c.theta );
return this.setFromCylindricalCoords( c.radius, c.theta, c.y );
},
setFromCylindricalCoords: function ( radius, theta, y ) {
this.x = radius * Math.sin( theta );
this.y = y;
this.z = radius * Math.cos( theta );
return this;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册