Shapes
Functions to compute the boundary positions for shapes, such as circles, drawn on the ellipsoid.
Demo:
Source:
Methods
-
<static> compute2DCircle
-
Computes a 2D circle about the origin.
Parameters:
Name Type Argument Default Description radiusNumber <optional>
1.0 The radius of the circle granularityNumber <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> computeCircleBoundary
-
Computes boundary points for a circle on the ellipsoid.
Thegranularitydetermines 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 ellipsoidEllipsoid The ellipsoid the circle will be on. centerCartesian3 The circle's center point in the fixed frame. radiusNumber The radius in meters. granularityNumber <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 Cesium.Polyline(); polyline.setPositions(Cesium.Shapes.computeCircleBoundary( ellipsoid, ellipsoid.cartographicToCartesian( Cesium.Cartographic.fromDegrees(-75.59777, 40.03883, 0.0)), 100000.0)); -
-
<static> computeEllipseBoundary
-
Computes boundary points for an ellipse on the ellipsoid.
Thegranularitydetermines 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 ellipsoidEllipsoid The ellipsoid the ellipse will be on. centerCartesian3 The ellipse's center point in the fixed frame. semiMajorAxisNumber The length of the ellipse's semi-major axis in meters. semiMinorAxisNumber The length of the ellipse's semi-minor axis in meters. rotationNumber <optional>
The angle from north (clockwise) in radians. The default is zero. granularityNumber <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 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))); -
