Shape

class Shape(contours: List<ShapeContour>) : ShapeProvider

A simple interface for managing a List of ShapeContour.

Constructors

Shape
Link copied to clipboard
common
fun Shape(contours: List<ShapeContour>)

Types

Companion
Link copied to clipboard
common
object Companion

Functions

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

The indexed hole of the shape.

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

Applies a map to the shape. Maps every contour.

polygon
Link copied to clipboard
common
fun polygon(distanceTolerance: Double = 0.5): Shape
splitCompounds
Link copied to clipboard
common
fun splitCompounds(winding: Winding = Winding.CLOCKWISE): List<Shape>

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

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

Applies a linear transformation to the Shape.

Properties

bounds
Link copied to clipboard
common
val bounds: Rectangle
closedContours
Link copied to clipboard
common
val closedContours: List<ShapeContour>

Lists all ShapeContours with a closed topology.

compound
Link copied to clipboard
common
val compound: Boolean

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

contours
Link copied to clipboard
common
val contours: List<ShapeContour>
empty
Link copied to clipboard
common
val empty: Boolean

Returns true if Shape contains no ShapeContours.

linear
Link copied to clipboard
common
val linear: Boolean

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

openContours
Link copied to clipboard
common
val openContours: List<ShapeContour>

Lists all ShapeContours with an open topology.

outline
Link copied to clipboard
common
val outline: ShapeContour

The outline of the shape.

shape
Link copied to clipboard
common
open override val shape: Shape

the provided shape

topology
Link copied to clipboard
common
val topology: ShapeTopology

Indicates the Shape topology.

Extensions

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

Returns true if given Vector2 is inside the Shape.

difference
Link copied to clipboard
common
fun Shape.difference(other: Shape): Shape

Applies a boolean difference operation between two Shapes.

intersection
Link copied to clipboard
common
fun Shape.intersection(other: Shape): Shape

Applies a boolean intersection operation between two Shapes.

intersections
Link copied to clipboard
common
fun Shape.intersections(other: Shape): List<ContourIntersection>

Calculates a List of all points where two Shapes intersect.

fun Shape.intersections(other: ShapeContour): List<ContourIntersection>

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

fun Shape.intersections(other: Segment): List<ContourIntersection>

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

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

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