openrndr / org.openrndr.shape / Shape

# Shape

`class Shape` (source)

### Constructors

#### <init>

`Shape(contours: List<ShapeContour>)`

### Properties

#### area

calculate (approximate) area for this shape (through triangulation)

`val area: Double`

#### bounds

bounding box Rectangle

`val bounds: Rectangle`

#### closedContours

list the closed contours

`val closedContours: List<ShapeContour>`

#### compound

`val compound: Boolean`

#### contours

`val contours: List<ShapeContour>`

#### empty

`val empty: Boolean`

#### linear

indicates that the shape has only contours for which each segment is a line segment

`val linear: Boolean`

#### openContours

list the open contours

`val openContours: List<ShapeContour>`

#### outline

The outline of the shape

`val outline: ShapeContour`

#### topology

indication of shape topology

`val topology: ShapeTopology`

#### triangulation

calculate triangulation for this shape

`val triangulation: List<Triangle>`

### Functions

#### contains

`operator fun contains(v: Vector2): Boolean`

#### equals

`fun equals(other: Any?): Boolean`

#### hashCode

`fun hashCode(): Int`

#### hole

The indexed hole of the shape

`fun hole(index: Int): ShapeContour`

#### map

Apply a map to the shape. Maps every contour.

`fun map(mapper: (ShapeContour) -> ShapeContour): Shape`

#### polygon

`fun polygon(distanceTolerance: Double = 0.5): Shape`

#### randomPoints

generate random points that lie inside the shape

`fun randomPoints(pointCount: Int, random: Random = Random.Default): List<Vector2>`

#### splitCompounds

Splits a compound shape into separate shapes.

`fun splitCompounds(winding: Winding = Winding.CLOCKWISE): List<Shape>`

#### transform

Apply a tranform to the shape

`fun transform(transform: Matrix44): Shape`

### Companion Object Properties

#### EMPTY

an empty shape object, advised to use this instance whenever an empty shape is needed

`val EMPTY: Shape`

### Companion Object Functions

#### compound

`fun compound(shapes: List<Shape>): Shape`