# Calculating a position in a 3D from 2 quaternions and 2 fixed-length segments

Hello,

I am trying to calculate a position in a 3D space from the following data:

I have an origin which corresponds to the end of a segment with a known length. The segment's opposite end should be calculated according to the segment's orientation, provided as a quaternion. This first segment is tied to a second one, with a known length too. This second segment can freely rotate around the joint. Its orientation is also given as a quaternion.

The seeked position (possibly in a cartesian space) corresponds to the second segment's opposite end.

I don't understand how I can use the quaternions to position the segments. My software can easily convert quaternions to Euler angles and axis-angle but I have no idea which representation is best for my purpose.

Here's a picture showing the position of the sensors and their orientation.

Thank you in advance for helping.

It is straightforward to use a quaternion to rotate a vector, then use simple vector addition to define the endpoint in 3D space.

It is best that you understand the math so that you can write the code. It is simply algebra and trig, although not particularly intuitive.

Google "quaternion math" to immediately reveal at least three excellent, very clear overviews of the topic, with applicable formulas to solve the problem. Look for game-oriented overviews, as they tend to have practical approaches.