PolylinePipeline

PolylinePipeline

Methods

<static>

Removes adjacent duplicate positions in an array of positions.

Parameters:
Name Type Description
positions Array The array of {Cartesian3} positions.
Returns:
Array A new array of positions with no adjacent duplicate positions. Positions are shallow copied.
Example
// Returns [(1.0, 1.0, 1.0), (2.0, 2.0, 2.0)]
var positions = [
    new Cesium.Cartesian3(1.0, 1.0, 1.0),
    new Cesium.Cartesian3(1.0, 1.0, 1.0),
    new Cesium.Cartesian3(2.0, 2.0, 2.0)];
var nonDuplicatePositions = Cesium.PolylinePipeline.removeDuplicates(positions);

<static>

Raises the positions to the given height.

Parameters:
Name Type Argument Default Description
positions Array The array of type {Number} representing positions.
height Number | Array A number or array of numbers representing the heights of each position.
ellipsoid Ellipsoid <optional>
Ellipsoid.WGS84 The ellipsoid on which the positions lie.
result Array <optional>
An array to place the resultant positions in.
Throws:
Returns:
Array The array of positions scaled to height.
Example
var p1 = ellipsoid.cartographicToCartesian(Cartographic.fromDegrees(-105.0, 40.0));
var p2 = ellipsoid.cartographicToCartesian(Cartographic.fromDegrees(-100.0, 38.0));
var positions = [p1.x, p1.y, p1.z, p2.x, p2.y, p2.z];
var heights = [1000, 1000, 2000, 2000];

var raisedPositions = Cesium.PolylinePipeline.scaleToGeodeticHeight(positions, heights);

<static>

Subdivides polyline and raises all points to the ellipsoid surface

Parameters:
Name Type Argument Default Description
positions Array The array of positions of type {Cartesian3}.
granularity Number <optional>
CesiumMath.RADIANS_PER_DEGREE The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
ellipsoid Ellipsoid <optional>
Ellipsoid.WGS84 The ellipsoid on which the positions lie.
Returns:
Array A new array of positions of type {Number} that have been subdivided and raised to the surface of the ellipsoid.
Example
var positions = ellipsoid.cartographicArrayToCartesianArray([
     Cesium.Cartographic.fromDegrees(-105.0, 40.0),
     Cesium.Cartographic.fromDegrees(-100.0, 38.0),
     Cesium.Cartographic.fromDegrees(-105.0, 35.0),
     Cesium.Cartographic.fromDegrees(-100.0, 32.0)
]));
var surfacePositions = Cesium.PolylinePipeline.scaleToSurface(positions);

<static>

Breaks a Polyline into segments such that it does not cross the ±180 degree meridian of an ellipsoid.

Parameters:
Name Type Argument Default Description
positions Array The polyline's Cartesian positions.
modelMatrix Matrix4 <optional>
Matrix4.IDENTITY The polyline's model matrix. Assumed to be an affine transformation matrix, where the upper left 3x3 elements are a rotation matrix, and the upper three elements in the fourth column are the translation. The bottom row is assumed to be [0, 0, 0, 1]. The matrix is not verified to be in the proper form.
Returns:
Object An object with a positions property that is an array of positions and a segments property.
Example
var polylines = new Cesium.PolylineCollection();
var polyline = polylines.add(...);
var positions = polyline.positions;
var modelMatrix = polylines.modelMatrix;
var segments = Cesium.PolylinePipeline.wrapLongitude(positions, modelMatrix);
See: