Public Types | Public Member Functions | Private Member Functions | Private Attributes
CardinalSpline Class Reference

#include <CardinalSpline.h>

List of all members.

Public Types

typedef vnl_vector_fixed
< double, 3 > 
Vector3D

Public Member Functions

 CardinalSpline ()
 CardinalSpline (vcl_vector< Vector3D > &cPoints)
 CardinalSpline (const CardinalSpline &cs)
CardinalSplineoperator= (const CardinalSpline &cs)
 ~CardinalSpline ()
Vector3D getPoint (double t) const
 Returns the relevant point on the spline parameterised by t.
vcl_vector< Vector3DgetPoints (int num_points) const
 Return a list of points on the boundary of the curve.
vcl_vector< Vector3DgetControlPoints () const
void setT (double t)
Vector3D closest_point (const Vector3D &point) const
double closest_point_t (const Vector3D &point) const
 Return the t value of the closest point to the input point.
Vector3D firstDerivative (double t) const
 Gradient of the spline functions - ie $[d_c(x)/du d_c(y)/du d_c(z)/du]^T$.
Vector3D secondDerivative (double t) const
 Second derivative of the spline functions - ie $[d^2_c(x)/du^2 d^2_c(y)/du^2 d^2_c(z)/du^2]^T$.
Vector3D mean_control_pts () const
void b_write (vsl_b_ostream &os) const
void b_read (vsl_b_istream &os)
short version () const
void print_summary (vcl_ostream &os) const
vcl_string is_a () const
bool is_class (const vcl_string &s) const
bool operator== (const CardinalSpline &c) const
bool operator!= (const CardinalSpline &c) const
void translate (const Vector3D &t)

Private Member Functions

double distanceFunctionFirstDerivative (double t, const Vector3D &point) const
 Derivative of the distance function from a point to the curve at parameter t.
double distanceFunctionSecondDerivative (double t, const Vector3D &point) const
Vector3D getVal (const vnl_matrix_fixed< double, 1, 4 > &uvec, int pk) const
double convert_t (double t) const
void setMc (double s_)

Private Attributes

vcl_vector< Vector3DcontrolPoints
vnl_matrix< double > Mc
double s

Detailed Description

Definition at line 32 of file CardinalSpline.h.


Member Typedef Documentation

Definition at line 35 of file CardinalSpline.h.


Constructor & Destructor Documentation

CardinalSpline::CardinalSpline ( ) [inline]

Definition at line 36 of file CardinalSpline.h.

CardinalSpline::CardinalSpline ( vcl_vector< Vector3D > &  cPoints) [inline]

Definition at line 37 of file CardinalSpline.h.

CardinalSpline::CardinalSpline ( const CardinalSpline cs) [inline]

Definition at line 42 of file CardinalSpline.h.

CardinalSpline::~CardinalSpline ( ) [inline]

Definition at line 53 of file CardinalSpline.h.


Member Function Documentation

void CardinalSpline::b_read ( vsl_b_istream os)

Definition at line 226 of file CardinalSpline.cxx.

void CardinalSpline::b_write ( vsl_b_ostream os) const

Definition at line 219 of file CardinalSpline.cxx.

Vector3D CardinalSpline::closest_point ( const Vector3D point) const [inline]

Definition at line 59 of file CardinalSpline.h.

double CardinalSpline::closest_point_t ( const Vector3D point) const

Return the t value of the closest point to the input point.

This is calculated using Newton's method after an initial estimate is bracketed using the control points of the spline.

Definition at line 136 of file CardinalSpline.cxx.

double CardinalSpline::convert_t ( double  t) const [inline, private]

Definition at line 115 of file CardinalSpline.h.

double CardinalSpline::distanceFunctionFirstDerivative ( double  t,
const Vector3D point 
) const [private]

Derivative of the distance function from a point to the curve at parameter t.

Useful for finding the closest point to the curve.

Definition at line 113 of file CardinalSpline.cxx.

double CardinalSpline::distanceFunctionSecondDerivative ( double  t,
const Vector3D point 
) const [private]

Definition at line 122 of file CardinalSpline.cxx.

CardinalSpline::Vector3D CardinalSpline::firstDerivative ( double  t) const

Gradient of the spline functions - ie $[d_c(x)/du d_c(y)/du d_c(z)/du]^T$.

Definition at line 71 of file CardinalSpline.cxx.

vcl_vector<Vector3D> CardinalSpline::getControlPoints ( ) const [inline]

Definition at line 57 of file CardinalSpline.h.

CardinalSpline::Vector3D CardinalSpline::getPoint ( double  t) const

Returns the relevant point on the spline parameterised by t.

t should be between 0 and 1, 0 being the start of the curve, 1 at the end. Actually, in this implementation, it is a closed curve, so 0 and 1 will return the same point.

I am currently double checking this, I'm not convinced getPoint, firstDeriv etc work near t=0.0 and t=1.0

Definition at line 53 of file CardinalSpline.cxx.

vcl_vector< CardinalSpline::Vector3D > CardinalSpline::getPoints ( int  num_points) const

Return a list of points on the boundary of the curve.

This is intended for drawing the curve as a list of line segments.

Parameters:
intnum_points: the number of points to return.
Returns:
vcl_vector<Vector3D>: a list of points.

Definition at line 11 of file CardinalSpline.cxx.

CardinalSpline::Vector3D CardinalSpline::getVal ( const vnl_matrix_fixed< double, 1, 4 > &  uvec,
int  pk 
) const [private]

Definition at line 26 of file CardinalSpline.cxx.

vcl_string CardinalSpline::is_a ( ) const [inline]

Definition at line 87 of file CardinalSpline.h.

bool CardinalSpline::is_class ( const vcl_string &  s) const [inline]

Definition at line 88 of file CardinalSpline.h.

Vector3D CardinalSpline::mean_control_pts ( ) const [inline]

Definition at line 69 of file CardinalSpline.h.

bool CardinalSpline::operator!= ( const CardinalSpline c) const [inline]

Definition at line 100 of file CardinalSpline.h.

CardinalSpline& CardinalSpline::operator= ( const CardinalSpline cs) [inline]

Definition at line 44 of file CardinalSpline.h.

bool CardinalSpline::operator== ( const CardinalSpline c) const [inline]

Definition at line 96 of file CardinalSpline.h.

void CardinalSpline::print_summary ( vcl_ostream &  os) const [inline]

Definition at line 81 of file CardinalSpline.h.

CardinalSpline::Vector3D CardinalSpline::secondDerivative ( double  t) const

Second derivative of the spline functions - ie $[d^2_c(x)/du^2 d^2_c(y)/du^2 d^2_c(z)/du^2]^T$.

Definition at line 92 of file CardinalSpline.cxx.

void CardinalSpline::setMc ( double  s_) [inline, private]

Definition at line 123 of file CardinalSpline.h.

void CardinalSpline::setT ( double  t) [inline]

Definition at line 58 of file CardinalSpline.h.

void CardinalSpline::translate ( const Vector3D t) [inline]

Definition at line 104 of file CardinalSpline.h.

short CardinalSpline::version ( ) const [inline]

Definition at line 80 of file CardinalSpline.h.


Member Data Documentation

vcl_vector<Vector3D> CardinalSpline::controlPoints [private]

Definition at line 131 of file CardinalSpline.h.

vnl_matrix<double> CardinalSpline::Mc [private]

Definition at line 132 of file CardinalSpline.h.

double CardinalSpline::s [private]

Definition at line 133 of file CardinalSpline.h.


The documentation for this class was generated from the following files: