Jump to content
  • Advertisement
Sign in to follow this  
justujo

How to define a coordinate system with origin as a point of model !

This topic is 3809 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 everybody, After discussion a problem on mine on another thread,I think I better rephrase my problem. Given: A 3D model M and three point ids A,B,C of three points in the model M.The coordinates of all points in M are defined in global coordinate system. Problem: I want to define another coordinate system having its origin on point A.Then I need to express the coordinates of all points in M in terms of new coordinate system.Motivation is to find a representation of the geometry of points for a given model which is rotation invariant (doesnt change with rotation). My effort: I tried to define an orthogonal basis comprising vectors AB,X1 and X2 where X1 and X2 are orthogonal to each other and AB.Then I used standard change of basis technique by solving a linear system of equation as mentioned at http://www.gamedev.net/community/forums/topic.asp?topic_id=479364 The direction of axes of the new coordinate system seem to be ok but the origin of new coordinate system doesnt lie on A, rather it co-incides with the origin of global coordinate system,I guess. I need your thoughts on this issue please, This is driving me nuts now :( Best Regards, Justujo

Share this post


Link to post
Share on other sites
Advertisement
Yup, just like Apatriarca said. If you want a coordinate system that has the same orientation as the world origin (i.e. same up, right and forward vectors), just subtract A from each point.

For example:

A = (1,4,5)
B = (7,2,1)
C = (0 0 4)

Relative to A, points B and C are:

B' = (6,-2,-4)
C' = (-1,-4,-1)

Note that B - A = (7,2,1) - (1,4,5) = (6,-2,-4) = B'

So if you subtract A from each point, you get:

A' = (0,0,0)
B' = (6,-2,-4)
C' = (-1,-4,-1)

Share this post


Link to post
Share on other sites
In your system you are only considering the three orthonormal axis, but to define a coordinate frame in 3D you also need to consider the origin.
To change between coordinate frames the correct system is:
Lq+A = p

Share this post


Link to post
Share on other sites
Quote:
Original post by apatriarca
In your system you are only considering the three orthonormal axis, but to define a coordinate frame in 3D you also need to consider the origin.
To change between coordinate frames the correct system is:
Lq+A = p


Absolutely true. You guys are stars. Thanks ever so much for your help. I want to grab a cup of coffee and relax :)

One more thing please,

what is the best way to deal with the round off errors? After rotating the model, when I find the new coordinates, they slightly change at say 8th point of decimal due to round off errors in all the processing. That must be a standard problem in gameedev, I am sure. How do we deal with it normally?

Kindest Regards,

Justujo

Share this post


Link to post
Share on other sites
Quote:
Original post by apatriarca
In your system you are only considering the three orthonormal axis, but to define a coordinate frame in 3D you also need to consider the origin.
To change between coordinate frames the correct system is:
Lq+A = p


Absolutely true. You guys are stars. Thanks ever so much for your help. I want to grab a cup of coffee and relax :)

One more thing please,

what is the best way to deal with the round off errors? After rotating the model, when I find the new coordinates, they slightly change at say 8th point of decimal due to round off errors in all the processing. That must be a standard problem in gameedev, I am sure. How do we deal with it normally?

Kindest Regards,

Justujo

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!