There is no reference document for this, I’m sorry. I simply came up to these equations by myself (probably after some head banging against a wall) and used finite differences to validate everything. The first part, up to computation of `rotAxisCel`

before the code snippet is trivial but I don’t think it is the one you are interested in. For the compensation, I don’t remember.

However, if I should write this again now, I would not use the same approach, and this could help you implement your attitude model. I would now use `DerivativeStructure`

to compute the time derivatives, and implement by myself only the angular part. So we should start by computing `pointingP`

and `pointingSat`

not as instances of `Vector3D`

as it is done today but as `FieldVector3D<DerivativeStructure>`

instances. For `pointingP`

, there is already a method for that in the class `PVCoordinates`

: `toDerivativeStructureVector(order)`

. For `pointingSat`

, you would need to recompute it by yourself each time `getAttitude`

is called instead of having it stored as a fixed vector because it will change depending on the local orbital frame. Once you have these two vectors+derivatives, you can compute the rotation as:

```
FieldRotation<DerivativeStructure> celToSatRotationDS =
new FieldRotation<>(pointingP, phasingCel, pointingSat, phasingSat);
```

This computes the rotation, but as the rotation elements are `DerivativeStructure`

instances, you get the time derivatives for free. Then, in order to dispatch these hidden derivatives back into a regular `Transform`

, you can use

```
Transform transform = new Transform(date, new AngularCoordinates(celToSatRotationDS));
```

This works because there is also a dedicated `AngularCoordinates`

that `unpack`

derivatives.

The advantages of this approach are:

- you don’t have to compute derivatives analytically
- derivatives are not limited to first order, you also get rotation acceleration

The second point (having rotation acceleration) is useful to get more accurate results from `shiftedBy`

.

Note also that as an `AttitudeProvider`

must have both a regular double version and a field version of getAttitude, the previous approach does work in this case too. You just need to replace `DerivativeStructure`

from the regular double version by `FieldDerivativeStructure<T>`

in the field version.

I’m afraid this answer my be confusing, so do not hesitate to ask for clarification if needed.