Skip to content

Cartesian Coordinates

Functions for working with Cartesian state vectors and conversions.

State Conversions

state_osculating_to_cartesian builtin

state_osculating_to_cartesian(x_oe: ndarray, angle_format: AngleFormat) -> ndarray

Convert osculating orbital elements to Cartesian state.

Transforms a state vector from osculating Keplerian orbital elements to Cartesian position and velocity coordinates.

Parameters:

Name Type Description Default
x_oe ndarray

Osculating orbital elements [a, e, i, RAAN, omega, M] where a is semi-major axis (meters), e is eccentricity (dimensionless), i is inclination (radians or degrees), RAAN is right ascension of ascending node (radians or degrees), omega is argument of periapsis (radians or degrees), and M is mean anomaly (radians or degrees).

required
angle_format AngleFormat

Angle format for angular elements (RADIANS or DEGREES).

required

Returns:

Type Description
ndarray

Cartesian state [x, y, z, vx, vy, vz] where position is in meters and velocity is in meters per second.

Example
import brahe as bh
import numpy as np

# Orbital elements for a circular orbit
oe = np.array([7000000.0, 0.0, 0.0, 0.0, 0.0, 0.0])  # a, e, i, RAAN, omega, M
x_cart = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
print(f"Cartesian state: {x_cart}")

state_cartesian_to_osculating builtin

state_cartesian_to_osculating(x_cart: ndarray, angle_format: AngleFormat) -> ndarray

Convert Cartesian state to osculating orbital elements.

Transforms a state vector from Cartesian position and velocity coordinates to osculating Keplerian orbital elements.

Parameters:

Name Type Description Default
x_cart ndarray

Cartesian state [x, y, z, vx, vy, vz] where position is in meters and velocity is in meters per second.

required
angle_format AngleFormat

Angle format for output angular elements (RADIANS or DEGREES).

required

Returns:

Type Description
ndarray

Osculating orbital elements [a, e, i, RAAN, omega, M] where a is semi-major axis (meters), e is eccentricity (dimensionless), i is inclination (radians or degrees), RAAN is right ascension of ascending node (radians or degrees), omega is argument of periapsis (radians or degrees), and M is mean anomaly (radians or degrees).

Example
import brahe as bh
import numpy as np

# Cartesian state vector
x_cart = np.array([7000000.0, 0.0, 0.0, 0.0, 7546.0, 0.0])  # [x, y, z, vx, vy, vz]
oe = bh.state_cartesian_to_osculating(x_cart, bh.AngleFormat.RADIANS)
print(f"Orbital elements: a={oe[0]:.0f}m, e={oe[1]:.6f}, i={oe[2]:.6f} rad")