Shape

@Serializable
class Shape(val contours: List<ShapeContour>) : ShapeProvider(source)

A simple interface for managing a List of ShapeContour.

Constructors

Link copied to clipboard
constructor(contours: List<ShapeContour>)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
operator fun Shape.contains(v: Vector2): Boolean

Returns true if given Vector2 is inside the Shape.

Link copied to clipboard

Applies a boolean difference operation between two Shapes.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun hole(index: Int): ShapeContour

The indexed hole of the shape.

Link copied to clipboard

Applies a boolean intersection operation between two Shapes.

Link copied to clipboard

Calculates a List of all points where the Shape and a Segment intersect.

Calculates a List of all points where two Shapes intersect.

Calculates a List of all points where the Shape and a ShapeContour intersect.

Link copied to clipboard
fun map(mapper: (ShapeContour) -> ShapeContour): Shape

Applies a map to the shape. Maps every contour.

Link copied to clipboard

Projects a point on the contours of a Shape

Link copied to clipboard
fun polygon(distanceTolerance: Double = 0.5): Shape
Link copied to clipboard
fun randomPoints(pointCount: Int, random: Random = Random.Default): List<Vector2>

Generates specified amount of random points that lie inside the Shape.

Link copied to clipboard
Link copied to clipboard
fun splitCompounds(winding: Winding = Winding.CLOCKWISE): List<Shape>

Splits an org.openrndr.shape.compound shape into separate shapes.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun transform(transform: Matrix44): Shape

Applies a linear transformation to the Shape.

Link copied to clipboard
fun Shape.union(other: Shape): Shape

Applies a boolean org.openrndr.shape.union operation between two Shapes.

Properties

Link copied to clipboard

Calculates approximate area for this shape (through triangulation).

Link copied to clipboard
Link copied to clipboard

Lists all ShapeContours with a closed topology.

Link copied to clipboard

Checks whether the Shape is org.openrndr.shape.compound or not.

Link copied to clipboard
Link copied to clipboard

Returns true if Shape contains no ShapeContours.

Link copied to clipboard

Returns true if Shape consists solely of ShapeContours, where each Segment is a line segment.

Link copied to clipboard

Lists all ShapeContours with an open topology.

Link copied to clipboard

The outline of the shape.

Link copied to clipboard
open override val shape: Shape

the provided shape

Link copied to clipboard
@Transient
val topology: ShapeTopology

Indicates the Shape topology.

Link copied to clipboard

Triangulates Shape into a List of Triangles.