Here's essentially my problem. Also maybe I am not familiar enough with Euler angles and what I'm attempting to do is not possible.
I have 2 points in 3d space.
p1 (1,2,3)
p2 (4,5,6)
In order to get the unit vectors for these two points I'm doing this basically.
var productX = (position.X2 - position.X1);
var productY = (position.Y2 - position.Y1);
var productZ = (position.Z2 - position.Z1);
var normalizedTotal = Math.sqrt(productX * productX + productY * productY + productZ * productZ);
var unitVectorX, unitVectorY, unitVectorZ;
if(normalizedTotal == 0)
{
unitVectorX = productX;
unitVectorY = productY;
unitVectorZ = productZ;
}
else
{
unitVectorX = productX / normalizedTotal;
unitVectorY = productY / normalizedTotal;
unitVectorZ = productZ / normalizedTotal;
}
So now I have a unit vector x y z for these 2 3d points.
I'm attempting now to convert from directional vector to euler angle. Is this possible. What am I missing here as I can't find any good resource on how to do this.
Thanks for the help.
Sometimes a picture helps.
maybe this will give a better example of what i'm trying to solve for.
Given 2 points, I have determined a midpoint, length, and now i'm trying to figure out hte angles to set so that the cylinder is correctly oriented around the x,y,z axis. I think I need to figure out all 3 angles not just 1 and 2 is that correct? I think the euler angles from a directional vector bit through you off.