Package-level declarations

Types

Link copied to clipboard
class Turtle(initialPosition: Vector2)

Functions

Link copied to clipboard
fun Turtle.arc(length: Double, curvature: Double)

Moves the turtle length forward along a circular arc of constant curvature, in radians per unit of length: the arc of radius 1 / |curvature| that turns by curvature · length radians, the same way as Turtle.rotate for positive curvature. Zero curvature moves straight ahead. See curve.

Link copied to clipboard
fun Turtle.clothoid(length: Double, startCurvature: Double, endCurvature: Double)

Moves the turtle length forward along a clothoid (Euler spiral): the curvature changes linearly with the distance travelled, from startCurvature to endCurvature, in radians per unit of length, so the turtle turns by (startCurvature + endCurvature) / 2 · length radians in total. Clothoids join straight lines and arcs without jumps in curvature, as in road and track design. See curve.

Link copied to clipboard
fun Turtle.contour(contour: ShapeContour, alignTangent: Boolean = true)
Link copied to clipboard
fun Turtle.curve(length: Double, curvature: (s: Double) -> Double)

Moves the turtle length forward while it turns as sharply as curvature prescribes: curvature(s) is the turning rate, in radians per unit of length, after a distance s from 0 to length. Positive curvature turns the same way as a positive Turtle.rotate. Where the pen is down the path is drawn; afterwards the turtle faces the way the path ends.

Link copied to clipboard
fun Turtle.segment(segment: Segment2D, alignTangent: Boolean = true, externalAlignTransform: Matrix44 = Matrix44.IDENTITY): Matrix44
Link copied to clipboard
fun turtle(initalPosition: Vector2, program: Turtle.() -> Unit): List<ShapeContour>