Elevation Angle between Positions [closed]
Asked Answered
I

2

5

I'm using Java NASA WorldWind, and I have two objects with different elevations and positions.

How can I find the elevation angle between the objects taking into account the curvature of the earth?

This image illustrates (obviously not to scale) what I'm trying to do:

enter image description here

Object A is 50 feet above the ground, and Object B is 500 feet above the ground. How can I find Angle X, taking into account the curvature of the earth?

Ineludible answered 24/4, 2015 at 22:24 Comment(2)
What's the distance between objects A and B along the curve? The elevation angle will depend on the distance between them as well.Pater
I'm voting to close this question as off-topic because it is about math, not programming.Bezonian
P
6

Trigonometry saves the day! Please refer to this untidy diagram as I work through the answer:

enter image description here

The angle we want to find is α. We can easily find θ if we know the distance (along the curvature of the Earth) between the two points (or more accurately, the curved-line distance between the two points we get on the surface on the Earth, if we extend a line from each object down to the surface). If the distance is L, then θ is just L/R (see Arc Length) where R is the radius of the Earth.

Notice the values d1, d2, and d3. We can easily find α if we know d2 and d3, because (θ + α) is the inverse tangent of d2/d3. So how do we find these?

First we'll find d1. We know that the hypotenuse of the triangle with d1 and d3 is R + ha, which is just the radius of the Earth plus the elevation of object A. Hence we can find d1:

enter image description here

Similarly, for d3:

enter image description here

Now how do we find d2? We know that the total length of the base of the entire triangle is R + hb; essentially just the radius of the Earth plus the height of object B. We already know d1. So d2 is:

enter image description here

Now we are ready to find α:

enter image description here

So using this expression which is in terms of the heights of both objects and the radius of the Earth, you should be able to find α. There may be an even easier way to find α, but this is what I was able to come up with; it's been a while since I did any trigonometry! I think my math is correct, but let me know if you spot anything wrong.

Pater answered 25/4, 2015 at 1:58 Comment(3)
Many many thanks! This helped immensely -- my trig is obviously a lot more rusty than yours.Ineludible
I tried following this solution, but I got a bit stuck -- are we sure those are right triangles? I think you're assuming that the d3 line is perpendicular to the d1-d2 line, but it isn't necessarily. If I understand correctly, and the d3 line is from Object A to the ground below Object B.Hankhanke
@Hankhanke been a while since I looked at this, but I think I constructed it so that it is perpendicular. It's not an assumption.Pater
I
1

I took Vivin's answer and coded it into the WorldWind API. I think its working as I expect:

import gov.nasa.worldwind.BasicModel;
import gov.nasa.worldwind.WorldWindow;
import gov.nasa.worldwind.awt.WorldWindowGLCanvas;
import gov.nasa.worldwind.geom.Angle;
import gov.nasa.worldwind.geom.Position;

public class ElevationAngle {

    static WorldWindow ww = new WorldWindowGLCanvas();

    static {
        ww.setModel(new BasicModel());
    }

    public static void main(String[] args) {

        Position pos1 = new Position(Angle.fromDegrees(34.22389),
                Angle.fromDegrees(117.2458), 50 * 0.3048); //elevation in meters

        Position pos2 = new Position(Angle.fromDegrees(34.22389),
                Angle.fromDegrees(117.2440), 500 * 0.3048); //elevation in meters

        System.out.println(getElevationAngleDegrees(pos1, pos2));
    }

    public static double getElevationAngleDegrees(Position pos1, Position pos2) {

        double R = ww.getModel().getGlobe().getRadiusAt(pos1);

        double L = Position.greatCircleDistance(pos1, pos2).getRadians() * R;

        double theta = L / R;

        double ha = pos1.getElevation();

        double hb = pos2.getAltitude();

        double d1 = (R + ha) * Math.cos(theta);

        double d3 = (R + ha) * Math.sin(theta);

        double d2 = R + hb - d1;

        double alpha = Math.atan(d2 / d3) - theta;

        return Math.toDegrees(alpha);

    }

}
Ineludible answered 25/4, 2015 at 17:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.