Sun angle computation

Hi all,
I am using Orekit 12.0.2. I need to compute the angle between spacecraft and sun (sun angle). Do you have an idea of how to compute it?
Thanks,
Antonio

Hi @antonio.dortona,

Welcome to the forum!

Suppose you have a SpacecraftState state:

// Sun position provider
CelestialBody sun = CelestialBodyFactory.getSun();

// Get the Sun position at the same date and in the same frame as the S/C state
Vector3D sunPos = sun.getPosition(state.getDate(), state.getFrame());

// Get the angle between the S/C and the Sun (in radians)
final double angleScSun = Vector3D.angle(sunPos, state.getPosition());

Hope this helps,
Maxime