Hello @saltinisik,
What you’re trying to achieve looks very much like what @Echulion already asked for at the end of this thread.
Am I right @Echulion ?
I will try to answer, hoping that I can help the both of you.
Suppose you have a SpacecraftState state
and a GeodeticPoint geoPoint
.
// Get the reference frame of the SpacecraftState (the inertial frame where the orbit is computed)
Frame refFrame = state.getFrame();
// Get the position of the SpacecraftState in ref frame
Vector3D satPosInRefFrame = state.getPVCoordinates().getPosition();
// Get its date
AbsoluteDate date = state.getDate();
// Get the attitude of the spacecraft (a rotation from reference frame to "satellite" frame)
Attitude attitude = state.getAttitude();
// Get the underlying topocentric frame of the geodetic point
TopocentricFrame topoFrame = new TopocentricFrame(earth, geoPoint, "topoFrame");
// Get the geodetic point position in reference frame
Vector3D geoPointInRefFrame = topoFrame.getPVCoordinates(date, refFrame).getPosition();
// Let O be the center of frame, S the satellite and P the geodetic point
// Compute satellite to geodetic point vector: SP = - OS + OP
Vector3D sat2GeoPoint = geoPointInRefFrame.subtract(satPosInRefFrame);
// Normalize the vector and rotate it using the attitude
Vector3D geoPointDirectionInSatFrame = attitude.getRotation().applyTo(sat2GeoPoint.normalize());
With this you should have the geodetic point direction in satellite frame (i.e. a unit vector pointing to the geodetic point with respect to the satellite position and attitude).
Is that what you are looking for ?
Maxime