Package-level declarations

Types

Link copied to clipboard
@Serializable
data class Circle(val center: Vector2, val radius: Double) : Movable, Scalable1D, ShapeProvider, ShapeContourProvider

Creates a Circle.

Link copied to clipboard
Link copied to clipboard
class ContourBuilder(multipleContours: Boolean)
Link copied to clipboard
data class ContourIntersection(val a: ContourPoint, val b: ContourPoint, val position: Vector2)
Link copied to clipboard
data class ContourPoint(val contour: ShapeContour, val contourT: Double, val segment: Segment, val segmentT: Double, val position: Vector2)

Representation of a point on a ShapeContour.

Link copied to clipboard
@Serializable
data class Ellipse(val center: Vector2, val xRadius: Double, val yRadius: Double) : Movable, Scalable2D, ShapeProvider, ShapeContourProvider

Creates a new Ellipse.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class IntRectangle(val corner: IntVector2, val width: Int, val height: Int)

Creates a new IntRectangle.

Link copied to clipboard
@Serializable
data class LineSegment(val start: Vector2, val end: Vector2) : LinearType<LineSegment> , ShapeProvider, ShapeContourProvider

A strictly linear 2D segment.

Link copied to clipboard
data class LineSegment3D(val start: Vector3, val end: Vector3)
Link copied to clipboard
interface Movable
Link copied to clipboard
@Serializable
class Path1D(val segments: List<Segment1D>, val closed: Boolean)
Link copied to clipboard
@Serializable
class Path3D(val segments: List<Segment3D>, val closed: Boolean)
Link copied to clipboard
Link copied to clipboard
class PathProjection3D(val segmentProjection: SegmentProjection3D, val projection: Double, val distance: Double, val point: Vector3)
Link copied to clipboard
@Serializable
data class Rectangle(val corner: Vector2, val width: Double, val height: Double = width) : Movable, Scalable2D, ShapeProvider, ShapeContourProvider

Creates a new axis-aligned Rectangle.

Link copied to clipboard
interface Scalable1D
Link copied to clipboard
Link copied to clipboard
@Serializable
data class Segment(val start: Vector2, val control: List<Vector2>, val end: Vector2, val corner: Boolean = false) : ShapeContourProvider

Creates a new Segment, which specifies a linear or a Bézier curve path between two anchor points (and up to two control points for curvature).

Link copied to clipboard
@Serializable
class Segment1D(val start: Double, val control: Array<Double>, val end: Double) : LinearType<Segment1D>
Link copied to clipboard
@Serializable
class Segment3D(val start: Vector3, val control: Array<Vector3>, val end: Vector3)
Link copied to clipboard
class SegmentIntersection(val a: SegmentPoint, val b: SegmentPoint, val position: Vector2)
Link copied to clipboard
Link copied to clipboard
data class SegmentPoint(val segment: Segment, val segmentT: Double, val position: Vector2)

Representation of a point on a Segment.

Link copied to clipboard
class SegmentProjection3D(val segment: Segment3D, val projection: Double, val distance: Double, val point: Vector3)
Link copied to clipboard

Indicates the type of Segment.

Link copied to clipboard
@Serializable
class Shape(val contours: List<ShapeContour>) : ShapeProvider

A simple interface for managing a List of ShapeContour.

Link copied to clipboard

Shape builder class, used by shape

Link copied to clipboard
@Serializable
data class ShapeContour @JvmOverloads constructor(val segments: List<Segment>, val closed: Boolean, val polarity: YPolarity = YPolarity.CW_NEGATIVE_Y) : ShapeProvider, ShapeContourProvider

A List for managing a collection of Segments.

Link copied to clipboard

provider of ShapeContour

Link copied to clipboard
interface ShapeProvider

provider of Shape

Link copied to clipboard

Indicates the Shape topology.

Link copied to clipboard
@Serializable
data class Triangle(val x1: Vector2, val x2: Vector2, val x3: Vector2) : ShapeProvider, ShapeContourProvider

Creates a simple three-point polygon.

Link copied to clipboard

Indicates the winding order of the ShapeContour.

Functions

Link copied to clipboard
fun Circle(x: Double, y: Double, radius: Double): Circle
Link copied to clipboard

Clamps a Vector2 within the bounds of the bounds Rectangle.

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

Returns true if given Vector2 is inside the Shape.

operator fun ShapeContour.contains(point: Vector2): Boolean

Returns true if given point lies inside the ShapeContour.

Link copied to clipboard

