Building a triangle based on coordinates on a map

I am creating an application based on geolocation, and I am trying to understand how to implement my application when the user is faced with the direction of a given location (specific long / lat coordinate). I have a mathematical figure, I have a triangle to build.

// UPDATE

So, I realized that this is ...

Below is a method that takes a long / lat value and tries to calculate a triangle that finds a point 700 meters away, and one - left + right. Then he used them to build a triangle. It calculates the correct longitude, but the latitude ends somewhere off the coast of East Africa. (I'm in Ireland!).

public void drawtri(double currlng,double currlat, double bearing){

    bearing = (bearing < 0 ? -bearing : bearing);

    System.out.println("RUNNING THE DRAW TRIANGLE METHOD!!!!!");
    System.out.println("CURRENT LNG" + currlng);
    System.out.println("CURRENT LAT" + currlat);
    System.out.println("CURRENT BEARING" + bearing);

    //Find point X(x,y)
    double distance = 0.7; //700 meters.
    double R = 6371.0; //The radius of the earth.
    //Finding X y value.

    Math.toRadians(currlng);
    Math.toRadians(currlat);
    Math.toRadians(bearing);

    distance = distance/R;
    Global.Alat = Math.asin(Math.sin(currlat)*Math.cos(distance)+ 
            Math.cos(currlat)*Math.sin(distance)*Math.cos(bearing));
    System.out.println("CURRENT ALAT!!: " + Global.Alat);
    //Finding X x value.
    Global.Alng = currlng + Math.atan2(Math.sin(bearing)*Math.sin(distance)
            *Math.cos(currlat), Math.cos(distance)-Math.sin(currlat)*Math.sin(Global.Alat));
    Math.toDegrees(Global.Alat);
    Math.toDegrees(Global.Alng);


    //Co-ord of Point B(x,y)
    // Note: Lng = X axis, Lat = Y axis.
    Global.Blat = Global.Alat+ 00.007931;
    Global.Blng = Global.Alng;

    //Co-ord of Point C(x,y)
    Global.Clat = Global.Alat  - 00.007931;
    Global.Clng = Global.Alng;

    }

From debugging, I decided the problem was calculating the latitude made here.

 Global.Alat = Math.asin(Math.sin(currlat)*Math.cos(distance)+ 
        Math.cos(currlat)*Math.sin(distance)*Math.cos(bearing));

, , , . ..

http://www.movable-type.co.uk/scripts/latlong.html

, ...

Radians, .. ..

- , , 700 , ?

,

+3
3

, java, Radians, Trick Radians, , .

0

, javascript, -

currlat = Math.toRadians(currlat);

currlat .

0
source

Source: https://habr.com/ru/post/1748760/


All Articles