• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# 3d vector rotation

## 4 posts in this topic

how can i rotate a vector by a certain amount of degrees ? is it possible or do i have to rotate the vector by a matrix ?
0

##### Share on other sites
this was done for a java applet the formula is fine if i could only get the damn kinks out of the rest of the applet
here xa,ya,za is the point of the vertice loades in from a array 1 at a time hope it helps

Xa=Xp[vv][v];
Ya=Yp[vv][v];
Za=Zp[vv][v];

// improvised on the rotation formula because
// all the examples for simultaneous operations were for matrixes only
// this is a simultaneous operation on all 3 axis without a matrix

//System.out.println( "*********x*y*z*rotating on the axis''es" );
// rotate on the z axis

// rotate on the x axis

// rotate on the y axis

// place into temp array for drawing manipulation
// add a screen offset so its not spining around coordinates 0,0 x y
Xtemp[v] = Xb+off_set;
Ytemp[v] = Yb+off_set;
Ztemp[v] = Zb;

0

##### Share on other sites
btw
it use radians math.pi is just pie

double radiansZ = ( Math.PI * degreesZ )/180;
double radiansX = ( Math.PI * degreesX )/180;
double radiansY = ( Math.PI * degreesY )/180;
0

##### Share on other sites
one more thing im gonna post the entire code in the java
programing forum if anyone can help me figure out why the heck
this applet cause the error it cause plz help no one in the sun forums has a answer
0

thx !!
0