Reg: Code which converts the coordinates into a new Coordinate System

Recommended Posts

kashyap    122
hello i am having a data set (a text file) which contains the x,y,z coordinates of a terrain. now i need to convert these coordinates into the global coordinate system. is there any c or c++ code which will help me do this. given the dip and colatitude angles. this is a part of a meshing routine that i am trying to develop. Thanks & Regards kashyap

Share on other sites
jyk    2094
Quote:
 Original post by kashyaphelloi am having a data set (a text file) which contains the x,y,z coordinates of a terrain. now i need to convert these coordinates into the global coordinate system. is there any c or c++ code which will help me do this. given the dip and colatitude angles. this is a part of a meshing routine that i am trying to develop. Thanks & Regardskashyap
I Googled the term, but I'm still not quite sure what the 'dip' in 'dip and colatitude' represents.

However, I imagine that, like spherical angles or Euler angles, dip and colatitude can be used to uniquely define an orientation. If so, the problem should be easy to solve: simple create a transform matrix using your 'dip' and 'colatitude' values, and then apply this transform to each vertex in the data set (as a pre-processing step, on load, or when you render the data - whichever is most appropriate).

Share on other sites
kashyap    122
hey hi,

imagine that you have to rotate a two dimensional coordinate axis for which you need to give in a angle so in the three dimensional case you need to give in two angles to establish the relation.

so that is the meaning of the two angles that i have mentioned there.

ya we can establish the matrix and get the work done. i was just wondering if there was preexsisting code for that.

Thanks & Regards
kashyap

Share on other sites
jyk    2094
Quote:
 i was just wondering if there was preexsisting code for that.
Well, sure - there's all kinds of math code floating around online.

Based on what you've posted, it sounds like you need a basic math library with vector and matrix classes (well, at least a vector class). You would then build a direction vector using what I gather are basically spherical coordinates (the dip and colatitude), build an orthonormal basis from this direction vector and (presumably) a fixed up vector, and then use this basis to transform the input geometry.

If that doesn't answer your question, perhaps you could provide some more detail. Do you already have a math library? Do you have enough of a grounding in trig and linear algebra to write the necessary functions yourself? Are you just looking for some references on the subject?

Share on other sites
kashyap    122
Quote:
 Original post by jykBased on what you've posted, it sounds like you need a basic math library with vector and matrix classes (well, at least a vector class). You would then build a direction vector using what I gather are basically spherical coordinates (the dip and colatitude), build an orthonormal basis from this direction vector and (presumably) a fixed up vector, and then use this basis to transform the input geometry.If that doesn't answer your question, perhaps you could provide some more detail. Do you already have a math library? Do you have enough of a grounding in trig and linear algebra to write the necessary functions yourself? Are you just looking for some references on the subject?

hello

Yes thats absolutely what i am trying to do. However i dont have a basic math library. Although i have a understanding of what i need to do mathematically i doubt if i could code them.

I have to plug this part into the main program which works on a meshing algorithm. References on the subject should be of help.

Thanks a ton for the information. It has been helping me a lot.

Share on other sites
jyk    2094
Quote:
 Yes thats absolutely what i am trying to do. However i dont have a basic math library. Although i have a understanding of what i need to do mathematically i doubt if i could code them.I have to plug this part into the main program which works on a meshing algorithm. References on the subject should be of help.
If you want to code it yourself, look online for references on spherical coordinates, Euler angles, and matrix transforms. There are also plenty of free math libraries available online (although you'll still need to understand a bit of the math behind what you're trying to do in order to use them effectively).

Unfortunately, I can't be much more specific than that (basically because I'm still not sure how 'dip' and 'colatitude' work). Post back though if you have questions or need more information.