CVB.Net 14.0
Angle Struct Reference

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.
 

Detailed Description

Object for convenient and type-safe handling of angles.

Constructor & Destructor Documentation

◆ Angle()

Angle ( bool  trim)

Generate a 0° angle.

Parameters
trimtrimming

Member Function Documentation

◆ CompareTo()

int CompareTo ( Angle  other)

Implementation of the IComparable function

Parameters
otherAngle to compare to
Returns
Comparison result (see IComparable documentation)

◆ Equals()

override bool Equals ( object  obj)

Equality comparison.

Parameters
objObject to compare to
Returns
true if equal; false if not.

◆ FromDegrees() [1/2]

static Angle FromDegrees ( double  deg)
static

Create an angle in degrees.

Parameters
degAngle value
Returns
A new Angle object representing the input value.

◆ FromDegrees() [2/2]

static Angle FromDegrees ( double  deg,
bool  trim 
)
static

Create an angle in degrees.

Parameters
degAngle value
trimTrimming
Returns
A new Angle object representing the input value.

◆ FromRadians() [1/2]

static Angle FromRadians ( double  rad)
static

Create an angle in radians.

Parameters
radAngle value
Returns
A new Angle object representing the input value.

◆ FromRadians() [2/2]

static Angle FromRadians ( double  rad,
bool  trim 
)
static

Create an angle in radians.

Parameters
radAngle value
trimTrimming
Returns
A new Angle object representing the input value.

◆ GetHashCode()

override int GetHashCode ( )

Hash code generation.

Returns
Hash code as generated by the base class.

◆ operator!=()

static bool operator!= ( Angle  lhs,
Angle  rhs 
)
static

Compare two angles for inequality.

Parameters
lhsAngle
rhsAngle
Returns
Result

◆ operator*() [1/2]

static Angle operator* ( Angle  lhs,
double  rhs 
)
static

Multiply an angle with a number.

Parameters
rhsNumber
lhsAngle
Returns
Result

◆ operator*() [2/2]

static Angle operator* ( double  lhs,
Angle  rhs 
)
static

Multiply an angle with a number.

Parameters
lhsNumber
rhsAngle
Returns
Result

◆ operator+()

static Angle operator+ ( Angle  lhs,
Angle  rhs 
)
static

Add two angles.

Parameters
lhsAngle
rhsAngle
Returns
Result

◆ operator-()

static Angle operator- ( Angle  lhs,
Angle  rhs 
)
static

Subtract two angles.

Parameters
lhsAngle
rhsAngle
Returns
Result

◆ operator/()

static Angle operator/ ( Angle  lhs,
double  rhs 
)
static

Divide an angle by a number.

Parameters
lhsAngle
rhsNumber
Returns
Result

◆ operator<()

static bool operator< ( Angle  lhs,
Angle  rhs 
)
static

Comparison of two angles.

Parameters
lhsAngle
rhsAngle
Returns
true if lhs is bigger than rhs , false otherwise

◆ operator==()

static bool operator== ( Angle  lhs,
Angle  rhs 
)
static

Compare two angles for equality.

Parameters
lhsAngle
rhsAngle
Returns
Result

◆ operator>()

static bool operator> ( Angle  lhs,
Angle  rhs 
)
static

Comparison of two angles.

Parameters
lhsAngle
rhsAngle
Returns
true if lhs is bigger than rhs , false otherwise

◆ ToString()

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.

Returns
String representation.