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)

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

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

Gets a value that indicates whether this polyline is closed. The polyline is considered to be closed if its start is identical to its endpoint.
Type:
  • bool

isValid :bool

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

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

segmentCount :int

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

Methods

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

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) createInscribedPolygon(circle, sideCount) → {Polyline}

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}

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

add(x, y, z)

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

clear()

Overrides:
...

closesPoint()

...

closestParameter(testPoint) → {double}

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()

Overrides:
...

insert()

Overrides:
...

isClosedWithinTolerance(tolerance) → {bool}

Determines whether the polyline is closed, provided a tolerance value.
Parameters:
Name Type Description
tolerance double If the distance between the start and end point of the polyline is less than tolerance, the polyline is considered to be closed.
Returns:
true if the polyline is closed to within tolerance, false otherwise.
Type
bool

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

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()

Overrides:
...

set()

Overrides:
...

setAllX()

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

setAllY()

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

setAllZ()

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

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

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}

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

toPolylineCurve() → {PolylineCurve}

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

transform(xform)

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