PolylinePipeline

PolylinePipeline

Methods

<static>

Removes adjacent duplicate positions in an array of positions.

Parameters:
Name Type Description
positions Array The array of positions. Each element is usually a {@see Cartesian3}, but all that is required is that the object have an equals function.
Throws:
DeveloperError : positions is required.
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 Cartesian3(1.0, 1.0, 1.0),
    new Cartesian3(1.0, 1.0, 1.0),
    new Cartesian3(2.0, 2.0, 2.0)];
var nonDuplicatePositions = PolylinePipeline.removeDuplicates(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 PolylineCollection();
var polyline = polylines.add(...);
var positions = polyline.getPositions();
var modelMatrix = polylines.modelMatrix;
var segments = PolylinePipeline.wrapLongitude(positions, modelMatrix);
See: