I have 2 identical triangles in different places and need to know the rotation and movement to get from triangle #1 to triangle #2. There is no perpendicular angle in that triangle(s).

the rotation has to be in quaternions. The movement in x=x+/-n y=y+/-n z=z+/-n

I am coding in Java3d but any other language would work for me to understand how to do that.

I have 5 marbles in one hand and 8 in the other. If I subtract 5 from 8 I will know the difference. Now if I add that number I will be in same rotation as the second one.

Given a triangle consisting of 3 vertices p1, p2 and p3, construct a fourth vertex p4 = p1+(p2-p1)×(p3-p1). Convert from Euclidean (3D) to homogeneous (4D) coordinates, setting w=1. Construct a 4x4 matrix whose columns are the 4 vertices.

Do this for both triangles to obtain matrices A and B. M=A-1·B is the transformation from A to B, M-1=B-1·A is the inverse (from B to A). The rotation and translation components can be extracted as a quaternion and vector via e.g. Matrix4d.get().

Note that you need to specify the vertices in the same order for both triangles. Otherwise you’ll get a matrix which includes scale/shear transformations. If the order is correct and the two triangles are the same except for translation and rotation, the bottom row of M (and M-1) will be [0,0,0,1] (give or take rounding errors), and the upper 3x3 submatrix will be orthonormal (multiplying it with its transpose will yield the identity matrix, again give or take rounding errors).

Can someone help me to get this done with pure Java3d classes? I would pay for.

There is no context so while I’m sure that paragraph makes sense, it also makes no sense because we have no idea what you are attempting to achieve. Explain to us what it is you want to do, and we may be able to get you to understand. We will not do it for you, however.

It’s starting to feel like this is for a school assignment… in which case they won’t be able to explain why they want to do this. It’s an arbitrary school assignment.

I guess if it’s not then OP will have no problem explaining what they are really trying to do.

Else, I suggest everyone just skip this thread until then.

The rotation between two quaterion is actually pretty easy to find. It is quat1.inverse and then mult with quat2

The problem I face is that my triangle has no 90 degrees in it. So I can not jut take the cross of the points and build one easy. If so, Ineasy could create the quaterion out of those 3 points.

Writing this I realize what the answer I got is doing. With the first function he is going to make this new vertices which I need to declare on which side is up.

I need this to rotate the workobject x/y/z plane of a ABB 7-axis robot to match the plane I have in my cad/cam software I wrote.