libs/flake

KoPathSegment Class Reference

A KoPathSegment consist of two neighboring KoPathPoints. More...

#include <KoPathSegment.h>

List of all members.

Public Member Functions

 KoPathSegment (const QPointF &p0, const QPointF &p1, const QPointF &p2, const QPointF &p3)
 KoPathSegment (const QPointF &p0, const QPointF &p1, const QPointF &p2)
 KoPathSegment (const QPointF &p0, const QPointF &p1)
 KoPathSegment (const KoPathSegment &segment)
 KoPathSegment (KoPathPoint *first=0, KoPathPoint *second=0)
 ~KoPathSegment ()
QRectF boundingRect () const
QRectF controlPointRect () const
QList< QPointFcontrolPoints () const
KoPathSegment convertToCubic () const
QList< QPointFconvexHull () const
int degree () const
KoPathPointfirst () const
QList< QPointFintersections (const KoPathSegment &segment) const
bool isFlat (qreal tolerance=0.01) const
bool isValid () const
qreal length (qreal error=0.005) const
qreal lengthAt (qreal t, qreal error=0.005) const
KoPathSegment mapped (const QMatrix &matrix) const
qreal nearestPoint (const QPointF &point) const
KoPathSegmentoperator= (const KoPathSegment &rhs)
bool operator== (const KoPathSegment &rhs) const
qreal paramAtLength (qreal length, qreal tolerance=0.001) const
QPointF pointAt (qreal t) const
void printDebug () const
KoPathPointsecond () const
void setFirst (KoPathPoint *first)
void setSecond (KoPathPoint *second)
QPair< KoPathSegment,
KoPathSegment
splitAt (qreal t) const
KoPathSegment toCubic () const

Static Public Member Functions

static KoPathSegment interpolate (const QPointF &p0, const QPointF &p1, const QPointF &p2, qreal t)

Detailed Description

A KoPathSegment consist of two neighboring KoPathPoints.

Definition at line 33 of file KoPathSegment.h.


Constructor & Destructor Documentation

KoPathSegment::KoPathSegment ( KoPathPoint first = 0,
KoPathPoint second = 0 
) [explicit]

Creates a new segment from the given path points It takes ownership of the path points which do not have a parent path shape set.

Definition at line 278 of file KoPathSegment.cpp.

KoPathSegment::KoPathSegment ( const KoPathSegment segment  ) 

Constructs segment by copying another segment.

Definition at line 283 of file KoPathSegment.cpp.

KoPathSegment::KoPathSegment ( const QPointF p0,
const QPointF p1 
)

Creates a new line segment.

Definition at line 297 of file KoPathSegment.cpp.

KoPathSegment::KoPathSegment ( const QPointF p0,
const QPointF p1,
const QPointF p2 
)

Creates a new quadratic segment.

Definition at line 304 of file KoPathSegment.cpp.

KoPathSegment::KoPathSegment ( const QPointF p0,
const QPointF p1,
const QPointF p2,
const QPointF p3 
)

Creates a new cubic segment.

Definition at line 312 of file KoPathSegment.cpp.

KoPathSegment::~KoPathSegment (  ) 

Destroys the path segment.

Definition at line 339 of file KoPathSegment.cpp.


Member Function Documentation

QRectF KoPathSegment::boundingRect (  )  const

Returns the axis aligned tight bounding rect.

Definition at line 444 of file KoPathSegment.cpp.

QRectF KoPathSegment::controlPointRect (  )  const

Returns the control point bounding rect.

Definition at line 419 of file KoPathSegment.cpp.

QList< QPointF > KoPathSegment::controlPoints (  )  const

Returns ordered list of control points.

Definition at line 1055 of file KoPathSegment.cpp.

KoPathSegment KoPathSegment::convertToCubic (  )  const

Converts to cubic segment.

Definition at line 1415 of file KoPathSegment.cpp.

QList< QPointF > KoPathSegment::convexHull (  )  const

Returns the convex hull polygon of the segment.

