Core 1.0
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
PointCurve2 Class Reference

Piecewise point curve in the plane. More...

#include <curvepoint.h>

Inheritance diagram for PointCurve2:
VectorSet2

Public Member Functions

 PointCurve2 ()
 Empty.
 
 PointCurve2 (const VectorSet2 &, bool=false)
 Creates a curve with points. More...
 
 PointCurve2 (const CubicCurve2 &, int, const double &=0.0, const double &=1.0)
 Creates a point curve from a cubic curve. More...
 
 PointCurve2 (const QuadricCurve2 &, int, const double &=0.0, const double &=1.0)
 Creates a point curve from a quadric curve. More...
 
 PointCurve2 (const QVector< Vector2 > &, bool=false)
 Creates a curve with points. More...
 
 ~PointCurve2 ()
 Empty.
 
int Size () const
 Return the size of the sampled curve.
 
Vector2 Tangent (int) const
 Compute the tangent at a given point. More...
 
double Curvature (int) const
 Compute the curvature at a given point. More...
 
PointCurve Transform (const Frame &) const
 Transform the planar point curve into a three dimensional point curve. More...
 
bool IsClosed () const
 Check if the curve is closed.
 
void Close ()
 Define the curve as closed.
 
double Length () const
 Compute the length of the curve.
 
double Sinuosity () const
 Compute the sinuosity. More...
 
Polygon2 GetPolygon () const
 Compute the closed bounding polygon.
 
CubicCurve2Set ToCubicCurve () const
 Compute the cubic curve passing through all the points of the polyline.
 
QuadricCurve2Set ToQuadricCurve () const
 Compute the quadric curve passing through all the points of the polyline.
 
PointCurve2 Translated (const Vector2 &) const
 Return a translated point curve. More...
 
PointCurve2 Rotated (const double &) const
 Return a rotated point curve. More...
 
PointCurve2 Scaled (const Vector2 &) const
 Return a scaled point curve. More...
 
double R (const Vector2 &, double &, int &) const
 Computes the projection of p onto the piecewise linear curve and returns the squared distance. More...
 
double R (const Vector2 &, double &, int &, int &) const
 Computes the projection of p onto the piecewise linear curve, returns the squared distance, and the side with respect to the curve. More...
 
void Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw the point curve. More...
 
- Public Member Functions inherited from VectorSet2
 VectorSet2 ()
 Empty.
 
 VectorSet2 (const QVector< Vector2 > &)
 Create a set of vectors. More...
 
 ~VectorSet2 ()
 Empty.
 
int Size () const
 Return the size of the set.
 
Vector2 At (int) const
 Access to element.
 
Vector2operator[] (int)
 Access to element.
 
Vector2 Barycenter () const
 Compute the barycenter.
 
Box2 GetBox () const
 Compute the bounding box. More...
 
Convex2 GetHull () const
 Compute the convex hull of the set.
 
void Rotate (const Matrix2 &)
 Rotate all the points. More...
 
void Rotate (const double &)
 Rotate all the points. More...
 
void Translate (const Vector2 &)
 Translate all the points. More...
 
void Scale (const double &)
 Scale all the points. More...
 
void Scale (const Vector2 &)
 Scale all the points. More...
 
VectorSet2 Translated (const Vector2 &) const
 Compute the translated set. More...
 
VectorSet2 Rotated (const double &) const
 Compute the rotated set. More...
 
VectorSet2 Scaled (const Vector2 &) const
 Compute the scaled set. More...
 
QVector< Vector2 > & Get ()
 Access to the internal structure.
 
int Nearest (const Vector2 &) const
 Compute the index of the nearest point to the argument point. More...
 
QVector< Vector2Nearest (const Vector2 &, int) const
 Compute the k-nearest points to the argument point. More...
 
QVector< int > NearestIndexes (const Vector2 &, int) const
 Compute the set of indexes of the k-nearest points to the argument point. More...
 
QVector< int > NearestIndexes (int, int, const double &=Math::Infinity) const
 Compute the set of indexes of the k-nearest points to the argument point in the set. More...
 

