PShape

fun PShape(shapes: List<Shape>): PShape(source)

Combines a list of Shape objects into a single PShape object of type GROUP by adding each shape as a child.

Each Shape in the input list is converted to a PShape, and these are added as children to a parent PShape of type GROUP. This allows for easy grouping and management of multiple Shape objects while using the Processing library.

Return

a PShape object of type GROUP containing the provided shapes as children.

Parameters

shapes

the list of Shape objects to combine. Each shape is converted and added as a child to the resulting PShape object.


fun PShape(shape: Shape): PShape(source)

Converts a given Shape instance into a PShape object. If the shape contains a single contour, it is directly converted. Otherwise, the method constructs a complex PShape with paths and contours, mapping each segment type appropriately.

Return

a PShape object representing the input shape. The resulting PShape will contain vertices, contours, and paths corresponding to the geometry of the input.

Parameters

shape

the Shape instance to be converted into a PShape. The shape may consist of one or more contours, each containing multiple segments.


fun PShape(contour: ShapeContour): PShape(source)

Converts a given ShapeContour into a PShape object. The method translates contour segments (linear, quadratic, cubic) into corresponding vertices and shapes suitable for use with the Processing library.

Return

a PShape object representing the given ShapeContour.

Parameters

contour

the ShapeContour to convert into a PShape. It may consist of multiple segments of varying types and can be open or closed.