Hi! In a mod I'm a collaborator on, I created code which does some of these things built in to that mod.
I was thinking that I could turn it into a separate mod which does the same thing (but other mods can use it). It does implement it in a different manner (and it was created weeks before this mod was uploaded) so I was wondering if it's ok for me to create the separate mod.
Link: https://github.com/factorio-plexpt/real-starry-universe/blob/main/data/rotation_util.lua
It's more hands on than your library, only allowing you to find the distance and orientation for an object relative to another, or doing the opposite and finding the distance and orientation for an object based on it's relative coordinates to another. These functions are called Relate and Unrelate respectively, as if you call them both sequentially with the same arguments, nothing will have changed.
We use this code here: https://github.com/factorio-plexpt/real-starry-universe/blob/main/data/planet.lua (Line 989 as of writing) where we unrelate each moon relative to it's parent object.
We also use that code here: https://github.com/factorio-plexpt/real-starry-universe/blob/main/data/mod-compat-planet.lua (Line 50 as of writing) where we unrelate the maraxsis trench "planet" relative to the maraxsis planet.
We used to use relate to get the coordinates of the maraxsis trench "planet" relative to maraxsis, then we move maraxsis and unrelate maraxsis trench relative to maraxsis. That way, maraxsis trench stays at the same distance and orientation relative to maraxsis.