Static Public Member Functions

static double Length (const QVector< Vector2 > &, bool=false)
 Compute the length of a discrete curve. More...
 

Protected Attributes

bool closed
 Closed curve flag.
 
- Protected Attributes inherited from VectorSet2
QVector< Vector2v
 Vectors.
 

Detailed Description

Piecewise point curve in the plane.

Constructor & Destructor Documentation

◆ PointCurve2() [1/4]

PointCurve2::PointCurve2 ( const VectorSet2 p,
bool  closed = false 
)
explicit

Creates a curve with points.

Parameters
pSet of points.
closedFlag defining whether the curve is closed (true) or open (false).

◆ PointCurve2() [2/4]

PointCurve2::PointCurve2 ( const CubicCurve2 c,
int  n,
const double &  a = 0.0,
const double &  b = 1.0 
)
explicit

Creates a point curve from a cubic curve.

Parameters
cCubic curve.
nNumber of points.
a,bInternval.

◆ PointCurve2() [3/4]

PointCurve2::PointCurve2 ( const QuadricCurve2 c,
int  n,
const double &  a = 0.0,
const double &  b = 1.0 
)
explicit

Creates a point curve from a quadric curve.

Parameters
cQuadric curve.
nNumber of points.
a,bInternval.

◆ PointCurve2() [4/4]

PointCurve2::PointCurve2 ( const QVector< Vector2 > &  p,
bool  closed = false 
)
explicit

Creates a curve with points.

Parameters
pSet of points.
closedFlag defining whether the curve is closed (true) or open (false).

Member Function Documentation

◆ Curvature()

double PointCurve2::Curvature ( int  i) const

Compute the curvature at a given point.

Parameters
iIndex of the point on the curve.

◆ Draw()

void PointCurve2::Draw ( QGraphicsScene &  scene,
const QPen &  pen = QPen(),
const QBrush &  brush = QBrush() 
) const

Draw the point curve.

Parameters
sceneGraphics scene.
penThe pen.
brushThe brush.

◆ Length()

double PointCurve2::Length ( const QVector< Vector2 > &  p,
bool  closed = false 
)
static

Compute the length of a discrete curve.

Parameters
pArray of points.
closedBoolean.

◆ R() [1/2]

double PointCurve2::R ( const Vector2 p,
double &  u,
int &  k 
) const

Computes the projection of p onto the piecewise linear curve and returns the squared distance.

Parameters
pPoint.
uParameter defining the coordinate of the projection of the argument vertex onto the curve.
kIndex of the curve for which the minimum distance was found.

◆ R() [2/2]

double PointCurve2::R ( const Vector2 p,
double &  u,
int &  k,
int &  side 
) const

Computes the projection of p onto the piecewise linear curve, returns the squared distance, and the side with respect to the curve.

Parameters
pPoint.
uParameter defining the coordinate of the projection of the argument vertex onto the curve.
kIndex of the curve for which the minimum distance was found.
sideSide of the point with respect to the closest segment (1 or -1)

◆ Rotated()

PointCurve2 PointCurve2::Rotated ( const double &  a) const

Return a rotated point curve.

Parameters
aRotation angle.

◆ Scaled()

PointCurve2 PointCurve2::Scaled ( const Vector2 s) const

Return a scaled point curve.

Parameters
sScaling vector.

◆ Sinuosity()

double PointCurve2::Sinuosity ( ) const

Compute the sinuosity.

Sinusoity is defined as the ratio between the length of the curve and the distance between end points.

◆ Tangent()

Vector2 PointCurve2::Tangent ( int  i) const

Compute the tangent at a given point.

Parameters
iIndex.

◆ Transform()

PointCurve PointCurve2::Transform ( const Frame f) const

Transform the planar point curve into a three dimensional point curve.

Transformation if performed as follows: (x,y) are mapped to (0,x,y).

Parameters
fFrame.

◆ Translated()

PointCurve2 PointCurve2::Translated ( const Vector2 t) const

Return a translated point curve.

Parameters
tTranslation vector.