Struct Angle
A finite angle stored canonically in radians.
struct Angle(T)
if (isGeodesyScalar!T);
represents zero radians. Construction accepts float, double,
or real; checked factories reject non-finite input without throwing,
while throwing factories report the same failure with
GeodesyValueException.
No allocation is performed by checked construction or value access.
Properties
| Name | Type | Description |
|---|---|---|
degrees[get]
|
T | Angle value converted to degrees. |
radians[get]
|
T | Angle value in canonical radians. |
Methods
| Name | Description |
|---|---|
fromDegrees
(degrees)
|
Construct from degrees. |
fromRadians
(radians)
|
Construct from radians. |
tryFromDegrees
(degrees, result)
|
Construct from degrees without throwing. |
tryFromRadians
(radians, result)
|
Construct from radians without throwing. |
Example
Example using an angle with checked and throwing construction.
import geodesy;
const quarterTurn = Angle!double .fromDegrees(90.0);
assert(quarterTurn .degrees == 90.0);
Angle!double checked;
assert(Angle!double .tryFromRadians(0.5, checked));
assert(!Angle!double .tryFromRadians(double .nan, checked));