package com.base.track.model.entity;

public class GlobeMath {
    public static int POINT_LEFT = 0;
    public static int POINT_RIGHT = 1;

    public GlobeMath() {
    }

    public static Position computePositionFromPosition(Position pos, Angle heading, double width, int type) {
        Position posA = null;
        double globeRadius = 0.0D;
        double azimuth = 0.0D;
        LatLon ll = LatLon.ZERO;
        globeRadius = RadiansDic.queryradians(pos.getLatitude().getDegrees());
        double distance = Math.abs(width) / globeRadius;
        if (type == POINT_LEFT) {
            azimuth = heading.radians + 1.5707963267948966D;
        } else if (type == POINT_RIGHT) {
            azimuth = heading.radians - 1.5707963267948966D;
        }

        ll = LatLon.greatCircleEndPosition(pos, azimuth, distance);
        posA = new Position(ll, pos.getAltitude());
        return posA;
    }
}