Definition at line 897 of file KoPathSegment.cpp.

int KoPathSegment::degree (  )  const

Returns the degree of the segment: 1 = line, 2 = quadratic, 3 = cubic, -1 = invalid.

Definition at line 389 of file KoPathSegment.cpp.

KoPathPoint * KoPathSegment::first (  )  const

Returns the first point of the segment.

Definition at line 348 of file KoPathSegment.cpp.

KoPathSegment KoPathSegment::interpolate ( const QPointF p0,
const QPointF p1,
const QPointF p2,
qreal  t 
) [static]

Interpolates quadric bezier curve.

Returns:
the interpolated bezier segment

Definition at line 1392 of file KoPathSegment.cpp.

QList< QPointF > KoPathSegment::intersections ( const KoPathSegment segment  )  const

Returns list of intersections with the given path segment.

Definition at line 477 of file KoPathSegment.cpp.

bool KoPathSegment::isFlat ( qreal  tolerance = 0.01  )  const

Checks if the segment is flat, i.e.

the height smaller then the given tolerance

Parameters:
tolerance the flatness tolerance

Definition at line 829 of file KoPathSegment.cpp.

bool KoPathSegment::isValid (  )  const

Returns if segment is valid, e.g. has two valid points.

Definition at line 372 of file KoPathSegment.cpp.

qreal KoPathSegment::length ( qreal  error = 0.005  )  const

Returns the length of the path segment.

Parameters:
error the error tolerance

Definition at line 725 of file KoPathSegment.cpp.

qreal KoPathSegment::lengthAt ( qreal  t,
qreal  error = 0.005 
) const

Returns segment length at given parameter.

Splits the segment at the given parameter t and calculates the length of the first segment of the split.

Parameters:
t curve parameter to get length at
error the error tolerance

Definition at line 787 of file KoPathSegment.cpp.

KoPathSegment KoPathSegment::mapped ( const QMatrix matrix  )  const

Returns transformed segment.

Definition at line 683 of file KoPathSegment.cpp.

qreal KoPathSegment::nearestPoint ( const QPointF point  )  const

Returns the parameter for the curve point nearest to the given point.

Parameters:
point the point to find nearest point to
Returns:
the parameter of the curve point nearest to the given point

Definition at line 1208 of file KoPathSegment.cpp.

KoPathSegment & KoPathSegment::operator= ( const KoPathSegment rhs  ) 

Assigns segment.

Definition at line 321 of file KoPathSegment.cpp.

bool KoPathSegment::operator== ( const KoPathSegment rhs  )  const

Compare operator.

Definition at line 377 of file KoPathSegment.cpp.

qreal KoPathSegment::paramAtLength ( qreal  length,
qreal  tolerance = 0.001 
) const

Returns the curve parameter at the given length of the segment.

Parameters:
length the length to get the curve parameter for
tolerance the length error tolerance

Definition at line 798 of file KoPathSegment.cpp.

QPointF KoPathSegment::pointAt ( qreal  t  )  const

Returns point at given t.

Definition at line 403 of file KoPathSegment.cpp.

void KoPathSegment::printDebug (  )  const

Definition at line 1445 of file KoPathSegment.cpp.

KoPathPoint * KoPathSegment::second (  )  const

Returns the second point of the segment.

Definition at line 360 of file KoPathSegment.cpp.

void KoPathSegment::setFirst ( KoPathPoint first  ) 

Sets the first segment point.

Definition at line 353 of file KoPathSegment.cpp.

void KoPathSegment::setSecond ( KoPathPoint second  ) 

Sets the second segment point.

Definition at line 365 of file KoPathSegment.cpp.

QPair< KoPathSegment, KoPathSegment > KoPathSegment::splitAt ( qreal  t  )  const

Splits segment at given position returning the two resulting segments.

Definition at line 967 of file KoPathSegment.cpp.

KoPathSegment KoPathSegment::toCubic (  )  const

Returns cubic bezier curve segment of this segment.

Definition at line 696 of file KoPathSegment.cpp.


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