PolyLine

PolyLine

A polygonal line

Constructor

new PolyLine(vertsopt, closedopt)

Parameters:
Name Type Attributes Default Description
verts Array.<number> <optional>

The vertices data array

closed boolean <optional>
false

True if its ends should be connected

Methods

(static) fromCubicBezier(vertsopt, nSegmentsopt, startFractionopt) → {PolyLine}

Creates a polyLine that approximates a given cubic Bezier curve

Parameters:
Name Type Attributes Default Description
verts Array.<number> <optional>

The Bezier curve control vertices. This array must contain exactly 12 elements (4 control points with 3 coordinates each)

nSegments number <optional>
16

The number of segments (higher values result in smoother curves)

startFraction number <optional>

(static) fromCubicSpline(vertsopt, nSegmentsopt, closedopt) → {PolyLine}

Creates a polyLine that approximates a given cubic spline

Parameters:
Name Type Attributes Default Description
verts Array.<number> <optional>

The spline control vertices. This array must contain exactly 3 * number_of_control_points (+ 1 if the spline is open) elements

nSegments number <optional>
16

The number of segments for each Bezier curve that forms the spline (higher values result in smoother curves)

closed boolean <optional>
false

True if the spline should be closed or not

(static) getVertsFromPoints(points) → {Array.<number>}

A convenience function to create an array of vertices from an array of control points used to define a spline

Parameters:
Name Type Description
points Array.<Vector3> | Vector3

The control points for the spline

concat(that, closedopt) → {PolyLine}

Returns a new polyLine as a result of concatenating the 2 polyLines

Parameters:
Name Type Attributes Description
that PolyLine

The other operand

closed boolean <optional>

True if the resulting polyLine should be closed

lathe(nSegmentsopt) → {Surface}

Builds a surface as a result of rotating this polyLine around the Y axis

Parameters:
Name Type Attributes Default Description
nSegments number <optional>
8

The number of segments for the resulting surface

mul(rhs) → {Surface}

Builds a surface as a result of multiplying 2 polyLines

Parameters:
Name Type Description
rhs PolyLine

The second operand

pipe(polyLine, optionsopt) → {Surface}

Extrudes and rotates a PolyLine along another PolyLine.

Parameters:
Name Type Attributes Description
polyLine PolyLine

The PolyLine to extrude; should be bidimensional and defined on the XY plane.

options Object <optional>
Properties
Name Type Attributes Description
scale function <optional>

Takes values between 0 and 1; the returned value is used to scale the extruded PolyLine

twist function <optional>

Takes values between 0 and 1; the returned value is used to twist the extruded PolyLine along the tangent of the extruding PolyLine. The twist value is expressed in radians.

rebuild() → {PolyLine}

Builds or rebuilds the mesh data