Reputation: 139
I have a small question about 3D.
What follows is an example of my problem.
I have two points:
A: 12 4 5 B: 6 8 -10
I have another point: C: 5 6 7
I need to transform(?) point C so that the angle ABC is 48 degrees.
How do I do this? I would appreciate if someone can help me with the formulas or maybe even make the above example into a working one.
Another way to put it: How do I transform C.x, C.y, and C.z so that the angle ABC is 48 degrees?
I would really appreciate some help on this as I am stuck at the moment.
Side note: I already implemented a method for finding the angle:
float Angle( float x1, float y1, float z1,
float x2, float y2, float z2 )
{
float x, y, z;
CrossProduct( x1, y1, z1, x2, y2, z2, &x, &y, &z );
float result = atan2 ( L2Norm( x, y, z ),
DotProduct( x1, y1, z1, x2, y2, z2 ) );
return result;
}
You use it: Angle( B.x - A.x, B.y - A.y, B.z - A.z, C.x - B.x, C.y - B.y, C.z - B.z );
Upvotes: 3
Views: 238
Reputation: 20027
A------C
|
c'' | c'
B
As three point in 3D define a plane, there are only 2 possible candidates for a transform C-->c' or C-->c'' at that plane.
c' would be then c' = A+t*(B-A) + u*(C-A) with constraint Normalize(c'-A) dot Normalize(B-A) == cos (48 / 180 * pi).
I'd first suggest normalizing D=(B-A), after that:
D dot D+u*(C-A) = 1 * |D+u(C-A)| * cos (48 degrees)
Dx*(Dx+u*(Cx-Ax))+ Dy*(Dy+u*(Cy-Ay))+Dz*(Dz+u*(Cz-Az)) ==
0.669 * sqrt ((Dx+u*(Cx-Ax))^2+(Dy+u*(Cy-Ay))^2+(Dz+u*(Cz-Az))^2)
This is of form a+u*b == 0.669*sqrt(c+du+e*u^2), which will be simplified to a second degree polynomial in u by squaring both sides.
Upvotes: 2
Reputation: 11
The track of point C is actually a cone, you can imagine, B is the vertex and line AB is the central line of the cone, means the 3D cone is symmetric on AB.
Upvotes: 1