ostk.mathematics.geometry.Angle¶
- class Angle(
- self: ostk.mathematics.geometry.Angle,
- value: ostk.core.type.Real,
- unit: ostk::mathematics::geometry::Angle::Unit,
- value: ostk.core.type.Real,
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
Create an angle from a value in arcminutes.
Create an angle from a value in arcseconds.
Overloaded function.
Create an angle from a value in degrees.
Get the unit of the angle.
Create an angle of π/2 radians (90 degrees).
Overloaded function.
Overloaded function.
Overloaded function.
Overloaded function.
Get the angle value in revolutions.
Get the angle value in a specific unit.
Check if the angle is defined.
Check if this angle is near another angle within a tolerance.
Check if the angle is negative.
Check if the angle is zero.
Create an angle of π radians (180 degrees).
Create an angle from a value in radians.
Create an angle from a value in revolutions.
Get the string representation of an angle unit.
Get the symbol representation of an angle unit.
Convert the angle to a string representation.
Create an angle of 2π radians (360 degrees).
Create an undefined angle.
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__( ) ostk.mathematics.geometry.Angle ¶
- __mul__(
- self: ostk.mathematics.geometry.Angle,
- arg0: ostk.core.type.Real,
- 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:
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:
Example
>>> angle = Angle.arcseconds(3600.0) >>> angle.in_degrees() # 1.0
- static between(*args, **kwargs)¶
Overloaded function.
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
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:
Example
>>> angle = Angle.degrees(180.0) >>> angle.in_radians() # ~3.14159
- get_unit( ) ostk::mathematics::geometry::Angle::Unit ¶
Get the unit of the angle.
- Returns:
The unit of the angle.
- Return type:
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:
Example
>>> half_pi = Angle.half_pi() >>> half_pi.in_degrees() # 90.0
- in_arcminutes(*args, **kwargs)¶
Overloaded function.
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
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.
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
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.
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
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.
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
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:
Example
>>> angle = Angle.degrees(360.0) >>> angle.in_revolutions() # 1.0
- in_unit(
- self: ostk.mathematics.geometry.Angle,
- unit: ostk::mathematics::geometry::Angle::Unit,
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:
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:
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,
- angle: ostk.mathematics.geometry.Angle,
Check if this angle is near another angle within a tolerance.
- Parameters:
- Returns:
True if angles are within tolerance, False otherwise.
- Return type:
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:
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:
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:
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:
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:
Example
>>> angle = Angle.revolutions(1.0) >>> angle.in_degrees() # 360.0
- static string_from_unit(
- unit: ostk::mathematics::geometry::Angle::Unit,
Get the string representation of an angle unit.
- Parameters:
unit (Angle.Unit) -- The angle unit.
- Returns:
String representation of the unit.
- Return type:
Example
>>> Angle.string_from_unit(Angle.Unit.Degree) # "Degree"
- static symbol_from_unit(
- unit: ostk::mathematics::geometry::Angle::Unit,
Get the symbol representation of an angle unit.
- Parameters:
unit (Angle.Unit) -- The angle unit.
- Returns:
Symbol representation of the unit.
- Return type:
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(),
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:
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:
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:
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:
Example
>>> zero_angle = Angle.zero() >>> zero_angle.is_zero() # True