Skip to content

Latest commit

 

History

History
453 lines (175 loc) · 9.5 KB

File metadata and controls

453 lines (175 loc) · 9.5 KB

PathList

Summary

Multiple disconnected path segments

Instance Properties

NameReturn TypeDescription
countnumber
Read-only
Gets the number of paths in the PathList
pointCountnumber
Read-only
Gets the number of points in all paths in the PathList

Class Methods

PathList:New()

Creates a new empty PathList

Returns: PathList

Example

PathList:New()

PathList:New(pathList)

Creates a new PathList from a list of Paths

Returns: PathList

Parameters:

NameTypeDefaultDescription
pathListPath[]A list of Paths .

Example

PathList:New(pathList)

PathList:FromText(text)

Creates a new PathList from a text

Returns: PathList

Parameters:

NameTypeDefaultDescription
textstringInput text to generate a path.

Example

PathList.FromText('example')

Instance Methods

pathList:Draw()

Draws this PathList using current settings

Returns: nil

Example

myPaths:Draw()

pathList:Insert(path)

Inserts a path at the end of the PathList

Returns: nil

Parameters:

NameTypeDefaultDescription
pathPathThe path to be inserted.

Example

myPaths:Insert(myPath)

pathList:Insert(path, index)

Inserts a path at the specified index of the PathList

Returns: nil

Parameters:

NameTypeDefaultDescription
pathPathThe path to be inserted
indexnumberInserts the new path at this position in the list of paths

Example

myPaths:Insert(myPath, 3)

pathList:InsertPoint(transform)

Inserts a point at the end of the last path in the PathList

Returns: nil

Parameters:

NameTypeDefaultDescription
transformTransformThe point to be inserted

Example

myPaths:InsertPoint(myTransform)

pathList:InsertPoint(transform, pathIndex, pointIndex)

Inserts a point at the specified index of the specified path

Returns: nil

Parameters:

NameTypeDefaultDescription
transformTransformThe point to be inserted
pathIndexnumberIndex of the path to add the point to
pointIndexnumberInserts the point at this index in the list of points

Example

myPaths:InsertPoint(myTransform, 3, 0)

pathList:TransformBy(transform)

Transforms the whole set of paths

Returns: nil

Parameters:

NameTypeDefaultDescription
transformTransformA Transform specifying the translation, rotation and scale to apply

Example

myPaths:TransformBy(myTransform)

pathList:TranslateBy(amount)

Translates the whole set of paths by a given amount

Returns: nil

Parameters:

NameTypeDefaultDescription
amountVector3The amount to move the paths by

Example

myPaths:TranslateBy(Vector3.up:Multiply(4))

pathList:RotateBy(rotation)

Rotates the whole set of paths by a specified amount

Returns: nil

Parameters:

NameTypeDefaultDescription
rotationRotationThe amount to rotate the paths by

Example

myPaths:RotateBy(Rotation.anticlockwise)

pathList:ScaleBy(scale)

Scales the whole set of paths by a specified factor

Returns: nil

Parameters:

NameTypeDefaultDescription
scaleVector3The amount to scale the paths by

Example

myPaths:ScaleBy(vector3)

pathList:ScaleBy(scale)

Scales the whole set of paths by a specified factor

Returns: nil

Parameters:

NameTypeDefaultDescription
scalenumberThe amount to scale the paths by

Example

myPaths:ScaleBy(float)

pathList:Center()

Offsets all points on the path so that their common center is at the origin

Returns: nil

Example

myPaths:Center()

pathList:Normalize(size)

Scales the whole PathList to fit inside a cube of given size at the origin

Returns: nil

Parameters:

NameTypeDefaultDescription
sizenumber1The size of the cube to fit inside

Example

myPaths:Normalize(1.5)

pathList:SampleByDistance(spacing)

Resamples all paths with a specified spacing between points

Returns: nil (The new PathList)

Parameters:

NameTypeDefaultDescription
spacingnumberThe distance between each new point

Example

myPaths:SampleByDistance(0.2)

pathList:SampleByCount(count)

Resamples each path evenly into a specified number of points

Returns: nil (The new PathList)

Parameters:

NameTypeDefaultDescription
countnumberNumber of points in the new path

Example

myPaths:SampleByCount(4)

pathList:SubdivideSegments(parts)

For each path in the list subdivide it's path segment into the specified number of parts

Returns: nil (The new PathList)

Parameters:

NameTypeDefaultDescription
partsnumberNumber of parts to subdivide each path segment into

Example

myPaths:SubdivideSegments(4)

pathList:Join()

Joins all the paths in order connecting each end to the following start

Returns: Path (A single path)

Example

myPaths:Join()

pathList:Longest()

Returns the longest path in the PathList

Returns: Path (The path with the most control points)

Example

path = myPaths:Longest()