Moves the turtle clockwise over an elliptic arc.
The arc spans
arc.angle degrees of the ellipse, starting at the point described by
start.angle degrees and ending at the point described by (
The size and shape of the elliptic arc can visualized in the following manner.
First, imagine an ellipse drawn in the center of the screen, such that the
x.semiaxis is the distance from the center to the ellipse along the X-axis and
y.semiaxis is the distance from the center to the ellipse along the Y-axis.
ELLIPSEARC2 draws part of this ellipse, an arc between two points on the ellipse.
The starting point for this arc can be visualized by imagining a turtle at the ellipse's center with a HEADING of
Wherever this turtle intersects the ellipse as it moves forward is the starting point of the arc.
The ending point can be similarly imagined as if that turtle had turned RIGHT an additional
arc.angle degrees before moving forward to intersect the ellipse.
The position and orientation of the ellipse arc more difficult to understand, especially since the elliptic arc is not always drawn from where the turtle starts to where the turtle ends up.
However, there are two simple cases.
start.angle is a multiple of 90 degrees, then the arc is drawn tangent to the turtle's heading.
arc.angle sum to a multiple of 90 degrees, then the turtle ends up tangent to the arc which is drawn.
Despite the confusing behavior, it is straight-forward to use ELLIPSEARC2 to iteratively draw contiguous segments of an ellipse.
If your first call has a
start.angle of 0 and in each subsequent call, the
start.angle is the sum of all
arc.angle inputs previously given, you'll end drawing contiguous ellipse arcs, even though the intermediate turtle positions may not lie on the ellipse.
Normally, the arc is drawn in clockwise direction, but if the
arc.angle input is negative, then the turtle moves backward in a counter-clockwise direction.
A simple 2D example:
ELLIPSEARC2 90 100 200 0 ELLIPSEARC2 90 50 100 0
A 2D ellipse built out of multiple consecutive arcs:
SETPENSIZE 10 SETPENCOLOR "RED ELLIPSEARC2 90 150 100 0 SETPENCOLOR "LIME ELLIPSEARC2 90 150 100 90 SETPENCOLOR "BLUE ELLIPSEARC2 90 150 100 180 SETPENCOLOR "YELLOW ELLIPSEARC2 90 150 100 270
An ellipse drawn with a dashed line using multiple consecutive arcs:
REPEAT 36 [ PENDOWN ELLIPSEARC2 10 50 200 REPCOUNT*20-20 PENUP ELLIPSEARC2 10 50 200 REPCOUNT*20-10 ]
A 3D example:
PERSPECTIVE REPEAT 72 [ELLIPSEARC2 90 50 100 0 RIGHTROLL 5]