# Thread: Help with vertex's in a 3d space

1. ## Help with vertex's in a 3d space

I am making a 3d editing program and I need help with vertex points.

In a grid like this

given a point say (-20,-30,50), how would I get the new point if that point were to be rotated say 50 degrees along the y axis plane?

so the y plane would look like a vertical wall in the center of the grid. (so you know, its the y plane)

I figure if I had a 3d model and knew all its vertex's, then edited them all, and viewed the new model, the whole model would be rotated 50 degrees along the y plane.

thanks

2. ## Re: Help with vertex's in a 3d space

y-plane? there are an infinite number of planes that contain the y-axis. using your sketch, the vertical plane that contains the y-axis would be the y-z plane.

3. ## Re: Help with vertex's in a 3d space

Yeah but I think I see what you mean.
Here is a new picture. This is what you mean by y-z plane?

Anyways I figure I have to use something like this:
Code:
for i=1 to nrpoint

;or what ever :)
x#=x_ponit(i)
y#=y_ponit(i)
z#=z_ponit(i)

; rotate x-axis
x1#=x#
y1#=(cos(ang)*y#)+(sin(ang)*z#)
z1#=(sin(ang)*z#)-(cos(ang)*y#)

;roate y-axis
x2#=(cos(ang)*x1#)+(sin(ang)*z1#)
y2#=y1#
z2#=(sin(ang)*z1#)-(cos(ang)*x1#)

;rotate z-axis
x1#=(cos(ang)*x2#)+(sin(ang)*y2#)
y1#=(cos(ang)*y2#)+(sin(ang)*x2#)
z1#=z2#

x_ponit(i)=x1#
y_ponit(i)=y1#
z_ponit(i)=z1#

next

4. ## Re: Help with vertex's in a 3d space

If you mean "rotate around the y-[b]axis[b]", not "y-axis plane", then any rotation about the y-axis, through angle [itex]\theta[/tex] changes (x, y, z) into (x', y', z') given by
$\displaystyle \begin{bmatrix}x' \\ y' \\ z'\end{bmatrix}= \begin{bmatrix}cos(\theta) & 0 & -sin(\theta) \\ 0 & 1 & 0 \\ sin(\theta) & 0 & cos(\theta)\end{bmatrix}\begin{bmatrix}x \\ y \\ z\end{bmatrix}$

5. ## Re: Help with vertex's in a 3d space

hmm ok but how do I compute that, can you write each one out as a line rather than as a matrix, and also what are the matrix's for rotating around the x-axis and z-axis?