ContourEdge

data class ContourEdge(val contour: ShapeContour, val segmentIndex: Int, val adjustments: List<SegmentOperation> = emptyList())(source)

Helper for querying and adjusting ShapeContour.

  • An edge embodies exactly the same thing as a Segment2D

  • All edge operations are immutable and will create a new ContourEdge pointing to a copied and updated ShapeContour

Since

0.4.4

Parameters

contour

the contour to be adjusted

segmentIndex

the index the contour's segment to be adjusted

adjustments

a list of SegmentOperation that have been applied to reach to contour, this is used to inform ShapeContour of changes in the contour topology.

Constructors

Link copied to clipboard
constructor(contour: ShapeContour, segmentIndex: Int, adjustments: List<SegmentOperation> = emptyList())

Types

Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard
val contour: ShapeContour
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val ContourEdge.tunniLine: LineSegment

The Tunni-line for this ContourEdge

Link copied to clipboard
val ContourEdge.tunniPoint: Vector2

The Tunni-point for this ContourEdge

Functions

Link copied to clipboard
fun control0MovedBy(translation: Vector2): ContourEdge

Moves the first control point of a contour edge by a specified translation vector.

Link copied to clipboard
fun control1MovedBy(translation: Vector2): ContourEdge

Moves the second control point (Control1) of a contour edge by a specified translation vector.

Link copied to clipboard
fun endMovedBy(translation: Vector2, updateTangents: Boolean = true): ContourEdge

Moves the end point of the contour edge by the specified translation vector.

Link copied to clipboard
fun maskOf(vararg control: ContourEdge.ControlMask): Int
Link copied to clipboard
fun movedBy(translation: Vector2, updateTangents: Boolean = true): ContourEdge

Creates a new contour edge by applying a translation to the current edge.

Link copied to clipboard

Replace this edge with a point at t

fun replacedWith(openContour: ShapeContour): ContourEdge

Replaces the current edge with the segments of an open shape contour.

Link copied to clipboard
fun rotatedBy(rotationInDegrees: Double, anchorT: Double, updateTangents: Boolean = true): ContourEdge
Link copied to clipboard
fun scaledBy(scaleFactor: Double, anchorT: Double, updateTangents: Boolean = true): ContourEdge
fun scaledBy(scaleFactor: Double, anchor: Vector2, updateTangents: Boolean = true): ContourEdge
Link copied to clipboard

Split the edge at t

Link copied to clipboard
fun splitIn(parts: Int): ContourEdge

Split the edge in parts parts of equal length

Link copied to clipboard
fun startMovedBy(translation: Vector2, updateTangents: Boolean = true): ContourEdge

Moves the starting point of the contour edge by the given translation vector.

Link copied to clipboard

Returns part of the edge between t0 to t1. Preserves topology unless t0 = t1.

Link copied to clipboard

Convert the edge to a cubic edge

Link copied to clipboard

Convert the edge to a linear edge, truncating control points if those exist

Link copied to clipboard
fun transformedBy(transform: Matrix44, updateTangents: Boolean = true, mask: Int = 15, promoteToCubic: Boolean = false): ContourEdge

apply transform to the edge

Link copied to clipboard

provide a copy without the list of adjustments

Link copied to clipboard
fun ContourEdge.withTunniLine(pointOnLine: Vector2): ContourEdge
Link copied to clipboard
fun ContourEdge.withTunniPoint(tunniPoint: Vector2): ContourEdge