pyomeca / ezc3d

Easy to use C3D reader/writer for C++, Python and Matlab
https://pyomeca.github.io/Documentation/ezc3d/index.html
MIT License
145 stars 46 forks source link

Extracting global coordinate system orientation #274

Closed RiadAkhundov closed 1 year ago

RiadAkhundov commented 1 year ago

Hi,

I'm trying to find a programmatical way of finding the global coordinate system orientation (and the same for the forceplates).

This information seems to be stored in the .c3d file, as when you open the c3d in Mokka, it shows these coordinate systems (see image), but I don't see an option to extract this information in ez3d (or in btk).

Do you have ideas/suggestions on this issue?

Cheers

image

pariterre commented 1 year ago

Dear @RiadAkhundov The C3D file is a bit of a mess when talking about the force platform. Still, there is some kind of standardisation. According to the official documentation, you can find the reference frame by reconstructing it using the CORNER and ORIGIN parameters (https://www.c3d.org/HTML/default.htm?turl=Documents%2Fforceplatformtype.htm)

That said, I have made this work already, but funny enough, I did not provided an interface to retreive the answer. In the short term, you can copy the piece of code that computes the reference frame from this function https://github.com/pyomeca/ezc3d/blob/dev/src/modules/ForcePlatforms.cpp#L300

(assuming you extracted the corners (https://github.com/pyomeca/ezc3d/blob/dev/src/modules/ForcePlatforms.cpp#L195) and the origin (https://github.com/pyomeca/ezc3d/blob/dev/src/modules/ForcePlatforms.cpp#L219))

RiadAkhundov commented 1 year ago

Thank you @pariterre, that is exactly what I was looking for!

Cheers