Build a contour

Link copied to clipboard

Build multiple org.openrndr.shape.contours

Link copied to clipboard
@JvmName(name = "differenceIterative")
fun difference(from: List<Shape>, subtract: List<List<Shape>>): List<Shape>

Applies a boolean difference operation iteratively between a List of Shapes and a two-dimensional List of Shapes.

fun difference(from: List<Shape>, subtract: List<Shape>): List<Shape>

Applies a boolean difference operation between two Lists of Shapes.

fun difference(from: List<Shape>, subtract: Shape): List<Shape>

Applies a boolean difference operation between a List of Shapes and a Shape.

fun difference(from: List<Shape>, subtract: ShapeContour): List<Shape>

Applies a boolean difference operation between a List of Shapes and a ShapeContour.

fun difference(from: Shape, subtract: Shape): Shape

Applies a boolean difference operation between two Shapes.

fun difference(from: Shape, subtract: ShapeContour): Shape

Applies a boolean difference operation between a Shape and a ShapeContour.

fun difference(from: ShapeContour, subtract: Shape): Shape

Applies a boolean difference operation between a ShapeContour and a Shape.

fun difference(from: ShapeContour, subtract: ShapeContour): Shape

Applies a boolean difference operation between two ShapeContours.

Link copied to clipboard

Applies a boolean difference operation between two Shapes.

Applies a boolean difference operation between the ShapeContour and another Shape.

Link copied to clipboard
fun Ellipse(x: Double, y: Double, xRadius: Double, yRadius: Double): Ellipse
Link copied to clipboard
@JvmName(name = "intersectionIterative")
fun intersection(from: List<Shape>, with: List<List<Shape>>): List<Shape>

Applies a boolean intersection operation iteratively between a List of Shapes and a two-dimensional List of Shapes.

fun intersection(from: List<Shape>, with: List<Shape>): List<Shape>

Applies a boolean intersection operation between two Lists of Shapes.

fun intersection(from: List<Shape>, with: Shape): List<Shape>

Applies a boolean intersection operation between a List of Shapes and a Shape.

Applies a boolean intersection operation between a List of Shapes and a ShapeContour.

fun intersection(from: Shape, with: Shape): Shape

Applies a boolean intersection operation between two Shapes.

Applies a boolean intersection operation between a Shape and a ShapeContour.

Applies a boolean intersection operation between a ShapeContour and Shape.

Applies a boolean intersection operation between two ShapeContours.

fun intersection(a0: Vector2, a1: Vector2, b0: Vector2, b1: Vector2, eps: Double = 0.0): Vector2

Finds the intersection point between two LineSegments.

Link copied to clipboard

Applies a boolean intersection operation between two Shapes.

Applies a boolean intersection operation between the ShapeContour and a Shape.

Link copied to clipboard

Calculates a List of all points of where paths intersect between the two Shapes.

fun intersections(a: Segment, b: Segment, vertexThreshold: Double = 1.0E-5): List<SegmentIntersection>

Calculates a List of all points where two Segments intersect.

fun intersections(a: ShapeContour, b: ShapeContour, vertexThreshold: Double = 1.0E-5): List<ContourIntersection>

Calculates a List of all points of where paths intersect between two ShapeContours.

Link copied to clipboard

Calculates a List of all points where two Segments intersect.

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

Calculates a List of all points of where a Segment and a ShapeContour intersect.

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.

Calculates a List of all intersections between the ShapeContour and a Segment.

Calculates a List of all intersections between the ShapeContour and a Shape.

Calculates a List of all intersections between the ShapeContour and another ShapeContour.

Link copied to clipboard
fun IntRectangle(x: Int, y: Int, width: Int, height: Int): IntRectangle
Link copied to clipboard
Link copied to clipboard
fun List<Vector2>.map(sourceRectangle: Rectangle, targetRectangle: Rectangle, clamp: Boolean = false): List<Vector2>

Maps all elements in a List<Vector2> from sourceRectangle to targetRectangle. If clamp is true all elements are clamped within the bounds of targetRectangle.

fun Vector2.map(sourceRectangle: Rectangle, targetRectangle: Rectangle, clamp: Boolean = false): Vector2

