ECEF to GeodeticPoint transformation

Hello community,

I was looking at the code to perform a transformation from cartesian positions into GeodeticPoint instances, included in the OneAxisEllipsoid class’ method transform. In my specific use case, I have position vectors in ITRF already.

The method has the following signature:

public GeodeticPoint transform(final Vector3D point, final Frame frame, final AbsoluteDate date)

The Frame and AbsoluteDate instances are only needed on the first line of the method, when the point is transformed from frame to the body-fixed frame of the ellipsoid getFrame(). In my case, it requires me to pass the frame and a “placeholder” date to the method, which can be misleading.

Would it make sense to add another transform public method with signature:

public GeodeticPoint transform(final Vector3D pointInBodyFrame)

and then change the original in:

public GeodeticPoint transform(final Vector3D point, final Frame frame, final AbsoluteDate date){
    final Vector3D pointInBodyFrame = frame.getStaticTransformTo(getFrame(), date).transformPosition(point);
    return transform(pointInBodyFrame);
}

Would this be a potential addition to the class?

Thank you!

In fact, you can simply use bodyShape.getBodyFrame() to say you use the same frame and pass null as the date. This is what I do all the time.

Thank you for the quick answer. Your method keeps things quite clean and simple. I’m using the Python wrapper, and passing the null equivalent triggers type-checking warnings (even though everything is fine at runtime).

I imagine that adding an additional API point to OneAxisEllipsoid probably isn’t worth the trouble, I appreciate your clear answer.

1 Like

Hi Paolo,

good point, we could definitely add a new method (in BodyShape, the parent interface), but I would make the name more explicit, like transformInBodyFrame.

Cheers,
Romain.

1 Like

If the name is explicit, I agree, but using a generic name like transform would be misleading.

1 Like

@p.guardabasso you can open an issue on gitlab if you wish so.
Contribution welcomed too as usual.

Cheers,
Romain.

1 Like

Ok @Serrof I will do that, thanks.

Paolo