Spherical
Represents a point in spherical coordinates.
Spherical stores a 3D position using (radius, phi, theta) where radius is the distance from the origin, phi is the azimuth angle around the Y-axis, and theta is the polar angle measured from the equatorial plane. This representation is commonly used for orbital camera rigs, direction sampling, and converting between angular and Cartesian representations.
Construction
Constructors
Spherical() constexpr
Constructs a spherical coordinate from radius, phi, and theta.
cpp
Spherical::Spherical(float radius, float phi, float theta);| Parameter | Description |
|---|---|
| radius | |
| phi | |
| theta |
Properties
phi float
Azimuth angle around the Y-axis in radians.
cpp
float phi {0.0f};radius float
Radial distance from the origin.
cpp
float radius {1.0f};theta float
Polar angle from the equator in radians.
cpp
float theta {0.0f};Functions
Converts this spherical coordinate to a Vector3.
In this convention, phi equals 0 along the +Z axis and increases toward +X. The polar angle theta is 0 on the equator, reaches at +Y, and at -Y.
cpp
Vector3 Spherical::ToVector3() const;