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

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

## 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 on other sites
You can translate every point by -A.

##### Share on other sites
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 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 on other sites
Quote:
 Original post by apatriarcaIn 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 on other sites
Quote:
 Original post by apatriarcaIn 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 on other sites
To keep errors from accumulating over time, save one 'clean' unrotated version of the model for reference, and do all rotations from this version.

1. 1
2. 2
Rutin
18
3. 3
khawk
15
4. 4
A4L
14
5. 5

• 10
• 13
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633745
• Total Posts
3013667
×