|
@@ -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;
|
|
|
|