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

Piecewise quadric curves. More...

#include <curveset.h>

Public Member Functions

 QuadricCurve2Set ()
 Creates an empty piecewise quadric curve.
 
 QuadricCurve2Set (const QVector< Vector2 > &)
 Creates the piecewise quadric curve given a set of control points. More...
 
 QuadricCurve2Set (const QVector< QuadricCurve2 > &)
 Create a set of quadric curves. More...
 
 QuadricCurve2Set (const QuadricCurveSet &)
 Creates a piecewise cubic curve in the plane from a similar curve. More...
 
 ~QuadricCurve2Set ()
 Destroys a piecewise quadric curve.
 
int Size () const
 Returns the number of elements of the piecewise quadric curve.
 
QuadricCurve2 operator() (int) const
 Read only access to the elements of the piecewise quadric curve.
 
void Translate (const Vector2 &)
 Translate the curve. More...
 
Box2 GetBox () const
 Compute the bounding box of the curve.
 
double GetLength () const
 Return the length of the curve.
 
double GetLength (int) const
 Return the length of the sub-curve. More...
 
double Sinuosity () const
 Compute the sinuosity. More...
 
QVector< Vector2GetDiscretisation (const double &) const
 Generates a discretization of the curve with a linear curvilign absisca parameterization. More...
 
int U (const double &, double &) const
 Compute the parameter of the curve corresponding to the input length. More...
 
double R (const Vector2 &, double &, int &) const
 This function returns the squared distance between a point and a set of quadric curves. More...
 
double UV (const Vector2 &, double &, double &, int &) const
 Compute the inverse mapping for a given input point. More...
 
bool Inside (const Vector2 &) const
 Check if a point lies inside the piecewise quadric curve closed contour. More...
 
bool Intersect (const Ray2 &, double &) const
 Compute the first intersection between a ray and the curve. More...
 
int Intersections (const Ray2 &) const
 Compute the number of intersections between a ray and a piecewize quadric curve. More...
 
QuadricCurve2Setoperator+= (const QuadricCurve2Set &)
 Appends a piecewise cubic curve to an existing piecewise cubic curve. More...
 
void Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw the curve. More...
 

Protected Attributes

QVector< QuadricCurve2curve
 Set of quadric curves.
 
QVector< double > lengths
 Length of every curve (internal optimization)
 
double length = 0.0
 Total length (internal optimization)
 

Detailed Description

Piecewise quadric curves.

This class stores an array of quadric curves.

Constructor & Destructor Documentation

◆ QuadricCurve2Set() [1/3]

QuadricCurve2Set::QuadricCurve2Set ( const QVector< Vector2 > &  p)
explicit

Creates the piecewise quadric curve given a set of control points.

Parameters
pControl vertices.

◆ QuadricCurve2Set() [2/3]

QuadricCurve2Set::QuadricCurve2Set ( const QVector< QuadricCurve2 > &  s)
explicit

Create a set of quadric curves.

Parameters
sSet of quadric curves.

◆ QuadricCurve2Set() [3/3]

QuadricCurve2Set::QuadricCurve2Set ( const QuadricCurveSet c)
explicit

Creates a piecewise cubic curve in the plane from a similar curve.

Parameters
cCurve.

Member Function Documentation

◆ Draw()

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

Draw the curve.

The brush is not used.

Parameters
sceneGraphics scene.
penThe pen.
brushThe brush.

◆ GetDiscretisation()

QVector< Vector2 > QuadricCurve2Set::GetDiscretisation ( const double &  step) const

Generates a discretization of the curve with a linear curvilign absisca parameterization.

Parameters
stepStep.

◆ GetLength()

double QuadricCurve2Set::GetLength ( int  k) const
inline

Return the length of the sub-curve.

Parameters
kCurve index.

◆ Inside()

bool QuadricCurve2Set::Inside ( const Vector2 p) const

Check if a point lies inside the piecewise quadric curve closed contour.

The curve should be closed.

See also
Intersections
Parameters
pPoint.

◆ Intersect()

bool QuadricCurve2Set::Intersect ( const Ray2 ray,
double &  t 
) const

Compute the first intersection between a ray and the curve.

Parameters
rayThe ray.
tReturned intersection depth.

◆ Intersections()

int QuadricCurve2Set::Intersections ( const Ray2 ray) const

Compute the number of intersections between a ray and a piecewize quadric curve.

Parameters
rayThe ray.

◆ operator+=()

QuadricCurve2Set & QuadricCurve2Set::operator+= ( const QuadricCurve2Set c)

Appends a piecewise cubic curve to an existing piecewise cubic curve.

Parameters
cArgument piecewise cubic curve.

◆ R()

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

This function returns the squared distance between a point and a set of quadric curves.

See also
QuadicCurve::R()
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.

◆ Sinuosity()

double QuadricCurve2Set::Sinuosity ( ) const

Compute the sinuosity.

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

◆ Translate()

void QuadricCurve2Set::Translate ( const Vector2 t)

Translate the curve.

Parameters
tTranslation vector.

◆ U()

int QuadricCurve2Set::U ( const double &  s,
double &  u 
) const

Compute the parameter of the curve corresponding to the input length.

Parameters
sInput length.
uParameter of the i-th curve.
Returns
Identifier of the curve in the piecewise definition.

◆ UV()

double QuadricCurve2Set::UV ( const Vector2 p,
double &  u,
double &  v,
int &  k 
) const

Compute the inverse mapping for a given input point.

Parameters
pPoint.
u,vInverse Coordinates, u will denote the position along the curve and v the signed distance to the curve.
kIndex defining the sub-curve element.