I have two points with fixed distance (e.g. 30 centimeter) and exactly the same orientation in 3D space. The position of point 1 (x1,y1,z1) and orientation of point 1 (represented in quaternion q0, q1, q2, q3) are already known. How can I calculate the position of point 2 ? (No matter how I move them, the distance between them won't change and the orientation will always be the same)
I searched on the web, and this is the closest question I can find https://www.opengl.org/discussion_boards/showthread.php/173480-Calculate-object-orientation-from-a-quaternion but I still could not figure out how to solve it. I guess I didn't define the problem correctly so that I'm not able to find the right mathmatical solution. Thanks!
From what I understood of your question you have two particles P1 and P2 that have a rigid transformation between them (at all times the relative position and relative orientation between P1 and P2 are constant).
The answer is similar to this answer however it is a bit different.
Lets say your two particle positions are p1 and p2, and the rotation of the first particle is q1 = [w1, x1, y1, z1]. The relative quaternion orientation between P1 and P2 is q12 and the relative position is p12 = p2 - p1. Then:
p2 = p1 + C(q1)*p12
q2 = q1 ⊗ q12
Where ⊗ is the quaternion multiplication operator, and C(q1) is the rotation matrix formed from q1. See the link I posted above for how to do this without the C(q) function.
For funsies, the position and orientation of any particle P3 with a rigid transform between P2 is very similar:
p3 = p2 + C(q2)*p23
q3 = q2 ⊗ q23
EDIT: I've added a figure and animation to try and explain the relative position and orientations, although it is hard to do, so I have shown only the 2D case which has only (x, y) and rotation about the z axis. The same concept applies to 3d but it is harder to visualise.
You must know the relative position between P1 and P2 expressed in the parent frame, as well as the relative orientation. Or you can work those out by knowing the initial positions and orientations of each particle in the Global frame, but this is more difficult with quaternions. The relative positions are fairly straightforward, but the orientations require a bit of effort. First find the Euler angle rotation sequence that brings P1 axes into alignment with the P2 axes. Then use some library to convert the Euler->quaternion.