![]() |
![]() |
![]() |
---|---|---|
Coordinate Systems | Developer's Guide | The Document and Graphics Classes |
A curve object represents a single continuous curve. A curve is a sequence of segments with each segment starting at the end point of the preceding segment (except the first segment, of which only the end point is used as the start point of the second segment).
There are two kinds of segments, line segments and bezier segments.
A line segment is defined by its end point, p, and it defines a straight line from the preceding segment's end point to p.
A bezier segment consists of an end point, p, and two auxiliary points, p1 and p2. It defines a bezier curve starting at the preceding segment's end point, approximating p1 and p2 and ending at p.
The end points of the segments are usually called nodes. There are two special properties associated with them.
The first property is the continuity. The continuity can be `angle', `smooth' or `symmetrical'. This results in constraints in the editor when the user modifies a bezier object's auxiliary points:
No contstraint.
The node, the auxiliary points p2 of the node's segment, and p1 of the following segment must be collinear.
The node, the auxiliary points p2 of the node's segment, and p1 of the following segment must be collinear and the node is the arithmetic mean of the two auxiliary points.
The second property is only used during editing and has not effect on the appearance of the curve. It is a flag that indicates whether the node is selected or not.
Segments are numbered from zero, just like other sequences in Python.
Return an empty curve object.
len
The number of segments. An empty curve has zero length, a curve with just one node has length 1.
closed
True (1) if the curve is closed, false (0) otherwise.
When an empty curve has been created, segments can be appended using the functions listed in this section. The first segment of a curve must be a line segment.
Append a line segment to self. p must be a PointSpec.
cont is the continuity at the end node and defaults to
ContAngle
.
Append a bezier segment to self. p, p1, and p2 must be PointSpecs. The control points of the bezier segme