Calculate point from a start point heading and distance

I am having a hard time finding a means via your api to calculate an end point using a starting point a bearing and distance to calculate. Can you point me in the right direction, this is the only thing from a strict api sense preventing me from completely ridding myself of google earth extensions.

There’s nothing Cesium-specific about that - that’s just geometric algorithm calculation. Plenty of implementations out there - see the “Destination point given distance and bearing” item at for one.

What I was really hoping for was a way to define a Rectangle from a Center point, a width and height. I can ask for a Rectangle to give me its center point, but cannot define one by it. At any rate I understand haversine is not cesium specific, how exactly do I make sure I am using the appropriate radius for a given point in cesium?

Ah… if you want a Rectangle, what do you mean by “appropriate radius”?

Now, as for a rectangle based on center, width, and height… funny you should ask that. As it turns out, I wrote some Java code a few years back to do exactly that, with the rectangle oriented at an arbitrary angle, and going around the corners in either direction. I think I can share the appropriate snippet. All you do is calculate the center of one side, then you can work out the four corners from there:

// utility function to ensure angles are in 0…360
public static double modAngle360(double angle) {
double temp = (angle % 360.0) + 360.0;
double result = temp % 360.0;
return result;

public static List<LatLng> generateRectangle(LatLng center, double length, double width, double inboundAngle, boolean leftTurn) {
    double l2 = length / 2;
    double w2 = width / 2;

    double angle0 = modAngle360(inboundAngle + 180);
    double angle1 = modAngle360(inboundAngle - 90.0);
    double angle2 = modAngle360(angle1 + 180.0);

    if (!leftTurn) {
        // Swap our angles so that we go around in the opposite direction
        double temp = angle1;
        angle1 = angle2;
        angle2 = temp;

    LatLng rightMiddle = calcLatLonDeg(center, angle0, l2);

    LatLng p1 = calcLatLonDeg(rightMiddle, angle2, w2);
    LatLng p2 = calcLatLonDeg(p1, inboundAngle, length);
    LatLng p3 = calcLatLonDeg(p2, angle1, width);
    LatLng p4 = calcLatLonDeg(p1, angle1, width);

    // do useful stuff with the four corners


So, draw a half-length line from the center to the right, decide which way you’re turning from there, and walk around the rectangle.

There’s probably a better way to do it somewhere, but this has worked fine for my purposes.

This seemed simpler:

public Rectangle calculateRectangle(Cartographic cartographic, double width, double height) {

Cartographic north = Geodesic.destination(cartographic, 0, height / 2);
Cartographic south = Geodesic.destination(cartographic, Cesium.Math.PI, height / 2);
Cartographic east = Geodesic.destination(cartographic, Cesium.Math.PI_OVER_TWO, width / 2);
Cartographic west = Geodesic.destination(cartographic, Cesium.Math.THREE_PI_OVER_TWO, width / 2);
return Rectangle.fromDegrees(west.getLongitudeDegrees(), south.getLatitudeDegrees(), east.getLongitudeDegrees(), north.getLatitudeDegrees());


Like I said… it’s code that I wrote several years ago, as part of a more complicated function in a larger application, without having Cesium’s API available. But yeah, that looks like it’d work.