0

I want to create a cube and a line, and make this line became the spatial diagonal of this cube. Using trigonometry, I know that the angle formed by a line with no rotation and the spatial diagonal is 54.73561031724535. But in a 3D engine system, I am supposed to rotate the line in the x,y,z axis to achieve this. How can I calculate that?

This image make my doubt very clear: https://pbs.twimg.com/media/BGSqw3uCAAAreJf.jpg:large

I am using the Three.js engine to build my cube.

2 Answers2

1

You can avoid all the trig calculations by taking the bounding box of the cube and drawing a line from the bounding box min to the bounding box max.

gaitat
  • 12,449
  • 4
  • 52
  • 76
0

Ok. I got it.

Rotate the line 45 degress in x-axys to reach the diagonal plane. With that, the line will rotate at z-axys at the same plane of the spatial diagonal. After that, I just need to rotate the line in z-axys in 54.73561031724535 degrees.