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

Quadric curves. More...

#include <curve.h>

Public Member Functions

 QuadricCurve ()
 Empty.
 
 QuadricCurve (const Quadric &, const Quadric &, const Quadric &)
 Creates a quadric curve. More...
 
 ~QuadricCurve ()
 Empty.
 
Quadricoperator[] (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. More...
 
Vector Eval (const double &) const
 Computes the point on the curve. More...
 
double Curvature (const double &) const
 Computes the curvature. More...
 
Vector Tangent (const double &) const
 Computes the tangent to the curve. More...
 
Vector Normal (const double &) const
 Computes the secondary derivative to the curve. More...
 
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. More...
 
double S (const double &, int=256) const
 Compute the curvilign absisca of a point on the curve. More...
 
double U (const double &, int=256) const
 Compute the parameter corresponding to the argument curvilign absisca of a point on the curve. More...
 
double LengthIntegral (const double &, const double &) const
 Computes the length of the quadric curve over interval [a,b] using a closed form integral. More...
 
double Length (int=256) const
 Computes the length of the cubic curve. More...
 
double Length (const double &, const double &, int=256) const
 Computes the length of the quadric curve over interval [a,b]. More...
 
Matrix GetMatrix (const double &) const
 Compute the Frenet vectors at a given point on the curve. More...
 
Frame GetFrame (const double &) const
 Compute the Frenet frame at a given point on the curve. More...
 

Static Public Member Functions

static QuadricCurve Bezier (const Vector &, const Vector &, const Vector &)
 Create a quadratic Bezier curve on interval [0,1]. More...
 
static QVector< QuadricCurveBezier (const QVector< Vector > &)
 Create a set of quadratic Bezier curves. More...
 

Protected Attributes

Quadric z
 Quadric functions for every coordinate.
 

Friends

std::ostream & operator<< (std::ostream &, const QuadricCurve &)
 Overloaded. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ QuadricCurve()

QuadricCurve::QuadricCurve ( const Quadric x,
const Quadric y,
const Quadric z 
)
explicit

Creates a quadric curve.

Parameters
x,y,zQuadric parametric equations of the corresponding x, y, z coordinates.

Member Function Documentation

◆ Bezier() [1/2]

QVector< QuadricCurve > QuadricCurve::Bezier ( const QVector< Vector > &  c)
static

Create a set of quadratic Bezier curves.

Parameters
cControl points of the Bezier curve.

◆ Bezier() [2/2]

QuadricCurve QuadricCurve::Bezier ( const Vector a,
const Vector b,
const Vector c 
)
static

Create a quadratic Bezier curve on interval [0,1].

Parameters
a,b,cThe control points of the Bezier curve.

◆ Curvature()

double QuadricCurve::Curvature ( const double &  t) const

Computes the curvature.

Parameters
tParameter.

◆ Eval()

Vector QuadricCurve::Eval ( const double &  t) const

Computes the point on the curve.

This function is redundant with the operator().

Parameters
tParameter.

◆ GetFrame()

Frame QuadricCurve::GetFrame ( const double &  u) const

Compute the Frenet frame at a given point on the curve.

Parameters
uParameter.

◆ GetMatrix()

Matrix QuadricCurve::GetMatrix ( const double &  u) const

Compute the Frenet vectors at a given point on the curve.

The columns of the returned matrix contain the tangent, binormal and normal vectors.

Parameters
uParameter.

◆ Length() [1/2]

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.

Parameters
a,bInterval.
nDiscretization of the integration interval.

◆ Length() [2/2]

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.

Parameters
nDiscretization.

◆ LengthIntegral()

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.

Parameters
a,bInterval.

◆ Normal()

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.

◆ operator()()

Vector QuadricCurve::operator() ( const double &  t) const

Computes the point on the curve.

Parameters
tParameter.

◆ R()

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.

Parameters
pPoint.
uParameter defining the coordinate of the projection of the argument vertex onto the curve.

◆ S()

double QuadricCurve::S ( const double &  t,
int  n = 256 
) const

Compute the curvilign absisca of a point on the curve.

Parameters
tParameter.
nDiscretization of the integration interval.

◆ Tangent()

Vector QuadricCurve::Tangent ( const double &  t) const

Computes the tangent to the curve.

Parameters
tParameter.

◆ U()

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.

Parameters
sArgument curvilign absisca (should be between 0.0 and the length of the curve).
nDiscretization of the integration interval.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  s,
const QuadricCurve curve 
)
friend

Overloaded.

Parameters
sStream.
curveThe quadric curve.