Solved

How do i rotate a quad by its origen/pivot point? direct3d

Posted on 2007-11-21
10
670 Views
Last Modified: 2013-12-26
How do i rotate a quad by its origen/pivot point? direct3d

i use the following: for define my quad i know how to rotate it by it rotates by the top-left point and not by his origen point? any help?

i really need this.

vertexarray[0].x := 0;
vertexarray[0].y := 0;
vertexarray[0].z := 0.0;

vertexarray[1].x := 0;
vertexarray[1].y := 64;
vertexarray[1].z := 0.0;

vertexarray[2].x :=  0;
vertexarray[2].y :=  0;
vertexarray[2].z := 0.0;
vertexarray[2].rhw := 1.0;

 vertexarray[3].x :=  64;
vertexarray[3].y :=  0;
vertexarray[3].z := 0.0;


 vertexarray[4].x :=  64;
vertexarray[4].y :=  0;
vertexarray[4].z := 0.0;


 vertexarray[5].x :=  64;
vertexarray[5].y :=  64;
vertexarray[5].z := 0.0;

 vertexarray[6].x :=  0;
vertexarray[6].y :=  64;
vertexarray[6].z := 0.0;
0
Comment
Question by:becoolnike
10 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 20332008
shift the to left point to the origin, rotate around  the origin, translate back
0
 

Author Comment

by:becoolnike
ID: 20332719
i want to shift the to left point to the origin but i dont know how lol.
0
 
LVL 84

Expert Comment

by:ozo
ID: 20332733
subtract the coordinates of the top left point from all the points
0
 
LVL 20

Expert Comment

by:ikework
ID: 20333062
if your *origin is the center, then substract every x- and y-component of each vertex with 32 and rotate it then:

vertexarray[0].x := 0-32;
vertexarray[0].y := 0-32;
vertexarray[0].z := 0.0;

vertexarray[1].x := 0-32;
vertexarray[1].y := 64-32;
vertexarray[1].z := 0.0;

vertexarray[2].x :=  0-32;
vertexarray[2].y :=  0-32;
vertexarray[2].z := 0.0;
vertexarray[2].rhw := 1.0;

 vertexarray[3].x :=  64-32;
vertexarray[3].y :=  0-32;
vertexarray[3].z := 0.0;


 vertexarray[4].x :=  64-32;
vertexarray[4].y :=  0-32;
vertexarray[4].z := 0.0;


 vertexarray[5].x :=  64-32;
vertexarray[5].y :=  64-32;
vertexarray[5].z := 0.0;

 vertexarray[6].x :=  0-32;
vertexarray[6].y :=  64-32;
vertexarray[6].z := 0.0;


good luck :)
ike
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 84

Expert Comment

by:ozo
ID: 20333110
I thought you said you wanted to rotate around the top-left point rather than around (0,0,0)
Do you want to rotate around its midpoint?
0
 

Author Comment

by:becoolnike
ID: 20333255
yeah by his midpoint called povot. anyway without locking vertex/
there must be a fucntion using direct3d utils.
0
 

Author Comment

by:becoolnike
ID: 20333258
vertex locking takes takes off mush speed of a game.
0
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 20333337
multiply the
translate by povot matrix
*
rotate matrix
*
translate by -povot matrix
The resulting matrix id a rotation around povot
Apply that matrix to your vertexarray
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20521694
Forced accept.

Computer101
EE Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Python and Network Datagrams 7 403
Any good game free GIF sites? 2 128
more20  java challenge 52 95
Trigonometry for game star field help 1 112
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now