PDA

View Full Version : Coordinate rotation (aka, a math question)



Keld Denar
2012-06-20, 07:40 PM
Ok, so I'm having issues with a problem. I have a model from a surveyor with coordinates on it. I also have a model from my firm with coordinates on it. Unfortunately, the coordinate systems don't line up. They are rotated by about 44.707 degrees clockwise from the horizontal axis from the surveyors data to our data. I got some coordinate points from the various models, which are at the same locations. All dimensions are in inches. Does anyone know how to come up with formulas to translate from a pair of our coordinates to the coordinates from the surveyor and back again? I've wrapped my head around this for the last 3 hours, and I'm so disoriented. Any pointers would be appreciated.

{table=head]Corner|N|E
NW|8,495,686.32|14,034,692.64
SE|8,491,127.64|14,041,473.12
SW|8,490,040.20|14,040,396.84[/table]

{table=head]Corner|N|E
NW|8,210|540
SE|184|2,070
SW|184|540[/table]

Nix Nihila
2012-06-20, 08:55 PM
I believe that these formulas should allow you to rotate a coordinate (x, y) counterclockwise through the origin, by an angle θ, to give you (x', y'):

x' = x cosθ − y sinθ
y' = x sinθ + y cosθ

So if you take (360 – 44.707)° as your angle, I think you'll have what you're looking for. (It would be ideal if someone would please confirm this. It's been a while since I've done this.)

Keld Denar
2012-06-20, 10:19 PM
Hmmm. Interesting. The problem I'm having is that the two coodinate systems don't have the same origin. As you can see, the origin of the first set is a few million inches away. The origin of the second set is meer thousands. How do I translate the origin and THEN rotate it about my angle?

Siosilvar
2012-06-20, 10:32 PM
Since the southwest corner is on the same spot for each, you should be able to make the southwest corner the origin for each - subtract its coordinates from the other points'.

At least, that sounds right to me.

factotum
2012-06-21, 01:22 AM
Hmmm. Interesting. The problem I'm having is that the two coodinate systems don't have the same origin. As you can see, the origin of the first set is a few million inches away. The origin of the second set is meer thousands. How do I translate the origin and THEN rotate it about my angle?

Translate first, then rotate--that will work just fine. Translation is just a matter of adding or subtracting appropriate values to your coordinates--you just need to figure out what the offset between the two origin points is!

Keld Denar
2012-06-21, 01:36 AM
I'm still not getting it to work. I figured out like, what the difference between the two origins are, then apply the rotation, but its not coming out to any of the other dimensions. The issue seems to be that you can't translate something along a dimension it isn't orthogonal to.

Hmmm, I wonder what would happen if I just took the x component of the difference between the two using the cosine of my angle and translated it like that...

Cespenar
2012-06-21, 03:20 AM
Unless I've messed up some calculations (and that's not a very small chance) there's something wrong with the data.

Setting up the SW point as the origin, there's indeed a 44.707 degree angle between the SE points as you have said, but the angle between the NW points are different altogether. 5.76 degrees, to be exact.

Was there a z-axis that you for some reason have omitted, perchance? :smalltongue:

Keld Denar
2012-06-21, 01:06 PM
Considering it is a topo map, it does have a Z axis, but it isn't rotating. Anyway,I figured it out. The two equations I needed were:

X' = (x-x0) cos(theta) + (y-y0) sin(theta)
Y' = (x-x0) sin(theta) + (y-y0) cos(theta)

and to go the other way (cause math goes both ways hehehe):

X' = x cos(theta) -y sin(theta) +x0
Y' = x sin(theta) +y cos(theta) +y0

My biggest issue was trying to calculate x0 and y0 using the points I had. I failed at that. Luckily, my drafter was able to get the coordinates graphically using the model. Once I had that, it was super easy.

Thanks all for the help, though. I got a conversion that matches the points down to a tenth of an inch or less which is close enough for government work.