Ipelib
Public Types | Public Member Functions | Friends | List of all members
ipe::CurveSegment Class Reference

#include <ipeshape.h>

Public Types

enum  Type {
  EArc, ESegment, EQuad, EBezier,
  ESpline
}

Public Member Functions

Type type () const
int countCP () const
Vector cp (int i) const
Vector last () const
Matrix matrix () const
Bezier bezier () const
Arc arc () const
void beziers (std::vector< Bezier > &bez) const
void draw (Painter &painter) const
void addToBBox (Rect &box, const Matrix &m, bool cp) const
double distance (const Vector &v, const Matrix &m, double bound) const
void snapVtx (const Vector &mouse, const Matrix &m, Vector &pos, double &bound) const
void snapBnd (const Vector &mouse, const Matrix &m, Vector &pos, double &bound) const

Friends

class Curve

Detailed Description

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:

Member Enumeration Documentation

Enumerator:
EArc 
ESegment 
EQuad 
EBezier 
ESpline 

Member Function Documentation

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.

Matrix ipe::CurveSegment::matrix ( ) const
inline

Matrix (if Type() == EArc).

Bezier CurveSegment::bezier ( ) const

Return segment as Bezier.

Panics if segment is not a quadratic or cubic Bezier spline.

Arc CurveSegment::arc ( ) const

Return segment as Arc.

Panics if segment is not an arc.

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.

void CurveSegment::addToBBox ( Rect box,
const Matrix m,
bool  cpf 
) const

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.

double CurveSegment::distance ( const Vector v,
const Matrix m,
double  bound 
) const

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

Friends And Related Function Documentation

friend class Curve
friend

The documentation for this class was generated from the following files: