Skip to content

Commit

Permalink
validated stellar engine. Found issue with terrain that's too flat.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineRichard committed Sep 5, 2024
1 parent b23faf7 commit c595183
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions src/stellar/stellar_engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from src.configurations.stellar_engine_confs import StellarEngineConf
from scipy.spatial.transform import Rotation as SSTR
from skyfield.api import PlanetaryConstants, load
from typing import Tuple
import datetime
Expand Down Expand Up @@ -178,25 +179,8 @@ def convertAltAzToQuat(self, alt: float, az: float) -> Tuple[float, float, float
Returns:
Tuple[float, float, float, float]: the quaternion representing the altitude and azimuth. (qw, qx, qy, qz)
"""
alt = math.radians(alt)
az = math.radians(az)
alt = alt - math.pi / 2 # Compensate for the default direction of the light

# Orientation
cr = math.cos(alt * 0.5)
sr = math.sin(alt * 0.5)
cp = 0
sp = 1
cy = math.cos(az * 0.5)
sy = math.sin(az * 0.5)

qw = sr * sp * sy
qx = -cr * sp * sy
qy = cr * sp * cy
qz = -sr * sp * cy

quat = (qw, qx, qy, qz)
return quat
x, y, z, w = SSTR.from_euler("xyz", [0, alt, az - 90], degrees=True).as_quat()
return (w, x, y, z)


if __name__ == "__main__":
Expand Down

0 comments on commit c595183

Please sign in to comment.