Spherical

class Spherical(var radius: Double = 1.0, var phi: Double = 0.0, var theta: Double = 0.0)

Represents points in 3D space as spherical coordinates.

Instances are mutable and not thread-safe; confine an instance to a single thread, exactly as in three.js.

Parameters

radius

The radius, or the Euclidean distance (straight-line distance) from the point to the origin.

phi

The polar angle in radians from the y (up) axis.

theta

The equator/azimuthal angle in radians around the y (up) axis.

Constructors

Link copied to clipboard
constructor(radius: Double = 1.0, phi: Double = 0.0, theta: Double = 0.0)

Properties

Link copied to clipboard
var phi: Double

The polar angle in radians from the y (up) axis.

Link copied to clipboard

The radius, or the Euclidean distance (straight-line distance) from the point to the origin.

Link copied to clipboard

The equator/azimuthal angle in radians around the y (up) axis.

Functions

Link copied to clipboard

Returns a new spherical with copied values from this instance.

Link copied to clipboard
fun copy(other: Spherical): Spherical

Copies the values of the given spherical to this instance.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Structural equality: true when other is a Spherical with equal components (component-wise ==, so NaN != NaN).

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Restricts the polar angle phi to be between 0.000001 and PI - 0.000001.

Link copied to clipboard
fun set(radius: Double, phi: Double, theta: Double): Spherical

Sets the spherical components by copying the given values.

Link copied to clipboard

Sets the spherical components from the given Cartesian coordinates.

Link copied to clipboard

Sets the spherical components from the given vector which is assumed to hold Cartesian coordinates.

Link copied to clipboard
open override fun toString(): String