|
@@ -2,19 +2,19 @@
|
|
* Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system
|
|
* Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system
|
|
*/
|
|
*/
|
|
|
|
|
|
-function Cylindrical( radius, theta, y ) {
|
|
|
|
|
|
+class Cylindrical {
|
|
|
|
|
|
- this.radius = ( radius !== undefined ) ? radius : 1.0; // distance from the origin to a point in the x-z plane
|
|
|
|
- this.theta = ( theta !== undefined ) ? theta : 0; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis
|
|
|
|
- this.y = ( y !== undefined ) ? y : 0; // height above the x-z plane
|
|
|
|
|
|
+ constructor( radius, theta, y ) {
|
|
|
|
|
|
- return this;
|
|
|
|
|
|
+ this.radius = ( radius !== undefined ) ? radius : 1.0; // distance from the origin to a point in the x-z plane
|
|
|
|
+ this.theta = ( theta !== undefined ) ? theta : 0; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis
|
|
|
|
+ this.y = ( y !== undefined ) ? y : 0; // height above the x-z plane
|
|
|
|
|
|
-}
|
|
|
|
|
|
+ return this;
|
|
|
|
|
|
-Object.assign( Cylindrical.prototype, {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- set: function ( radius, theta, y ) {
|
|
|
|
|
|
+ set( radius, theta, y ) {
|
|
|
|
|
|
this.radius = radius;
|
|
this.radius = radius;
|
|
this.theta = theta;
|
|
this.theta = theta;
|
|
@@ -22,15 +22,15 @@ Object.assign( Cylindrical.prototype, {
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- clone: function () {
|
|
|
|
|
|
+ clone() {
|
|
|
|
|
|
return new this.constructor().copy( this );
|
|
return new this.constructor().copy( this );
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- copy: function ( other ) {
|
|
|
|
|
|
+ copy( other ) {
|
|
|
|
|
|
this.radius = other.radius;
|
|
this.radius = other.radius;
|
|
this.theta = other.theta;
|
|
this.theta = other.theta;
|
|
@@ -38,15 +38,15 @@ Object.assign( Cylindrical.prototype, {
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- setFromVector3: function ( v ) {
|
|
|
|
|
|
+ setFromVector3( v ) {
|
|
|
|
|
|
return this.setFromCartesianCoords( v.x, v.y, v.z );
|
|
return this.setFromCartesianCoords( v.x, v.y, v.z );
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- setFromCartesianCoords: function ( x, y, z ) {
|
|
|
|
|
|
+ setFromCartesianCoords( x, y, z ) {
|
|
|
|
|
|
this.radius = Math.sqrt( x * x + z * z );
|
|
this.radius = Math.sqrt( x * x + z * z );
|
|
this.theta = Math.atan2( x, z );
|
|
this.theta = Math.atan2( x, z );
|
|
@@ -56,7 +56,7 @@ Object.assign( Cylindrical.prototype, {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-} );
|
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
export { Cylindrical };
|
|
export { Cylindrical };
|