PHP 7.4.33
Preview: Cylindrical.js Size: 2.55 KB
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/three/src/math/Cylindrical.js
/**
 * This class can be used to represent points in 3D space as
 * [Cylindrical coordinates]{@link https://en.wikipedia.org/wiki/Cylindrical_coordinate_system}.
 */
class Cylindrical {

	/**
	 * Constructs a new cylindrical.
	 *
	 * @param {number} [radius=1] - The distance from the origin to a point in the x-z plane.
	 * @param {number} [theta=0] - A counterclockwise angle in the x-z plane measured in radians from the positive z-axis.
	 * @param {number} [y=0] - The height above the x-z plane.
	 */
	constructor( radius = 1, theta = 0, y = 0 ) {

		/**
		 * The distance from the origin to a point in the x-z plane.
		 *
		 * @type {number}
		 * @default 1
		 */
		this.radius = radius;

		/**
		 * A counterclockwise angle in the x-z plane measured in radians from the positive z-axis.
		 *
		 * @type {number}
		 * @default 0
		 */
		this.theta = theta;

		/**
		 * The height above the x-z plane.
		 *
		 * @type {number}
		 * @default 0
		 */
		this.y = y;

	}

	/**
	 * Sets the cylindrical components by copying the given values.
	 *
	 * @param {number} radius - The radius.
	 * @param {number} theta - The theta angle.
	 * @param {number} y - The height value.
	 * @return {Cylindrical} A reference to this cylindrical.
	 */
	set( radius, theta, y ) {

		this.radius = radius;
		this.theta = theta;
		this.y = y;

		return this;

	}

	/**
	 * Copies the values of the given cylindrical to this instance.
	 *
	 * @param {Cylindrical} other - The cylindrical to copy.
	 * @return {Cylindrical} A reference to this cylindrical.
	 */
	copy( other ) {

		this.radius = other.radius;
		this.theta = other.theta;
		this.y = other.y;

		return this;

	}

	/**
	 * Sets the cylindrical components from the given vector which is assumed to hold
	 * Cartesian coordinates.
	 *
	 * @param {Vector3} v - The vector to set.
	 * @return {Cylindrical} A reference to this cylindrical.
	 */
	setFromVector3( v ) {

		return this.setFromCartesianCoords( v.x, v.y, v.z );

	}

	/**
	 * Sets the cylindrical components from the given Cartesian coordinates.
	 *
	 * @param {number} x - The x value.
	 * @param {number} y - The x value.
	 * @param {number} z - The x value.
	 * @return {Cylindrical} A reference to this cylindrical.
	 */
	setFromCartesianCoords( x, y, z ) {

		this.radius = Math.sqrt( x * x + z * z );
		this.theta = Math.atan2( x, z );
		this.y = y;

		return this;

	}

	/**
	 * Returns a new cylindrical with copied values from this instance.
	 *
	 * @return {Cylindrical} A clone of this instance.
	 */
	clone() {

		return new this.constructor().copy( this );

	}

}

export { Cylindrical };

Directory Contents

Dirs: 1 × Files: 23
Name Size Perms Modified Actions
- drwxr-xr-x 2025-03-28 11:04:39
Edit Download
9.29 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
20.18 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
25.27 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
4.74 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
2.55 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
9.04 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
6.91 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
5.98 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
4.71 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
14.05 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
2.88 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
13.53 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
33.12 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
8.89 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
21.17 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
15.46 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
8.09 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
3.03 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
7.74 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
14.84 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
17.82 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
27.56 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
22.38 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).