A segment is either an elliptic arc, a straight segment, a quadratic Bezier spline, a cubic Bezier spline, or a B-spline curve, depending on its Type(). This is a lightweight object, created on the fly by IpeSegmentSubPath::Segment(). There is no public constructor, so the only way to create such an object is through that method.
The Type() is one of the following:
ESegment:
the segment has two control points, and represents a line segment.
EQuad:
a quadratic Bezier spline with three control points.
EBezier:
a cubic Bezier spline with four control points.
ESpline:
a B-spline curve with n control points. The first and last control point's knot value is repeated three times, so the curve begins and ends in these points.
EArc:
an elliptic arc, with begin and end point. The supporting ellipse is defined by the Matrix(), it is the image under the affine transformation Matrix() of the unit circle. Matrix() is such that its inverse transforms both start and end position to points (nearly) on the unit circle. The arc is the image of the positively (counter-clockwise) directed arc from the pre-image of the start position to the pre-image of the end position. Whether this is a positively or negatively oriented arc in user space depends on the matrix.
TType IpePathSegment::Type | ( | ) | const [inline] |
Type of segment.
int IpePathSegment::NumCP | ( | ) | const [inline] |
Number of control points.
IpeVector IpePathSegment::CP | ( | int | i | ) | const [inline] |
Return control point.
IpeVector IpePathSegment::Last | ( | ) | const [inline] |
Return last control point.
IpeBezier IpePathSegment::Bezier | ( | ) | const |
Return segment as IpeBezier.
Panics if segment is not a quadratic or cubic Bezier spline.
void IpePathSegment::Beziers | ( | std::vector< IpeBezier > & | bez | ) | const |
Convert B-spline to a sequence of Bezier splines.
void IpePathSegment::Draw | ( | IpePainter & | painter | ) | const |
Draw the segment.
Current position of the painter is already on first control point.
Add segment to bounding box.
Does not assume that first control point has already been added. Centers of arcs are included in the bbox, to make sure snapping finds them.
Return distance to the segment.
void IpePathSegment::SnapVtx | ( | const IpeVector & | mouse, | |
const IpeMatrix & | m, | |||
IpeVector & | pos, | |||
double & | bound | |||
) | const |
Snap to vertex of the segment.
The method assumes that the first control point has already been tested.