Classes | Public Member Functions | Friends | List of all members
ipe::Curve Class Reference

#include <ipeshape.h>

Inherits ipe::SubPath.

Public Member Functions

 Curve ()
virtual Type type () const
virtual bool closed () const
virtual const CurveasCurve () const
virtual void save (Stream &stream) const
virtual void draw (Painter &painter) const
virtual void addToBBox (Rect &box, const Matrix &m, bool cp) const
virtual double distance (const Vector &v, const Matrix &m, double bound) const
virtual void snapVtx (const Vector &mouse, const Matrix &m, Vector &pos, double &bound, bool cp) const
virtual void snapBnd (const Vector &mouse, const Matrix &m, Vector &pos, double &bound) const
int countSegments () const
int countSegmentsClosing () const
CurveSegment segment (int i) const
CurveSegment closingSegment () const
void appendSegment (const Vector &v0, const Vector &v1)
void appendArc (const Matrix &m, const Vector &v0, const Vector &v1)
void appendSpline (const std::vector< Vector > &v)
void appendOldSpline (const std::vector< Vector > &v)
void appendCardinalSpline (const std::vector< Vector > &v, float tension)
void appendSpiroSpline (const std::vector< Vector > &v)
void appendSpiroSplinePrecomputed (const std::vector< Vector > &v, int sep)
void setClosed (bool closed)
- Public Member Functions inherited from ipe::SubPath
virtual ~SubPath ()=0
virtual const EllipseasEllipse () const
virtual const ClosedSplineasClosedSpline () const


class CurveSegment

Additional Inherited Members

- Public Types inherited from ipe::SubPath
enum  Type { ECurve , EEllipse , EClosedSpline }

Detailed Description

Subpath consisting of a sequence of CurveSegment's.

Constructor & Destructor Documentation

◆ Curve()

Curve::Curve ( )

Create an empty, open subpath.

Member Function Documentation

◆ type()

SubPath::Type Curve::type ( ) const

Return type of this subpath.

Implements ipe::SubPath.

References ipe::SubPath::ECurve.

◆ closed()

virtual bool ipe::Curve::closed ( ) const

Is this subpath closed?

Default implementation returns true.

Reimplemented from ipe::SubPath.

Referenced by draw(), save(), setClosed(), and snapVtx().

◆ asCurve()

const Curve * Curve::asCurve ( ) const

Return this object as an Curve, or else nullptr.

Reimplemented from ipe::SubPath.

◆ save()

void Curve::save ( Stream stream) const

◆ draw()

void Curve::draw ( Painter painter) const

Draw subpath (does not call drawPath()).

Implements ipe::SubPath.

References closed(), ipe::Painter::closePath(), countSegments(), ipe::CurveSegment::draw(), ipe::Painter::moveTo(), and segment().

◆ addToBBox()

void Curve::addToBBox ( Rect box,
const Matrix m,
bool  cp 
) const

Add subpath to box.

Implements ipe::SubPath.

References ipe::CurveSegment::addToBBox(), countSegments(), and segment().

◆ distance()

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

Return distance from v to subpath transformed by m.

Implements ipe::SubPath.

References countSegmentsClosing(), ipe::CurveSegment::distance(), and segment().

◆ snapVtx()

void Curve::snapVtx ( const Vector mouse,
const Matrix m,
Vector pos,
double &  bound,
bool  cp 
) const

◆ snapBnd()

void Curve::snapBnd ( const Vector mouse,
const Matrix m,
Vector pos,
double &  bound 
) const

Snap to boundary of subpath.

Implements ipe::SubPath.

References countSegmentsClosing(), segment(), and ipe::CurveSegment::snapBnd().

◆ countSegments()

int ipe::Curve::countSegments ( ) const

Return number of segments. This does not include the closing segment for a closed path.

Referenced by addToBBox(), draw(), ipe::Shape::isSegment(), ipe::Shape::load(), and snapVtx().

◆ countSegmentsClosing()

int ipe::Curve::countSegmentsClosing ( ) const

Return number of segments including the closing segment.

Referenced by distance(), and snapBnd().

◆ segment()

CurveSegment Curve::segment ( int  i) const

Return segment.

If i is negative, elements from the end are returned. If i == countSegments(), the closing segment of a closed path is returned.

References CurveSegment.

Referenced by addToBBox(), distance(), draw(), ipe::Path::draw(), ipe::Shape::isSegment(), snapBnd(), and snapVtx().

◆ closingSegment()

CurveSegment Curve::closingSegment ( ) const

Returns the closing segment of a closed path.

This method panics if the Curve is not closed.

References CurveSegment.

Referenced by snapVtx().

◆ appendSegment()

void Curve::appendSegment ( const Vector v0,
const Vector v1 

Append a straight segment to the subpath.

References ipe::CurveSegment::ESegment.

Referenced by ipe::Shape::load(), setClosed(), and ipe::Shape::Shape().

◆ appendArc()

void Curve::appendArc ( const Matrix m,
const Vector v0,
const Vector v1 

Append elliptic arc to the subpath.

References ipe::CurveSegment::EArc.

Referenced by ipe::Shape::load(), and ipe::Shape::Shape().

◆ appendSpline()

void ipe::Curve::appendSpline ( const std::vector< Vector > &  v)

◆ appendOldSpline()

void ipe::Curve::appendOldSpline ( const std::vector< Vector > &  v)

◆ appendCardinalSpline()

void Curve::appendCardinalSpline ( const std::vector< Vector > &  v,
float  tension 

Append a cardinal spline curve.

References appendSpline(), and ipe::CurveSegment::ECardinalSpline.

Referenced by ipe::Shape::load().

◆ appendSpiroSpline()

void Curve::appendSpiroSpline ( const std::vector< Vector > &  v)

Append a spiro spline curve.

References ipe::CurveSegment::ESpiroSpline, ipe::size(), and ipe::Bezier::spiroSpline().

Referenced by ipe::Shape::load().

◆ appendSpiroSplinePrecomputed()

void Curve::appendSpiroSplinePrecomputed ( const std::vector< Vector > &  v,
int  sep 

Append a spiro spline curve with precomputed Bezier control points.

References ipe::CurveSegment::ESpiroSpline, and ipe::size().

Referenced by ipe::Shape::load().

◆ setClosed()

void Curve::setClosed ( bool  closed)

Set whether subpath is closed or not.

Must be called after all segments have been added to the path.

References appendSegment(), and closed().

Referenced by ipe::Shape::load(), and ipe::Shape::Shape().

Friends And Related Function Documentation

◆ CurveSegment

friend class CurveSegment

Referenced by closingSegment(), and segment().

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