Skip to content

Angle

Class full path: NemAll_Python_Geometry.Angle

Representation class for angle in [rad].

Attributes

Deg: float property writable

Get angle as degree value.

Rad: float property writable

Get angle as radian value.

Functions

DegToRad(angleDeg) staticmethod

Convert angle from deg to rad

Can be used for initialization of Angle class with deg angle.

angle = Angle(Angle.DegToRad(45)); // angle will be 0.75[rad] (approx.)

Parameters:

Name Type Description Default
angleDeg float

Angle in deg

required

Returns:

Type Description
float

Angle in rad

FromDeg(angleDeg) staticmethod

Parameters:

Name Type Description Default
angleDeg float

Angle in degree

required

Returns:

Type Description
Angle

Angle

Get()

Get angle as radian value.

Returns:

Type Description
float

double as radian value.

GetDeg()

Get angle as degree value.

Returns:

Type Description
float

double as degree value.

Normalize2Pi()

Normalize the angle to a range of <0, 2PI>.

This method is checked and set Angle to 0 while angle is out of range <-1e8, 1e8>. The algorithm isn't stable for angle out of this range.

NormalizePi()

Normalize the angle to a range of <-PI, PI>.

This method is checked and set Angle to 0 while angle is out of range <-1e8, 1e8>. The algorithm isn't stable for angle out of this range.

RadToDeg(angleRad) staticmethod

Convert angle from rad to deg

Parameters:

Name Type Description Default
angleRad float

Angle in rad

required

Returns:

Type Description
float

Angle in rad

RadToGrad(angleRad) staticmethod

Convert angle from rad to grad

Parameters:

Name Type Description Default
angleRad float

Angle in rad

required

Returns:

Type Description
float

Angle in grad

Set overload

Set(angle)

Set angle as radian value.

Parameters:

Name Type Description Default
angle float

angle which will be set.

required
Set(angle)

Set angle as radian value.

Parameters:

Name Type Description Default
angle Angle

angle which will be set.

required

SetDeg(angleDeg)

Set angle as degree value.

Parameters:

Name Type Description Default
angleDeg float

angle as degree value which will be set.

required

__add__ overload

__add__(angle)

Addition operator

Parameters:

Name Type Description Default
angle Angle

Angle which will be added

required

Returns:

Type Description
Angle

New angle

__add__(angle)

Addition operator

Parameters:

Name Type Description Default
angle float

Angle as double value which will be added

required

Returns:

Type Description
Angle

New angle

__eq__(angle)

Comparison of angles.

Be careful, this method work without tolerance!

Parameters:

Name Type Description Default
angle Angle

angle to be compared.

required

Returns:

Type Description
bool

True when angles are equal, otherwise false.

__float__()

Type conversion operator.

Returns:

Type Description
float

Angle as double.

__iadd__(angle)

Addition assignment operator.

Parameters:

Name Type Description Default
angle Angle

Angle which will be added.

required

Returns:

Type Description
Angle

Reference to Angle.

__init__ overload

__init__()

Initialize

__init__(angle)

Copy constructor.

Parameters:

Name Type Description Default
angle Angle

angle which will be copied.

required
__init__(angle)

Constructor.

Initialize angle from single value

Parameters:

Name Type Description Default
angle float

Angle.

required

__isub__(angle)

Addition assignment operator.

Parameters:

Name Type Description Default
angle Angle

Angle which will be added.

required

Returns:

Type Description
Angle

Reference to Angle.

__ne__(angle)

Comparison of angles.

Be careful, this method work without tolerance!

Parameters:

Name Type Description Default
angle Angle

angle to be compared.

required

Returns:

Type Description
bool

True when angles are not equal, otherwise false.

__repr__()

Convert to string