Remaps Vector2 from a position on the sourceRectangle to a proportionally equivalent position on the targetRectangle.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@JvmName(name = "proportionalizeWithoutT")
fun <T : EuclideanVector<T>> proportionalize(input: List<T>): List<Pair<T, Double>>
Link copied to clipboard
fun Rectangle(x: Double, y: Double, width: Double, height: Double = width): Rectangle
Link copied to clipboard
Link copied to clipboard
@JvmName(name = "resampleList")
fun <T : LinearType<T>> resample(input: List<Pair<T, Double>>, ts: List<Double>): List<Pair<T, Double>>
fun <T1 : LinearType<T1>, T2 : LinearType<T2>> resample(input1: List<Pair<T1, Double>>, input2: List<Pair<T2, Double>>): List<Triple<T1, T2, Double>>
fun <T1 : LinearType<T1>, T2 : LinearType<T2>, T3 : LinearType<T3>> resample(input1: List<Pair<T1, Double>>, input2: List<Pair<T2, Double>>, input3: List<Pair<T3, Double>>): List<Quadruple<T1, T2, T3, Double>>
Link copied to clipboard
fun <T : LinearType<T>, EuclideanVector<T>> sampleEquidistant(segments: List<T>, count: Int): List<T>

Returns specified amount of points of equal distance from each other.

Link copied to clipboard

Returns specified amount of points of equal distance from each other.

Link copied to clipboard
fun Segment(start: Vector2, end: Vector2, corner: Boolean = true): Segment

Linear segment constructor.

fun Segment(start: Vector2, c0: Vector2, end: Vector2, corner: Boolean = true): Segment

Quadratic Bézier segment constructor.

fun Segment(start: Vector2, c0: Vector2, c1: Vector2, end: Vector2, corner: Boolean = true): Segment

Cubic Bézier segment constructor.

Link copied to clipboard
fun Segment1D(start: Double, end: Double): Segment1D
fun Segment1D(start: Double, c0: Double, end: Double): Segment1D
fun Segment1D(start: Double, c0: Double, c1: Double, end: Double): Segment1D
Link copied to clipboard
fun Segment3D(start: Vector3, end: Vector3): Segment3D
fun Segment3D(x0: Double, y0: Double, z0: Double, x1: Double, y1: Double, z1: Double): Segment3D

fun Segment3D(start: Vector3, c0: Vector3, end: Vector3): Segment3D

Quadratic bezier segment constructor

fun Segment3D(start: Vector3, c0: Vector3, c1: Vector3, end: Vector3): Segment3D

Cubic bezier segment constructor

Link copied to clipboard
fun shape(f: ShapeBuilder.() -> Unit): Shape

Build a shape

Link copied to clipboard
fun split(shape: Shape, cutter: LineSegment): Pair<Shape, Shape>

Splits a Shape into two separate Shapes from given LineSegment.

Splits a ShapeContour with all other ShapeContour in a List.

Splits a ShapeContour with another ShapeContour.

Link copied to clipboard
Link copied to clipboard
fun triangulate(shape: Shape, distanceTolerance: Double = 0.5, fillRule: FillRule = FillRule.NONZERO_WINDING): List<Vector2>

Triangulates a Shape into a List of triangle corner positions.

Link copied to clipboard
@JvmName(name = "unionIterative")
fun union(from: List<Shape>, add: List<List<Shape>>): List<Shape>

Applies a boolean org.openrndr.shape.union operation iteratively between a List of Shapes and a two-dimensional List of Shapes.

fun union(from: List<Shape>, add: List<Shape>): List<Shape>

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

fun union(from: List<Shape>, add: Shape): List<Shape>

Applies a boolean org.openrndr.shape.union operation between a List of Shapes and a Shape.

fun union(from: List<Shape>, add: ShapeContour): List<Shape>

Applies a boolean org.openrndr.shape.union operation between a List of Shapes and a ShapeContour.

fun union(from: Shape, add: Shape): Shape

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

fun union(from: Shape, add: ShapeContour): Shape

Applies a boolean org.openrndr.shape.union operation between a Shape and a ShapeContour.

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

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

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

Applies a boolean org.openrndr.shape.union operation between the ShapeContour and a Shape.

Properties

Link copied to clipboard
@get:JvmName(name = "getVector2Bounds")
val List<Vector2>.bounds: Rectangle

Calculates Rectangle-bounds from a List of Vector2 instances.

@get:JvmName(name = "getRectangleBounds")
val List<Rectangle>.bounds: Rectangle

Calculates Rectangle-bounds for a list of Rectangle instances.

Link copied to clipboard
@Transient
val List<Shape>.compound: Shape

Converts a List of Shape items into a single org.openrndr.shape.compound Shape.

Link copied to clipboard

Converts a List of ShapeContours to a single Shape.