Simbody Plane Class - How can I see the source code calculations?

The 2018 Fall Virtual Workshop will bring together a group of international scholars and OpenSim experts to help each other advance their research using modeling and simulation. This forum is a place to accelerate OpenSim based projects while also buildin
POST REPLY
User avatar
Nicos Haralabidis
Posts: 196
Joined: Tue Aug 16, 2016 1:46 am

Simbody Plane Class - How can I see the source code calculations?

Post by Nicos Haralabidis » Fri Oct 26, 2018 3:36 am

Hi all,

I am using the following:

Vec3 normal = Vec3(0,1,0);
double offset = 0;

Plane GroundPlane = Plane(normal, offset);

It compiles and runs but I would like to see the calculations performed, please could someone point me to the source code of the Plane calculation?

Thanks,

Nicos

User avatar
Thomas Uchida
Posts: 1792
Joined: Wed May 16, 2012 11:40 am

Re: Simbody Plane Class - How can I see the source code calculations?

Post by Thomas Uchida » Fri Oct 26, 2018 6:44 am

Here's how I found it:
1. Go to the Simbody doxygen documentation here: https://simtk.org/api_docs/simbody/3.5/
2. Search for "plane" in the "Search" box at the top and select the first result.
3. Go to the bottom of the "SimTK::Plane Class Reference" page and click the link to the ContactGeometry.h file (below "The documentation for this class was generated from the following file:").
4. Find "plane(" on this page.

User avatar
Nicos Haralabidis
Posts: 196
Joined: Tue Aug 16, 2016 1:46 am

Re: Simbody Plane Class - How can I see the source code calculations?

Post by Nicos Haralabidis » Fri Oct 26, 2018 8:36 am

Hello Thomas,

That worked a treat - thanks!

I am looking at the following line which is meant to a return a Real variable:
return ~m_normal*pt - m_offset;

What purpose does the tilde (~) operator serve in this instance? I haven't come across this syntax before in a similar example and I can't seem to find an answer online.

Kind regards,

Nicos Haralabidis

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

Re: Simbody Plane Class - How can I see the source code calculations?

Post by Ayman Habib » Fri Oct 26, 2018 8:44 am

Hello,

~ is the operator for transpose.

-Ayman

User avatar
Thomas Uchida
Posts: 1792
Joined: Wed May 16, 2012 11:40 am

Re: Simbody Plane Class - How can I see the source code calculations?

Post by Thomas Uchida » Fri Oct 26, 2018 8:49 am

Ayman is correct (of course). You may wish to refer to the Simbody User's Guide here: https://github.com/simbody/simbody/tree ... imbody/doc (SimbodyAndMolmodelUserGuide.pdf, Section 5.3.1: Operators).

User avatar
Nicos Haralabidis
Posts: 196
Joined: Tue Aug 16, 2016 1:46 am

Re: Simbody Plane Class - How can I see the source code calculations?

Post by Nicos Haralabidis » Fri Oct 26, 2018 12:39 pm

Thanks for your help Ayman and Thomas! It makes sense now! (dot product)

POST REPLY