Shapes

Shapes

Functions to compute the boundary positions for shapes, such as circles, drawn on the ellipsoid.

Demo:
Source:

Methods

<static>

Computes boundary points for a circle on the ellipsoid.

The granularity determines the number of points in the boundary. A lower granularity results in more points and a more exact circle.

An outlined circle is rendered by passing the result of this function call to Polyline#setPositions. A filled circle is rendered by passing the result to Polygon#setPositions.

Parameters:
Name Type Argument Description
ellipsoid Ellipsoid The ellipsoid the circle will be on.
center Cartesian3 The circle's center point in the fixed frame.
radius Number The radius in meters.
granularity Number <optional>
The angular distance between points on the circle.
Throws:
Example
// Create a polyline of a circle
var polyline = new Polyline();
polyline.setPositions(Shapes.computeCircleBoundary(
  ellipsoid, ellipsoid.cartographicToCartesian(
    Cartographic.fromDegrees(-75.59777, 40.03883, 0.0)), 100000.0));
See:

<static>

Computes boundary points for an ellipse on the ellipsoid.

The granularity determines the number of points in the boundary. A lower granularity results in more points and a more exact circle.

An outlined ellipse is rendered by passing the result of this function call to Polyline#setPositions. A filled ellipse is rendered by passing the result to Polygon#setPositions.

Parameters:
Name Type Argument Description
ellipsoid Ellipsoid The ellipsoid the ellipse will be on.
center Cartesian3 The ellipse's center point in the fixed frame.
semiMajorAxis Number The length of the ellipse's semi-major axis in meters.
semiMinorAxis Number The length of the ellipse's semi-minor axis in meters.
bearing Number <optional>
The angle from north (clockwise) in radians. The default is zero.
granularity Number <optional>
The angular distance between points on the circle.
Throws:
  • DeveloperError : ellipsoid, center, semiMajorAxis, and semiMinorAxis are required.
  • DeveloperError : Semi-major and semi-minor axes must be greater than zero.
  • DeveloperError : granularity must be greater than zero.
Returns:
The set of points that form the ellipse's boundary.
Example
// Create a filled ellipse.
var polygon = new Polygon();
polygon.setPositions(Shapes.computeEllipseBoundary(
  ellipsoid, ellipsoid.cartographicToCartesian(
     Cartographic.fromDegrees(-75.59777, 40.03883)), 500000.0, 300000.0, Math.toRadians(60)));
See: