Sign in to follow this  

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

This topic is 3404 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

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 this post


Link to post
Share on other sites
Quote:
Original post by kashyap
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
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 this post


Link to post
Share on other sites
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 this post


Link to post
Share on other sites
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 this post


Link to post
Share on other sites
Quote:
Original post by jyk

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?


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 this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3404 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this