Shapes

Shapes

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

Demo:
Source:

Methods

<static>

Computes a 2D circle about the origin.

Parameters:
Name Type Argument Default Description
radius Number <optional>
1.0 The radius of the circle
granularity Number <optional>
Cesium.RADIANS_PER_DEGREE*2 The radius of the circle
Returns:
The set of points that form the ellipse's boundary.
Example
var circle = Cesium.Shapes.compute2DCircle(100000.0);

<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 Cesium.Polyline();
polyline.setPositions(Cesium.Shapes.computeCircleBoundary(
  ellipsoid, ellipsoid.cartographicToCartesian(
    Cesium.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.
rotation 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:
Returns:
The set of points that form the ellipse's boundary.
Example
// Create a filled ellipse.
var polygon = new Cesium.Polygon();
polygon.setPositions(Cesium.Shapes.computeEllipseBoundary(
  ellipsoid, ellipsoid.cartographicToCartesian(
     Cesium.Cartographic.fromDegrees(-75.59777, 40.03883)), 500000.0, 300000.0, Cesium.Math.toRadians(60)));
See: