ClippingPolygon

new Ditap.ClippingPolygon(options)

A geodesic polygon to be used with ClippingPlaneCollection for selectively hiding regions in a model, a 3D tileset, or the globe.
Name Type Description
options object Object with the following properties:
Name Type Default Description
positions Array.<Cartesian3> A list of three or more Cartesian coordinates defining the outer ring of the clipping polygon.
holes Array.<Array.<Cartesian3>> optional An array of interior rings (holes), each a list of three or more Cartesian coordinates. Regions inside a hole are excluded from the polygon.
ellipsoid Ellipsoid Ellipsoid.default optional
Examples:
const positions = Ditap.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 Ditap.ClippingPolygon({
    positions: positions
});
// A clipping polygon with two holes. Regions inside the holes are not clipped.
const outerRing = Ditap.Cartesian3.fromDegreesArray([
    -100.0, 40.0,
    -90.0, 40.0,
    -90.0, 50.0,
    -100.0, 50.0,
]);

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

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

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

Members

readonly ellipsoid : Ellipsoid

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

readonly holes : Array.<Array.<Cartesian3>>

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

readonly length : number

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

readonly positions : Array.<Cartesian3>

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

readonly rectangle : Rectangle

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

Methods

static Ditap.ClippingPolygon.clone(polygon, result) → ClippingPolygon

Clones the ClippingPolygon without setting its ownership.
Name Type Description
polygon ClippingPolygon The ClippingPolygon to be cloned
result ClippingPolygon optional The object on which to store the cloned parameters.
Returns:
a clone of the input ClippingPolygon

static Ditap.ClippingPolygon.equals(left, right) → boolean

Compares the provided ClippingPolygons and returns true if they are equal, false otherwise.
Name Type Description
left ClippingPolygon The first polygon.
right ClippingPolygon The second polygon.
Returns:
true if left and right are equal, false otherwise.

deprecated computeRectangle(result) → 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.
Name Type Description
result Rectangle optional An object in which to store the result.
Returns:
The result rectangle

Deprecated: This function is deprecated and will be removed in CesiumJS 1.147. Use ClippingPolygon#rectangle instead.