#how can I rotate these coordinates to North South?

1 messages · Page 1 of 1 (latest)

red pike
#

I have two sets of coordinates in cartesian format which is like x,y,z from the center of the earth. the The first point is a base station which never moves, and the second is a rover which moves.

I want to get coordinates of the rover on a relative plane from the base station which I achieved doing the following:

passing the base station point to this function

    public static List<Double> getTransformAngles(Point3d pointA) {
        double rotationZ = Math.atan2(pointA.getY(), pointA.getX());
        double pow = Math.pow(pointA.getX(), 2) + Math.pow(pointA.getY(), 2);
        double rotationY = Math.atan2(Math.sqrt(pow), pointA.getZ());

        return List.of(-rotationZ, -rotationY);
    }```

then I rotate the rover point by the rotations and do the same with the base station then subtract the two.

this WORKS but the I want the X axis to be N and S. any idea what to rotate it by to make it do that?
zealous wedgeBOT
#
  1. Wait patiently for a helper to come along.
  2. Once someone helps you, say thank you and close the thread with:
+close
  1. Feel free to nominate the person for helper of the week in #helper-nominations
  2. Do not ping the mods, unless someone is breaking the rules.
  3. If you're happy with the help you got here, and the server overall, you can contribute financially as well:
proper lantern
red pike
#

yeah but in the end I just have a 2d plane which assumes the earth is flat

#

like im working on a super small scale so 2d is actually easier

proper lantern
#

Ohh, flatland, ok. Though, the coordinates won't be from the center of the sphere (as there is none), but from an arbitrary point.
As for the code, can't really help with that. My coding knowledge is quite limited. I recommend looking into rotation matrices in 3D, though.

red pike
#

code wise is fine

#

just the math

#

here is visually what I mean

#

starting position is 10 20 0

#

first rotation is -1.1071487177940904 rad on the Z

#

which aligns it on the x

proper lantern
#

Well, no need for so many decimals 😅

red pike
#

im just copy and pasting

proper lantern
#

Oh, ok.

red pike
#

next rotation is -1.5707963267948966 rad on the y

#

so now it's 0, 0, y height irrelevant

#

this would be the base station

#

so imagine another point doing the same rotations but from a slightly different starting point

#

well it would mean that the relative positon between the two points is on the plane of the base station

#

make sense?

proper lantern
#

Well, suppose you have a point r0 around which you rotate, and let M be the rotation matrix. Then the result will be:
r' = r0 + M(r - r0)

red pike
#

so here is where im asking for help

#

i already know my math works and does what I want it to do

#

but the relative plane isn't north south

red pike
#

or really so the axis aligns with an axis of the earth which is how we started