Core 1.0
|
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< Vector2 > | GetDiscretisation (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... | |
QuadricCurve2Set & | operator+= (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< QuadricCurve2 > | curve |
Set of quadric curves. | |
QVector< double > | lengths |
Length of every curve (internal optimization) | |
double | length = 0.0 |
Total length (internal optimization) | |
Piecewise quadric curves.
This class stores an array of quadric curves.
|
explicit |
Creates the piecewise quadric curve given a set of control points.
p | Control vertices. |
|
explicit |
Create a set of quadric curves.
s | Set of quadric curves. |
|
explicit |
Creates a piecewise cubic curve in the plane from a similar curve.
c | Curve. |
void QuadricCurve2Set::Draw | ( | QGraphicsScene & | scene, |
const QPen & | pen = QPen() , |
||
const QBrush & | brush = QBrush() |
||
) | const |
Draw the curve.
The brush is not used.
scene | Graphics scene. |
pen | The pen. |
brush | The brush. |
QVector< Vector2 > QuadricCurve2Set::GetDiscretisation | ( | const double & | step | ) | const |
Generates a discretization of the curve with a linear curvilign absisca parameterization.
step | Step. |
|
inline |
Return the length of the sub-curve.
k | Curve index. |
bool QuadricCurve2Set::Inside | ( | const Vector2 & | p | ) | const |
Check if a point lies inside the piecewise quadric curve closed contour.
The curve should be closed.
p | Point. |
bool QuadricCurve2Set::Intersect | ( | const Ray2 & | ray, |
double & | t | ||
) | const |
Compute the first intersection between a ray and the curve.
ray | The ray. |
t | Returned intersection depth. |
int QuadricCurve2Set::Intersections | ( | const Ray2 & | ray | ) | const |
Compute the number of intersections between a ray and a piecewize quadric curve.
ray | The ray. |
QuadricCurve2Set & QuadricCurve2Set::operator+= | ( | const QuadricCurve2Set & | c | ) |
Appends a piecewise cubic curve to an existing piecewise cubic curve.
c | Argument piecewise cubic curve. |
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.
p | Point. |
u | Parameter defining the coordinate of the projection of the argument vertex onto the curve. |
k | Index of the curve for which the minimum distance was found. |
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.
void QuadricCurve2Set::Translate | ( | const Vector2 & | t | ) |
Translate the curve.
t | Translation vector. |
int QuadricCurve2Set::U | ( | const double & | s, |
double & | u | ||
) | const |
Compute the parameter of the curve corresponding to the input length.
s | Input length. |
u | Parameter of the i-th curve. |
double QuadricCurve2Set::UV | ( | const Vector2 & | p, |
double & | u, | ||
double & | v, | ||
int & | k | ||
) | const |
Compute the inverse mapping for a given input point.
p | Point. |
u,v | Inverse Coordinates, u will denote the position along the curve and v the signed distance to the curve. |
k | Index defining the sub-curve element. |