2
votes

I try to rotate and translate an equilateral triangle in 3D until his vertices reach some coordinates.

The vertices coordinates F,G,H and F',G',H' are known :

enter image description here

I was able to find the new centroid c' coordinates like this :

c'.x = ( F'.x + G'.x + H'.x ) / 3
c'.y = ( F'.y + G'.y + H'.y ) / 3
c'.z = ( F'.z + G'.z + H'.z ) / 3

So no problem to translate the triangle. But I can't find a way to calculate the rotations needed to put F'G'H' triangle in the right position...

I have to know by how much the triangle F'G'H' has to be rotated in degrees, around each axis (x,y,z), knowing that the rotations of the initial triangle are 0°.

By rotation for each axis, I'm talking about this:

enter image description here

Any ideas?

1
How do you define the rotations? There are different conventions.Beta
I'm not exactly sure about the convention, but basically, I have to know by how much the triangle F'G'H' has to be rotated in degrees, on each axis (x,y,z), knowing that the rotations of the initial triangle are 0°. (I updated the question).Julian
I'm afraid 3D rotation are not that simple, for example, notice that rotating 90° around the X-axis and then 90° around the Y-axis is not the same as rotating 90° around the Y-axis and then 90° around the X-axis. that's why, as @Beta said there are different conventions. I suggest you read up about Euler angles and Quaternions.pseudoDust
I think Euler angles is what I want, but the convention doesn't really help me calculating the angles...Julian
Are you familiar with the Rordigues' Rotation formula?John Alexiou

1 Answers

4
votes

trick is to find the normal vectors of the triangles using cross product b4 and after rotations

v1 = (F.x - G.x, F.y - G.y, F.z - G.z)
v2 = (F.x - H.x, F.y - H.y, F.z - H.z)
n  = cross_prod(v1, v2) # see http://en.wikipedia.org/wiki/Cross_product
n  = n / norm(n) # normalize to unit vector

v'1 = (F'.x - G'.x, F'.y - G'.y, F'.z - G'.z)
v'2 = (F'.x - H'.x, F'.y - H'.y, F'.z - H'.z)
n'  = cross_prod(v'1, v'2)
n'  = n' / norm(n')

rot = arc_cos(n.x * n'.x + n.y * n'.y + n.z * n'.z)