Jump to content
• Advertisement

# Inverted points transformation.

This topic is 4270 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hi, I got very quick question. Does anyone know how to do such a thing: 1. I got cloud of points with it's weight other then the 0,0,0. 2. I'm moving it to 0,0,0 then rotate and scale. 3. After that I'm getting the MODELVIEW_MATRIX: glGetFloatv(GL_MODELVIEW_MATRIX ,mr); 4. After that I'm drawing the box with corners (X0,Y0,Z0) -> (X1,Y1,Z1) 5. What I would like to do is to check are any of points from the cloud are in this box. What's more to make it work faster I would like to do it while I'm creating the lists ;-) I made it this way (by invertinf the MODELVIEW_MATRIX), but it works only when the object is not rotated and it's weight is in 0,0,0. int i,j, ti, tj, idst, jdst; // inverting the matrices for ( ti = 0; ti < 4; ti++ ) { if ( ti < i ) idst = ti; else if ( ti > i ) idst = ti-1; for ( tj = 0; tj < 4; tj++ ) { if ( tj < j ) jdst = tj; else if ( tj > j ) jdst = tj-1; if ( ti != i && tj != j ) mb[idst*3 + jdst] = mr[ti*4 + tj ]; } } // counting the new points selX0 = ((mb[0]*selX0)+(mb[4]*selX0)+(mb[8]*selX0)+(mb[12]*selX0)); selY0 = ((mb[1]*selY0)+(mb[5]*selY0)+(mb[9]*selY0)+(mb[13]*selY0)); selZ0 = ((mb[2]*selZ0)+(mb[6]*selZ0)+(mb[10]*selZ0)+(mb[14]*selZ0)); selX1 = ((mb[0]*selX1)+(mb[4]*selX1)+(mb[8]*selX1)+(mb[12]*selX1)); selY1 = ((mb[1]*selY1)+(mb[5]*selY1)+(mb[9]*selY1)+(mb[13]*selY1)); selZ1 = ((mb[2]*selZ1)+(mb[6]*selZ1)+(mb[10]*selZ1)+(mb[14]*selZ1)); // after that I'm just checking is the point from the cloud between those points. // I'm using PROJECTION MATRIX only in the beginning or while window changes. Any ideas how can I make it work? Jacek [Edited by - vraim on November 6, 2006 11:58:18 AM]

#### Share this post

##### Share on other sites
Advertisement
Do not cross post.

#### Share this post

##### Share on other sites

This topic is 4270 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

This topic is now closed to further replies.

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
24
2. 2
3. 3
JoeJ
18
4. 4
5. 5
• Advertisement

• 38
• 23
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631708
• Total Posts
3001837
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!