Prev Up Next
Attributes Curve Objects Constants

Methods

Segment Construction

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.

AppendLine(p[, cont])
AppendLine(x, y[, cont])

Append a line segment to self. p must be a PointSpec.

cont is the continuity at the end node and defaults to ContAngle.

AppendBezier(p1, p2, p[, cont])
AppendBezier(x1, y1, x2, y2, x, y[, cont])

Append a bezier segment to self. p, p1, and p2 must be PointSpecs. The control points of the bezier segment are the current end point of the curve, p1 and p2 (which are only approximated) and p.

cont is the continuity at the end node and defaults to ContAngle.

AppendSegment(CurveLine, (), p[, cont])
AppendSegment(CurveBezier, (p1, p2), p[, cont])

Append a segment. If the first parameter is CurveLine, this method is equivalent to AppendLine(p, cont), with cont defaulting to ContAngle.

If the first parameter is CurveBezier, this method is equivalent to AppendLine(p1, p2, p, cont), with cont defaulting to ContAngle.

This method is mainly supplied as the opposite of the method Segment.

Querying the Curve Geometry

The following methods usually take the index of a segment as argument. This index counts from 0 to len - 1. If the index is negative it counts from the end, just like for other sequences.

Segment(i)

Return the segment number i as a 4-tuple.

If the segment is a line segment the result is of the form:

(CurveLine, (), p, cont)

if it is a bezier segment the result has the form:

(CurveBezier, (p1, p2), p, cont)

The result is suitable as argument tuple to AppendSegment.

Node(i)

Return the ith node as a point object.

Continuity(i)

Return the continuity at node i.

SegmentType(i)

Return the type of the ith segment (either CurveLine or CurveBezier).

Modifying a Curve Object

SetLine(i, p[, cont])
SetLine(i, x, y[, cont])

Replace the ith segment by a line segment. The arguments p, x, y and cont are used as in AppendLine.

SetBezier(i, p1, p2, p[, cont])
SetBezier(i, x1, y1, x2, y2, x, y[, cont])

Replace the ith segment by a bezier segment. The rest of the arguments are used as in AppendBezier.

SetSegment(i, CurveLine, (), p[, cont])
SetSegment(i, CurveBezier, (p1, p2), p[, cont])

Replace the ith segment by the segment described by the rest of arguments, which are used as in AppendSegment.

ClosePath()

Close the curve.

Transform(trafo)

Apply the transformation trafo (a trafo object) to the path. The path is modified in place.

Translate(offset)

Translate the path by offset, a point object. The path is modified in place.

Managing the Selection

SegmentSelected(i)

Return true (1) if the ith segment is selected, false (0) otherwise.

SelectSegment(i, [flag])

Mark the ith segment as selected if flag is true and as unselected otherwise. flag defaults to true.


Attributes Curve Objects Constants
Prev Up Next