Functions
Methods
Metamethods
Fields

Functions

Path.Path(points)

Create a new Path

Parameters

points: An optional table containing Points.

Returns

A new Path table.

Methods

Path:log()

Print a representation of the Path, including all child Points.

Path:draw_with(pen)

Set the Pen to draw the path with.

If this is the first time a Pen has been set for the Path the Path will also be added to the Paper the Pen is attached to.

Parameters

pen: The Pen to draw the Path with

Returns

Returns self.

Path:get_segments()

Get a table of Path segments.

Each segment is a table containing the start and end Points for the segment.

Returns

A table of segments.

Path:get_bounds()

Get the bounding box for the Path Provides values for bounding box width, height, top, bottom, left and right.

As well as Points for top_left, top_center, top_right, middle_left, center, middle_right, bottom_left, bottom_center, and bottom_right.

Returns

A table of bounding box values and Points

Path:open()

Open the Path.

Returns

Returns self.

Path:close()

Close the Path.

Returns

Returns self

Path:add_points(points, index)

Add points to a Path Optionally supply an index to add points to a specific place in the Path.

Parameters

points: A point or a table of Points.

index: An optional index to position the Points.

Returns

Returns self.

Path:remove_points(number_of_points, index)

Remove a number of points from the Path.

optionally supply and index to remove points from a specific position in the Path.

Parameters

number_of_points: The number of the Points to remove.

index: An optional index remove the Points from.

Returns

Returns self.

Path:move(x, y)

Move a Path along X and Y.

Parameters

x: The X vgalue to move the Path by.

y: The Y value to move the Path by.

Returns

Returns self.

Path:move_direction(direction, length)

Move a Path in a direction by length

Parameters

direction: Angle to move the Path in.

length: The distance to move along.

Returns

Returns self.

Path:rotate(angle, origin)

Rotate the Point clockwise around an origin Point in degrees.

If no origin Point is supplied then the center of the Paths bounding box will be used.

Parameters

angle: The angle to rotate the Path by.

origin: An optional Point to rotate around.

Returns

Returns self.

Path:scale(factor, origin)

Scale the Path by a factor from an optional Point

Parameters

factor: The Factor to scale by

origin: An optional Point to scale from.

Path:get_length()

Get the total length of the Path.

Returns

Path length as number.

Path:point_at_distance(distance)

Get a Point at a specified distance along the Path

Parameters

distance: Where along the Path to return the Point from.

Returns

A new Point.

Path:clone()

Return an identical copy of a Path.

Does not carry over pen information.

Returns

A new Path

Path:Regular_polygon(center, sides, radius)

Return a regular polygon Path.

Parameters

center: A point for the center of the polygon.

sides: The number of sides for the polygon.

radius: The radius for the polygon

Returns

A new Path

Metamethods

path:__tostring()

Get a representation of the Path as a string.

Returns

A string representation of the Path.

path:__eq(path_2)

Check if Path is equal to a second Path.

Parameters

path_2: A second Path.

Returns

Boolean

Fields

Path.segments

Get a table of Path segments.

Each segment is a table containing the start and end Points for the segment.

Path.bounds

Get the bounding box for the Path Provides values for bounding box width, height, top, bottom, left and right.

As well as Points for top_left, top_center, top_right, middle_left, center, middle_right, bottom_left, bottom_center, and bottom_right.

Path.length

Get the total length of the Path.