Shapes
Functions to compute the boundary positions for shapes, such as circles, drawn on the ellipsoid.
Methods
-
<static> compute2DCircle
-
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 = Shapes.compute2DCircle(100000.0);
-
<static> computeCircleBoundary
-
Computes boundary points for a circle on the ellipsoid.
Thegranularity
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:
-
DeveloperError : ellipsoid, center, and radius are required.
-
DeveloperError : radius must be greater than zero.
-
DeveloperError : granularity must be greater than zero.
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));
-
-
<static> computeEllipseBoundary
-
Computes boundary points for an ellipse on the ellipsoid.
Thegranularity
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:
-
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)));
-