Core 1.0
|
Quadric curves. More...
#include <curve.h>
Public Member Functions | |
QuadricCurve () | |
Empty. | |
QuadricCurve (const Quadric &, const Quadric &, const Quadric &) | |
Creates a quadric curve. | |
~QuadricCurve () | |
Empty. | |
Quadric & | operator[] (int) |
Access curve components. | |
Quadric | operator[] (int) const |
Access curve components. | |
QuadricCurve | operator- () const |
Negates the coefficients of a quadric curve. | |
Vector | operator() (const double &) const |
Computes the point on the curve. | |
Vector | Eval (const double &) const |
Computes the point on the curve. | |
double | Curvature (const double &) const |
Computes the curvature of the curve at a given positon. | |
Vector | Tangent (const double &) const |
Computes the tangent to the curve. | |
Vector | Normal (const double &) const |
Computes the secondary derivative to the curve. | |
Box | GetBox () const |
Compute the bounding box of the quadric curve with parameter interval [0,1]. | |
double | R (const Vector &, double &) const |
Compute the squared distance between a point and the quadric curve. | |
double | Signed (const Vector &) const |
Compute signed squared distance between a point and the quadric curve. | |
double | S (const double &, int=256) const |
Compute the curvilign absisca of a point on the curve. | |
double | U (const double &, int=256) const |
Compute the parameter corresponding to the argument curvilign absisca of a point on the curve. | |
double | LengthIntegral (const double &, const double &) const |
Computes the length of the quadric curve over interval [a,b] using a closed form integral. | |
double | Length (int=256) const |
Computes the length of the cubic curve. | |
double | Length (const double &, const double &, int=256) const |
Computes the length of the quadric curve over interval [a,b]. | |
Matrix | GetMatrix (const double &, bool=false) const |
Compute the Frenet vectors at a given point on the curve. | |
Frame | GetFrame (const double &, bool=false) const |
Compute the Frenet frame at a given point on the curve. | |
QVector< Frame > | GetFrames (const double &, bool=false) const |
Compute the set of frames along the curve. | |
Static Public Member Functions | |
static QuadricCurve | Bezier (const Vector &, const Vector &, const Vector &) |
Create a quadratic Bezier curve on interval [0,1]. | |
static QVector< QuadricCurve > | Bezier (const QVector< Vector > &) |
Create a set of quadratic Bezier curves. | |
Protected Attributes | |
Quadric | z |
Quadric functions for every coordinate. | |
Friends | |
std::ostream & | operator<< (std::ostream &s, const QuadricCurve &curve) |
Overloaded. | |
Quadric curves.
Quadric curves are implemented with three quadric polynomials defining the coordinates of the points on the curve. It is a minimum storage class in the sense that it does not keep extra constant data for accelerating the computation of the bounding box of the quadric curve parameterized over the unit interval [0,1], or the distance between a point an the curve.
Creates a quadric curve.
x,y,z | Quadric parametric equations of the corresponding x, y, z coordinates. |
|
static |
Create a set of quadratic Bezier curves.
c | Control points of the Bezier curve. |
|
static |
Create a quadratic Bezier curve on interval [0,1].
a,b,c | The control points of the Bezier curve. |
double QuadricCurve::Curvature | ( | const double & | t | ) | const |
Computes the curvature of the curve at a given positon.
t | Parameter. |
Vector QuadricCurve::Eval | ( | const double & | t | ) | const |
Computes the point on the curve.
This function is redundant with the operator().
t | Parameter. |
Frame QuadricCurve::GetFrame | ( | const double & | u, |
bool | vertical = false ) const |
Compute the Frenet frame at a given point on the curve.
u | Parameter. |
vertical | Boolean, set to true to compute frame along the horizontal curve first, false (default) otherwise. |
QVector< Frame > QuadricCurve::GetFrames | ( | const double & | step, |
bool | vertical = false ) const |
Compute the set of frames along the curve.
step | Distance beween samples. |
vertical | Boolean, set to true to compute frame along the horizontal curve first, false (default) otherwise. |
Matrix QuadricCurve::GetMatrix | ( | const double & | u, |
bool | vertical = false ) const |
Compute the Frenet vectors at a given point on the curve.
The columns of the returned matrix contain the tangent, normal and binormal vectors.
u | Parameter. |
vertical | Boolean, set to true to compute frame along the horizontal curve first, false (default) otherwise. |
double QuadricCurve::Length | ( | const double & | a, |
const double & | b, | ||
int | n = 256 ) const |
Computes the length of the quadric curve over interval [a,b].
Since we have the parametric equations of the coordinates of the points on the curve, then the length is the integral of the square root of the sum of the squared derivatives where the limits of integration are [a,b].
s = Integral Sqrt((dx/dt)2 + (dy/dt)2) dt,
In the general case, the function we end up with is not integrable in closed form, leading to an elliptic integral or some such. Thus we evaluate the integral numerically.
a,b | Interval. |
n | Discretization of the integration interval. |
double QuadricCurve::Length | ( | int | n = 256 | ) | const |
Computes the length of the cubic curve.
Integration is performed over interval [0,1] using a uniform discretization.
n | Discretization. |
double QuadricCurve::LengthIntegral | ( | const double & | a, |
const double & | b ) const |
Computes the length of the quadric curve over interval [a,b] using a closed form integral.
a,b | Interval. |
Vector QuadricCurve::Normal | ( | const double & | ) | const |
Computes the secondary derivative to the curve.
Note that although the parameter has no influence over the secondary derivative for quadric curves, it is still there out of closed form consistency.
Vector QuadricCurve::operator() | ( | const double & | t | ) | const |
Computes the point on the curve.
t | Parameter. |
double QuadricCurve::R | ( | const Vector & | p, |
double & | u ) const |
Compute the squared distance between a point and the quadric curve.
This function computes the projection of a point p onto the curve by minimizing the distance function along the curve, expressed as a cubic polynomial.
Most of the coefficients of this cubic polynomial are constant, and could be pre-processed in the constructor.
Warning This function does not work if the quadric degenerates to a linear curve.
p | Point. |
u | Parameter defining the coordinate of the projection of the argument vertex onto the curve. |
double QuadricCurve::S | ( | const double & | t, |
int | n = 256 ) const |
Compute the curvilign absisca of a point on the curve.
t | Parameter. |
n | Discretization of the integration interval. |
double QuadricCurve::Signed | ( | const Vector & | p | ) | const |
Compute signed squared distance between a point and the quadric curve.
Simply compute the square root of the squared distance.
p | Point. |
Vector QuadricCurve::Tangent | ( | const double & | t | ) | const |
Computes the tangent to the curve.
t | Parameter. |
double QuadricCurve::U | ( | const double & | s, |
int | n = 256 ) const |
Compute the parameter corresponding to the argument curvilign absisca of a point on the curve.
s | Argument curvilign absisca (should be between 0.0 and the length of the curve). |
n | Discretization of the integration interval. |
|
friend |
Overloaded.
s | Stream. |
curve | The quadric curve. |