opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
759 stars 308 forks source link

Fix `Marker` does not render in the correct location when attached to a `PhysicalOffsetFrame` #3696

Open adamkewley opened 5 months ago

adamkewley commented 5 months ago

Because it doesn't apply the correct transform w.r.t. the base frame.

The code for doing it is there, but commented out:

Is it commented out for a GUI-related reason or similar, if you know @aymanhab (I think you last touched it, around Sep 2016 - there's a bunch of issues related to adding Frames around then, so I imagine it's related to that?)

aymanhab commented 5 months ago

Totally fresh in my mind being about 8 yrs ago ;) I'll try to dig through the logs to reconstruct.

adamkewley commented 5 months ago

I mean, I'm happy to patch it back in but I noticed that it's commented out and figured "hm, there might be some non-obvious reason why it'd be a bad idea to compute the marker decoration that way"

aymanhab commented 5 months ago

If I'm reading the log correctly the commented lines were removed because the results were unused. Not sure if they were ever used. Bottom line is that generateDecorations creates decoration primitives relative to some frame (MobilizedBodyIndex). This is used by the GUI as well as the API visualizer to easily move MobilizedBodies by obtaining/updating one transform and then all decorations fixed to this MobilizedBody go along for the ride. If you need to refactor this code to make it work for the new frame that's perfectly fine as long as you keep the above/existing setup working.

adamkewley commented 5 months ago

Thanks for looking into it! I'll try and patch it in a PR