Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


3d vector rotation


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 IStrikerI   Members   -  Reputation: 122

Like
Likes
Like

Posted 24 August 2001 - 05:43 AM

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 ?

Sponsor:

#2 lightwave   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 August 2001 - 06:39 AM

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
Xb = (int)(Xa * Math.cos(radiansZ) - Ya * Math.sin(radiansZ) );
Yb = (int)(Ya * Math.cos(radiansZ) + Xa * Math.sin(radiansZ) );

// rotate on the x axis
Yb = (int)(Yb * Math.cos(radiansX) - Za * Math.sin(radiansX) );
Zb = (int)(Yb * Math.sin(radiansX) + Za * Math.cos(radiansX) );

// rotate on the y axis
Zb = (int)(Zb * Math.cos(radiansY) - Xb * Math.sin(radiansY) );
Xb = (int)(Zb * Math.sin(radiansY) + Xb * Math.cos(radiansY) );

// 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;



#3 lightwave   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 August 2001 - 06:42 AM

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;

#4 lightwave   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 August 2001 - 06:52 AM

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

#5 IStrikerI   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 August 2001 - 11:36 AM

thx !!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS