Polyline

Polyline

Represents an ordered set of points connected by linear segments. Polylines are closed if start and end points coincide.

Constructor

new Polyline(initialCapacity)

Description:
  • Initializes a new empty polyline with an initial capacity.
Parameters:
Name Type Description
initialCapacity int Number of vertices this polyline can contain without resizing.

Extends

Members

boundingBox :BoundingBox

Description:
  • Even though this is a property, it is not a "fast" calculation. Every point is evaluated in order to get the bounding box of the list.
Overrides:
Even though this is a property, it is not a "fast" calculation. Every point is evaluated in order to get the bounding box of the list.
Type:

capacity

Overrides:

count

Overrides:

isClosed :bool

Description:
  • Test a polyline to see if it is closed.
Test a polyline to see if it is closed.
Type:
  • bool

isValid :bool

Description:
  • Gets a value that indicates whether this polyline is valid. Valid polylines have at least one segment, no Invalid points and no zero length segments.Closed polylines with only two segments are also not considered valid.
Gets a value that indicates whether this polyline is valid. Valid polylines have at least one segment, no Invalid points and no zero length segments.Closed polylines with only two segments are also not considered valid.
Type:
  • bool

length :double

Description:
  • Gets the total length of the polyline.
Gets the total length of the polyline.
Type:
  • double

segmentCount :int

Description:
  • Gets the number of segments for this polyline.
Gets the number of segments for this polyline.
Type:
  • int

Methods

add(x, y, z)

Description:
  • Adds a Point3d to the end of the list with given x,y,z coordinates.
Overrides:
Parameters:
Name Type Description
x double The X coordinate.
y double The Y coordinate.
z double The Z coordinate.

append()

Description:
  • ...
Overrides:

clear()

Description:
  • ...
Overrides:

closesPoint()

Description:
  • ...

closestParameter(testPoint) → {double}

Description:
  • Gets the parameter along the polyline which is closest to a test-point.
Parameters:
Name Type Description
testPoint Array.<x, y, z> Point to approximate.
Returns:
The parameter along the polyline closest to testPoint.
Type
double

get()

Description:
  • ...
Overrides:

getSegments() → {Array.<Line>}

Description:
  • Constructs an array of line segments that make up the entire polyline.
Returns:
An array of line segments or null if the polyline contains fewer than 2 points.
Type
Array.<Line>

insert()

Description:
  • ...
Overrides:

isClosedWithinTolerance(tolerance) → {bool}

Description:
  • Test a polyline to see if it is closed.
Parameters:
Name Type Description
tolerance double The tolerance.
Returns:
Returns true if polyline has 4 or more points, the distance between the start and end points is <= tolerance, and there is a point in the polyline whose distance from the start and end points is > tolerance.
Type
bool

pointAt(t) → {Array.<x, y, z>}

Description:
  • Gets the point on the polyline at the given parameter. The integer part of the parameter indicates the index of the segment.
Parameters:
Name Type Description
t double Polyline parameter.
Returns:
The point on the polyline at t.
Type
Array.<x, y, z>

removeAt()

Description:
  • ...
Overrides:

segmentAt(index) → {Line}

Description:
  • Gets the line segment at the given index.
Parameters:
Name Type Description
index int Index of segment to retrieve.
Returns:
Line segment at index or Line.Unset on failure.
Type
Line

set()

Description:
  • ...
Overrides:

setAllX()

Description:
  • Set all the X values for the points to a single value
Overrides:

setAllY()

Description:
  • Set all the Y values for the points to a single value
Overrides:

setAllZ()

Description:
  • Set all the Z values for the points to a single value
Overrides:

tangentAt(t) → {Array.<x, y, z>}

Description:
  • Gets the unit tangent vector along the polyline at the given parameter. The integer part of the parameter indicates the index of the segment.
Parameters:
Name Type Description
t double Polyline parameter.
Returns:
The tangent along the polyline at t.
Type
Array.<x, y, z>

toNurbsCurve() → {NurbsCurve}

Description:
  • Constructs a nurbs curve representation of this polyline.
Returns:
A Nurbs curve shaped like this polyline or null on failure.
Type
NurbsCurve

toPolylineCurve() → {PolylineCurve}

Description:
  • Constructs a polyline curve representation of this polyline.
Returns:
A curve shaped like this polyline or null on failure.
Type
PolylineCurve

transform(xform)

Description:
  • Applies a transform to all the points in the list.
Overrides:
Parameters:
Name Type Description
xform Transform Transform to apply.

(static) createCircumscribedPolygon(circle, sideCount) → {Polyline}

Description:
  • Create a regular polygon circumscribe about a circle. The midpoints of the polygon's edges will be tangent to the circle.
Parameters:
Name Type Description
circle Circle The circle.
sideCount int The number of sides
Returns:
A closed polyline if successful, null otherwise.
Type
Polyline

(static) createFromPoints()

Description:
  • ...

(static) createInscribedPolygon(circle, sideCount) → {Polyline}

Description:
  • Create a regular polygon inscribed in a circle. The vertices of the polygon will be on the circle.
Parameters:
Name Type Description
circle Circle The circle.
sideCount int The number of sides
Returns:
A closed polyline if successful, null otherwise.
Type
Polyline

(static) createStarPolygon(circle, radius, cornerCount) → {Polyline}

Description:
  • Create a regular star polygon. The star begins at circle.PointAt(0) and the vertices alternate between being on circle and begin on a concentric circle of other_radius.
Parameters:
Name Type Description
circle Circle The circle.
radius double The radius of other circle.
cornerCount int The number of corners on the circle. There will be 2*cornerCount sides and 2*cornerCount vertices.
Returns:
A closed polyline if successful, null otherwise.
Type
Polyline