Struct Angle
- Namespace
- GeometryHelper
- Assembly
- GeometryHelper.dll
Represents an angle as a single value that can be read as either radians or degrees.
The value is stored in radians because every angular API built on this type works in radians:
GeoVector2.GetAngleTo and GeoRectangle2.AngleRad in the plane,
GeoVector3.GetAngleTo and GeoTransform3.RotationX in space, and
Tolerance.EqualAngleRad in both. Degrees are a view over that value, converted on read.
There is deliberately no public constructor taking a bare double. The reason this type exists is that a number on its own does not say which unit it is in, so the unit has to be named at the point of creation: use FromRadians(double) or FromDegrees(double).
public readonly struct Angle : IEquatable<Angle>, IComparable<Angle>
- Implements
- Inherited Members
Fields
- DegreesPerRadian
Number of degrees in one radian.
- FullTurnDegrees
One full turn expressed in degrees.
- FullTurnRadians
One full turn expressed in radians.
- RadiansPerDegree
Number of radians in one degree.
Properties
- Degrees
Gets the angle in degrees, converted from the stored radian value on each read.
- FullTurn
A full turn (360 degrees).
- Radians
Gets the angle in radians. This is the stored value.
- Right
A right angle (90 degrees).
- Straight
A straight angle (180 degrees).
- Zero
The zero angle (0 degrees).
Methods
- Abs()
Gets the angle with its magnitude only.
- Add(Angle)
Adds another angle to this one.
- CompareTo(Angle)
Compares this angle with another angle by stored value.
- Divide(double)
Divides the angle by a scalar divisor.
- Equals(Angle)
Indicates whether this angle has exactly the same stored value as another angle.
- Equals(object)
Indicates whether this instance and a specified object are equal.
- FromDegrees(double)
Creates an angle from a value in degrees.
- FromRadians(double)
Creates an angle from a value in radians.
- GetHashCode()
Returns the hash code for this instance.
- IsEqualTo(Angle)
Compares whether this angle equals another angle using the default angular tolerance.
- IsEqualTo(Angle, Tolerance)
Compares whether this angle equals another angle within an angular tolerance.
- Multiply(double)
Multiplies the angle by a scalar factor.
- Negate()
Gets the angle with the opposite sign.
- Normalize()
Wraps the angle into the range [0, 2*PI), the form used to express a rotation as a full turn. A rotation of -90 degrees normalizes to 270 degrees.
- NormalizeSigned()
Wraps the angle into the range (-PI, PI], the form used to express the shortest rotation to a direction. A rotation of 270 degrees normalizes to -90 degrees.
- Subtract(Angle)
Subtracts another angle from this one.
- ToDegrees(double)
Converts a raw radian value to degrees, without going through an Angle instance.
- ToRadians(double)
Converts a raw degree value to radians, without going through an Angle instance.
- ToString()
Represents the angle in degrees.
Operators
- operator +(Angle, Angle)
Adds two angles.
- operator /(Angle, double)
Divides an angle by a scalar divisor.
- operator ==(Angle, Angle)
Compares two angles for exact equality of the stored value.
- operator >(Angle, Angle)
Determines whether one angle is greater than another.
- operator >=(Angle, Angle)
Determines whether one angle is greater than or equal to another.
- operator !=(Angle, Angle)
Compares two angles for inequality of the stored value.
- operator <(Angle, Angle)
Determines whether one angle is smaller than another.
- operator <=(Angle, Angle)
Determines whether one angle is smaller than or equal to another.
- operator *(Angle, double)
Multiplies an angle by a scalar factor.
- operator *(double, Angle)
Multiplies an angle by a scalar factor.
- operator -(Angle, Angle)
Subtracts one angle from another.
- operator -(Angle)
Negates an angle.