Object for convenient and type-safe handling of angles. More...
Inherits IComparable< Angle >.
Public Member Functions | |
Angle (bool trim) | |
Generate a 0° angle. More... | |
override string | ToString () |
Convert the angle to a string. Although Radians is the predominantly used unit for angles, the angle will be output as a degree string as this is easier humanly readable. More... | |
override bool | Equals (object obj) |
Equality comparison. More... | |
override int | GetHashCode () |
Hash code generation. More... | |
int | CompareTo (Angle other) |
Implementation of the IComparable function More... | |
Static Public Member Functions | |
static Angle | FromDegrees (double deg, bool trim) |
Create an angle in degrees. More... | |
static Angle | FromDegrees (double deg) |
Create an angle in degrees. More... | |
static Angle | FromRadians (double rad, bool trim) |
Create an angle in radians. More... | |
static Angle | FromRadians (double rad) |
Create an angle in radians. More... | |
static bool | operator< (Angle lhs, Angle rhs) |
Comparison of two angles. More... | |
static bool | operator> (Angle lhs, Angle rhs) |
Comparison of two angles. More... | |
static Angle | operator+ (Angle lhs, Angle rhs) |
Add two angles. More... | |
static Angle | operator- (Angle lhs, Angle rhs) |
Subtract two angles. More... | |
static Angle | operator* (double lhs, Angle rhs) |
Multiply an angle with a number. More... | |
static Angle | operator/ (Angle lhs, double rhs) |
Divide an angle by a number. More... | |
static Angle | operator* (Angle lhs, double rhs) |
Multiply an angle with a number. More... | |
static bool | operator== (Angle lhs, Angle rhs) |
Compare two angles for equality. More... | |
static bool | operator!= (Angle lhs, Angle rhs) |
Compare two angles for inequality. More... | |
Static Public Attributes | |
static readonly Angle | Zero = new Angle() |
Zero element. | |
Properties | |
double | Deg [get, set] |
Get/set the value in degrees. Setting this property will automatically update the Rad property accordingly. Also, the value will be trimmed if enabled. | |
double | Rad [get, set] |
Get/set the value in Radians. Setting this property will automatically update the Deg property accordingly. Also, the value will be trimmed if enabled. | |
bool | IsTrimmed [get, set] |
Turn trimming of the value of the angle to the range -PI...PI on or off. | |
Object for convenient and type-safe handling of angles.
Angle | ( | bool | trim | ) |
Generate a 0° angle.
trim | trimming |
int CompareTo | ( | Angle | other | ) |
Implementation of the IComparable function
other | Angle to compare to |
override bool Equals | ( | object | obj | ) |
Equality comparison.
obj | Object to compare to |
true
if equal; false
if not.
|
static |
|
static |
|
static |
|
static |
override int GetHashCode | ( | ) |
Hash code generation.
override string ToString | ( | ) |
Convert the angle to a string. Although Radians is the predominantly used unit for angles, the angle will be output as a degree string as this is easier humanly readable.