Turtle

class Turtle(initialPosition: Vector2)(source)

Constructors

Link copied to clipboard
constructor(initialPosition: Vector2)

Properties

Link copied to clipboard
val cb: ContourBuilder
Link copied to clipboard
var direction: Vector2
Link copied to clipboard
Link copied to clipboard
var orientation: Matrix44
Link copied to clipboard
var position: 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 close()
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 forward(distance: Double)
Link copied to clipboard
fun penDown()
Link copied to clipboard
fun penUp()
Link copied to clipboard
fun pop()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun push()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun rotate(degrees: Double)
Link copied to clipboard
fun Turtle.segment(segment: Segment2D, alignTangent: Boolean = true, externalAlignTransform: Matrix44 = Matrix44.IDENTITY): Matrix44