Ipelib
|
A segment on an SubPath. More...
#include <ipeshape.h>
A segment on an SubPath.
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 Curve::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. Type ipe::CurveSegment::type | ( | ) | const [inline] |
Type of segment.
int ipe::CurveSegment::countCP | ( | ) | const [inline] |
Number of control points.
Vector ipe::CurveSegment::cp | ( | int | i | ) | const [inline] |
Return control point.
Vector ipe::CurveSegment::last | ( | ) | const [inline] |
Return last control point.
Bezier CurveSegment::bezier | ( | ) | const |
void CurveSegment::beziers | ( | std::vector< Bezier > & | bez | ) | const |
Convert B-spline to a sequence of Bezier splines.
void CurveSegment::draw | ( | Painter & | 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.
If cpf is true, then control points of splines, Bezier curves, and the center of arcs are included in the bbox (so that snapping can find them). Otherwise, a tight bounding box for the geometric object itself is computed.
Return distance to the segment.
void CurveSegment::snapVtx | ( | const Vector & | mouse, |
const Matrix & | m, | ||
Vector & | pos, | ||
double & | bound | ||
) | const |
Snap to vertex of the segment.
The method assumes that the first control point has already been tested.
void CurveSegment::snapBnd | ( | const Vector & | mouse, |
const Matrix & | m, | ||
Vector & | pos, | ||
double & | bound | ||
) | const |
friend class Curve [friend] |