ostk.mathematics.geometry.Angle

class Angle(
self: ostk.mathematics.geometry.Angle,
value: ostk.core.type.Real,
unit: ostk::mathematics::geometry::Angle::Unit,
)

Bases: pybind11_object

Create an angle with specified value and unit.

Parameters:
  • value (float) -- The numerical value of the angle.

  • unit (Angle.Unit) -- The unit of the angle (Radian, Degree, etc.).

Example

>>> angle = Angle(3.14159, Angle.Unit.Radian)
>>> angle = Angle(180.0, Angle.Unit.Degree)

Methods

arcminutes

Create an angle from a value in arcminutes.

arcseconds

Create an angle from a value in arcseconds.

between

Overloaded function.

degrees

Create an angle from a value in degrees.

get_unit

Get the unit of the angle.

half_pi

Create an angle of π/2 radians (90 degrees).

in_arcminutes

Overloaded function.

in_arcseconds

Overloaded function.

in_degrees

Overloaded function.

in_radians

Overloaded function.

in_revolutions

Get the angle value in revolutions.

in_unit

Get the angle value in a specific unit.

is_defined

Check if the angle is defined.

is_near

Check if this angle is near another angle within a tolerance.

is_negative

Check if the angle is negative.

is_zero

Check if the angle is zero.

pi

Create an angle of π radians (180 degrees).

radians

Create an angle from a value in radians.

revolutions

Create an angle from a value in revolutions.

string_from_unit

Get the string representation of an angle unit.

symbol_from_unit

Get the symbol representation of an angle unit.

to_string

Convert the angle to a string representation.

two_pi

Create an angle of 2π radians (360 degrees).

undefined

Create an undefined angle.

zero

Create a zero angle.

class Unit(self: ostk.mathematics.geometry.Angle.Unit, value: int)

Bases: pybind11_object

Members:

Undefined

Radian

Degree

Arcminute

Arcsecond

Revolution

property name
__add__(
self: ostk.mathematics.geometry.Angle,
arg0: ostk.mathematics.geometry.Angle,
) ostk.mathematics.geometry.Angle
__mul__(
self: ostk.mathematics.geometry.Angle,
arg0: ostk.core.type.Real,
) ostk.mathematics.geometry.Angle
static arcminutes(value: ostk.core.type.Real) ostk.mathematics.geometry.Angle

Create an angle from a value in arcminutes.

Parameters:

value (float) -- The angle value in arcminutes.

Returns:

An angle with the specified value in arcminutes.

Return type:

Angle

Example

>>> angle = Angle.arcminutes(60.0)
>>> angle.in_degrees()  # 1.0
static arcseconds(value: ostk.core.type.Real) ostk.mathematics.geometry.Angle

Create an angle from a value in arcseconds.

Parameters:

value (float) -- The angle value in arcseconds.

Returns:

An angle with the specified value in arcseconds.

Return type:

Angle

Example

>>> angle = Angle.arcseconds(3600.0)
>>> angle.in_degrees()  # 1.0
static between(*args, **kwargs)

Overloaded function.

  1. between(first_vector: numpy.ndarray[numpy.float64[2, 1]], second_vector: numpy.ndarray[numpy.float64[2, 1]]) -> ostk.mathematics.geometry.Angle

    Calculate the angle between two 2D vectors.

    Args:

    first_vector (numpy.array): The first vector. second_vector (numpy.array): The second vector.

    Returns:

    Angle: The angle between the vectors.

    Example:
    >>> v1 = numpy.array([1.0, 0.0])
    >>> v2 = numpy.array([0.0, 1.0])
    >>> angle = Angle.between(v1, v2)
    >>> angle.in_degrees()  # 90.0
    
  2. between(first_vector: numpy.ndarray[numpy.float64[3, 1]], second_vector: numpy.ndarray[numpy.float64[3, 1]]) -> ostk.mathematics.geometry.Angle

    Calculate the angle between two 3D vectors.

    Args:

    first_vector (numpy.array): The first vector. second_vector (numpy.array): The second vector.

    Returns:

    Angle: The angle between the vectors.

    Example:
    >>> v1 = numpy.array([1.0, 0.0, 0.0])
    >>> v2 = numpy.array([0.0, 1.0, 0.0])
    >>> angle = Angle.between(v1, v2)
    >>> angle.in_degrees()  # 90.0
    
static degrees(value: ostk.core.type.Real) ostk.mathematics.geometry.Angle

Create an angle from a value in degrees.

Parameters:

value (float) -- The angle value in degrees.

Returns:

An angle with the specified value in degrees.

Return type:

Angle

Example

