How do i find the all of the points in a cube when the graph is rotated 45 degrees?

102 Views Asked by At

I hope this is not a duplicate question, i am pretty new here so bear with me.

I just want something simple, i have an x,y,z (3d) graph inside a main graph in which it contains a cube, points:

(0, 4, 4), (0, 4, 0), (0, 0, 0), (0, 0, 4)

(4, 4, 4), (4, 4, 0), (4, 0, 0), (4, 0, 4)

4x4x4 (length, width, height)

The problem is that if i were to tilt the graph towards me and directing downward 45 degrees, the cube's position in the graph does not change, but the points do, imagine a graph within a graph, the graph that's tilted is inside the main graph, the points have changed due to the tilt, i just want to know how to find the new points.

Here's a visualization:

In this image, the main graph is holding a graph that contains a cube, notice how theres no depth (3d) because the camera is not tilted yet

[2d view]1

And here is the view after the graph has been tilted 45 degrees:

[45 degree rotation]2

1

There are 1 best solutions below

0
On BEST ANSWER

If you have a file of points $(x_k,y_k,z_k)$ maybe on a curve, maybe not, the transformed points $(x'_k,y'_k,z'_k)$ by a -45° rotation around $x$ axis are given by the formula

$$\begin{pmatrix}x'_k\\y'_k\\z'_k\end{pmatrix}=\begin{pmatrix}1&0&0\\0&a&a\\0&-a&a\end{pmatrix}\begin{pmatrix}x_k\\y_k\\z_k\end{pmatrix}$$

where $a = \cos(45°) = \sin(45°) = \sqrt{2}/2 \approx 0.707.$

which means that :

$$\begin{cases}x'_k&=&x_k\\y'_k&=&a(y_k+z_k)\\z'_k&=&a(-y_k+z_k)\end{cases}$$