ClippingPolygon

A geodesic polygon to be used with ClippingPlaneCollection for selectively hiding regions in a model, a 3D tileset, or the globe.

const positions = Cartesian3.fromRadiansArray([
-1.3194369277314022,
0.6988062530900625,
-1.31941,
0.69879,
-1.3193955980204217,
0.6988091578771254,
-1.3193931220959367,
0.698743632490865,
-1.3194358224045408,
0.6987471965556998,
]);

const polygon = new ClippingPolygon({
positions: positions
});
// A clipping polygon with two holes. Regions inside the holes are not clipped.
const outerRing = Cartesian3.fromDegreesArray([
-100.0, 40.0,
-90.0, 40.0,
-90.0, 50.0,
-100.0, 50.0,
]);

const firstHole = Cartesian3.fromDegreesArray([
-98.0, 42.0,
-96.0, 42.0,
-96.0, 44.0,
-98.0, 44.0,
]);

const secondHole = Cartesian3.fromDegreesArray([
-94.0, 46.0,
-92.0, 46.0,
-92.0, 48.0,
-94.0, 48.0,
]);

const polygonWithHoles = new ClippingPolygon({
positions: outerRing,
holes: [firstHole, secondHole],
});

See also

Constructors

Link copied to clipboard

Types

Link copied to clipboard
external object Companion
Link copied to clipboard
external interface ConstructorOptions

Properties

Link copied to clipboard
external val ellipsoid: Ellipsoid

Returns the ellipsoid used to project the polygon onto surfaces when clipping.

Link copied to clipboard

Returns the interior rings (holes) of the polygon, each a list of positions.

Link copied to clipboard
external val length: Int

Returns the total number of positions in the polygon, including any holes.

Link copied to clipboard

Returns the outer ring of positions. A ClippingPolygon's geometry is immutable; the returned array and its coordinates are frozen.

Link copied to clipboard
external val rectangle: Rectangle

Returns the cartographic rectangle enclosing the polygon, computed once on construction. Since a ClippingPolygon's geometry is immutable, this rectangle never changes.

Functions

Link copied to clipboard
external fun computeRectangle(result: Rectangle? = definedExternally): Rectangle

Computes a cartographic rectangle which encloses the polygon defined by the list of positions, including cases over the international date line and the poles.