>>> angle = Angle.degrees(180.0)
>>> angle.in_radians()  # ~3.14159
get_unit(
self: ostk.mathematics.geometry.Angle,
) ostk::mathematics::geometry::Angle::Unit

Get the unit of the angle.

Returns:

The unit of the angle.

Return type:

Angle.Unit

Example

>>> angle = Angle.degrees(90.0)
>>> angle.get_unit()  # Angle.Unit.Degree
static half_pi() ostk.mathematics.geometry.Angle

Create an angle of π/2 radians (90 degrees).

Returns:

An angle of π/2 radians.

Return type:

Angle

Example

>>> half_pi = Angle.half_pi()
>>> half_pi.in_degrees()  # 90.0
in_arcminutes(*args, **kwargs)

Overloaded function.

  1. in_arcminutes(self: ostk.mathematics.geometry.Angle) -> ostk.core.type.Real

    Get the angle value in arcminutes.

    Returns:

    float: The angle value in arcminutes.

    Example:
    >>> angle = Angle.degrees(1.0)
    >>> angle.in_arcminutes()  # 60.0
    
  2. in_arcminutes(self: ostk.mathematics.geometry.Angle, lower_bound: ostk.core.type.Real, upper_bound: ostk.core.type.Real) -> ostk.core.type.Real

    Get the angle value in arcminutes within specified bounds.

    Args:

    lower_bound (float): The lower bound in arcminutes. upper_bound (float): The upper bound in arcminutes.

    Returns:

    float: The angle value in arcminutes, wrapped within bounds.

in_arcseconds(*args, **kwargs)

Overloaded function.

  1. in_arcseconds(self: ostk.mathematics.geometry.Angle) -> ostk.core.type.Real

    Get the angle value in arcseconds.

    Returns:

    float: The angle value in arcseconds.

    Example:
    >>> angle = Angle.degrees(1.0)
    >>> angle.in_arcseconds()  # 3600.0
    
  2. in_arcseconds(self: ostk.mathematics.geometry.Angle, lower_bound: ostk.core.type.Real, upper_bound: ostk.core.type.Real) -> ostk.core.type.Real

    Get the angle value in arcseconds within specified bounds.

    Args:

    lower_bound (float): The lower bound in arcseconds. upper_bound (float): The upper bound in arcseconds.

    Returns:

    float: The angle value in arcseconds, wrapped within bounds.

in_degrees(*args, **kwargs)

Overloaded function.

  1. in_degrees(self: ostk.mathematics.geometry.Angle) -> ostk.core.type.Real

    Get the angle value in degrees.

    Returns:

    float: The angle value in degrees.

    Example:
    >>> angle = Angle.radians(3.14159)
    >>> angle.in_degrees()  # ~180.0
    
  2. in_degrees(self: ostk.mathematics.geometry.Angle, lower_bound: ostk.core.type.Real, upper_bound: ostk.core.type.Real) -> ostk.core.type.Real

    Get the angle value in degrees within specified bounds.

    Args:

    lower_bound (float): The lower bound in degrees. upper_bound (float): The upper bound in degrees.

    Returns:

    float: The angle value in degrees, wrapped within bounds.

    Example:
    >>> angle = Angle.degrees(450.0)
    >>> angle.in_degrees(-180.0, 180.0)  # 90.0
    
in_radians(*args, **kwargs)

Overloaded function.

  1. in_radians(self: ostk.mathematics.geometry.Angle) -> ostk.core.type.Real

    Get the angle value in radians.

    Returns:

    float: The angle value in radians.

    Example:
    >>> angle = Angle.degrees(180.0)
    >>> angle.in_radians()  # ~3.14159
    
  2. in_radians(self: ostk.mathematics.geometry.Angle, lower_bound: ostk.core.type.Real, upper_bound: ostk.core.type.Real) -> ostk.core.type.Real

    Get the angle value in radians within specified bounds.

    Args:

    lower_bound (float): The lower bound in radians. upper_bound (float): The upper bound in radians.

    Returns:

    float: The angle value in radians, wrapped within bounds.

    Example:
    >>> angle = Angle.radians(7.0)
    >>> angle.in_radians(-3.14159, 3.14159)  # Wrapped to [-π, π]
    
in_revolutions(self: ostk.mathematics.geometry.Angle) ostk.core.type.Real

Get the angle value in revolutions.

Returns:

The angle value in revolutions.

Return type:

float

Example

>>> angle = Angle.degrees(360.0)
>>> angle.in_revolutions()  # 1.0
in_unit(
self: ostk.mathematics.geometry.Angle,
unit: ostk::mathematics::geometry::Angle::Unit,
) ostk.core.type.Real

Get the angle value in a specific unit.

Parameters:

