MATLAB Answers

Projections' Angles of Line in Space

6 views (last 30 days)
isfzade on 4 Jul 2017
Edited: Jan on 4 Jul 2017
Start of line (yellow) and axes at [xc,yc,zc]
End of line is at [xp,yp,zc].
a,b,c are the angles which line makes in space.
What I need are the angles which line's projections (black line) create on xy,yz and xz planes.
  • A_y_to_z: Projected line's angle from y axis to z axis on xz plane.
  • A_z_to_x: angle from z to x axis on zx plane.
  • A_x_to_y: Angle from x to y axis on xy plane.

Accepted Answer

Jan on 4 Jul 2017
Edited: Jan on 4 Jul 2017
The vector [xp, yp, zp] projected in the XZ plane is [xp, 0, zp]. Its normal vector is:
[xp, 0, zp] / norm([xp, 0, zp]);
The angle can be determined by the dot product with [0,0,1]:
A_ztox = acos(zP / sqrt(yp^2 + zp^2));
The same for the other two angles:
A_xtoy = acos(xP / sqrt(xp^2 + yp^2));
A_ytoz = acos(yP / sqrt(yp^2 + zp^2));
See and set one component to zero.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!