unit (Angle.Unit) -- The unit to convert to.

Returns:

The angle value in the specified unit.

Return type:

float

Example

>>> angle = Angle.degrees(180.0)
>>> angle.in_unit(Angle.Unit.Radian)  # ~3.14159
is_defined(self: ostk.mathematics.geometry.Angle) bool

Check if the angle is defined.

Returns:

True if the angle is defined, False otherwise.

Return type:

bool

Example

>>> angle = Angle.radians(1.0)
>>> angle.is_defined()  # True
is_near(
self: ostk.mathematics.geometry.Angle,
angle: ostk.mathematics.geometry.Angle,
tolerance: ostk.mathematics.geometry.Angle,
) bool

Check if this angle is near another angle within a tolerance.

Parameters:
  • angle (Angle) -- The angle to compare with.

  • tolerance (Angle) -- The tolerance for comparison.

Returns:

True if angles are within tolerance, False otherwise.

Return type:

bool

Example

>>> angle1 = Angle.degrees(30.0)
>>> angle2 = Angle.degrees(30.1)
>>> tolerance = Angle.degrees(0.2)
>>> angle1.is_near(angle2, tolerance)  # True
is_negative(self: ostk.mathematics.geometry.Angle) bool

Check if the angle is negative.

Returns:

True if the angle is negative, False otherwise.

Return type:

bool

Example

>>> angle = Angle.degrees(-30.0)
>>> angle.is_negative()  # True
is_zero(self: ostk.mathematics.geometry.Angle) bool

Check if the angle is zero.

Returns:

True if the angle is zero, False otherwise.

Return type:

bool

Example

>>> angle = Angle.zero()
>>> angle.is_zero()  # True
static pi() ostk.mathematics.geometry.Angle

Create an angle of π radians (180 degrees).

Returns:

An angle of π radians.

Return type:

Angle

Example

>>> pi = Angle.pi()
>>> pi.in_degrees()  # 180.0
static radians(value: ostk.core.type.Real) ostk.mathematics.geometry.Angle

Create an angle from a value in radians.

Parameters:

value (float) -- The angle value in radians.

Returns:

An angle with the specified value in radians.

Return type:

Angle

Example

>>> angle = Angle.radians(3.14159)
>>> angle.in_degrees()  # ~180.0
static revolutions(value: ostk.core.type.Real) ostk.mathematics.geometry.Angle

Create an angle from a value in revolutions.

Parameters:

value (float) -- The angle value in revolutions.

Returns:

An angle with the specified value in revolutions.

Return type:

Angle

Example

>>> angle = Angle.revolutions(1.0)
>>> angle.in_degrees()  # 360.0
static string_from_unit(
unit: ostk::mathematics::geometry::Angle::Unit,
) ostk.core.type.String

Get the string representation of an angle unit.

Parameters:

unit (Angle.Unit) -- The angle unit.

Returns:

String representation of the unit.

Return type:

str

Example

>>> Angle.string_from_unit(Angle.Unit.Degree)  # "Degree"
static symbol_from_unit(
unit: ostk::mathematics::geometry::Angle::Unit,
) ostk.core.type.String

Get the symbol representation of an angle unit.

Parameters:

unit (Angle.Unit) -- The angle unit.

Returns:

Symbol representation of the unit.

Return type:

str

Example

>>> Angle.symbol_from_unit(Angle.Unit.Degree)  # "deg"
>>> Angle.symbol_from_unit(Angle.Unit.Radian)  # "rad"
to_string(
self: ostk.mathematics.geometry.Angle,
precision: ostk.core.type.Integer = Integer.undefined(),
) ostk.core.type.String

Convert the angle to a string representation.

Parameters:

precision (int, optional) -- The precision for floating point numbers. Defaults to Integer.undefined().

Returns:

String representation of the angle.

Return type:

str

Example

>>> angle = Angle.degrees(90.0)
>>> angle.to_string()  # "90.0 [deg]"
static two_pi() ostk.mathematics.geometry.Angle

Create an angle of 2π radians (360 degrees).

Returns:

An angle of 2π radians.

Return type:

Angle

Example

>>> two_pi = Angle.two_pi()
>>> two_pi.in_degrees()  # 360.0
static undefined() ostk.mathematics.geometry.Angle

Create an undefined angle.

Returns:

An undefined angle.

Return type:

Angle

Example

>>> undefined_angle = Angle.undefined()
>>> undefined_angle.is_defined()  # False
static zero() ostk.mathematics.geometry.Angle

Create a zero angle.

Returns:

A zero angle (0 radians).

Return type:

Angle

Example

>>> zero_angle = Angle.zero()
>>> zero_angle.is_zero()  # True