Go::BernsteinPoly Class Reference
[Implicitization]

Class that implements Bernstein polynomials on the interval [0,1]. More...

#include <BernsteinPoly.h>

List of all members.

Public Member Functions

 BernsteinPoly ()
 Default constructor.
 BernsteinPoly (const std::vector< double > &coefs)
 Constructor.
template<typename ForwardIterator>
 BernsteinPoly (ForwardIterator begin, ForwardIterator end)
 Constructor.
 BernsteinPoly (double coef)
 Constructor for a constant polynomial.
int degree () const
 Get the degree of the polynomial.
const double & operator[] (int num) const
 Access function for coefficients.
double & operator[] (int num)
 Access function for coefficients.
std::vector< double >::iterator coefsBegin ()
 Access function for coefficients.
std::vector< double >::const_iterator coefsBegin () const
 Access function for coefficients.
std::vector< double >::iterator coefsEnd ()
 Access function for coefficients.
std::vector< double >::const_iterator coefsEnd () const
 Access function for coefficients.
double operator() (double t) const
 Evaluation operator, based on the de Casteljau algorithm.
bool isZero (const double eps=0.0) const
 Check if the polynomial is the zero function.
bool isStrictlyPositive (const double eps=0.0) const
 Check if the polynomial is strictly positive.
double norm () const
 Calculates a norm, defined as the sum of the absolute values of the coefficients divided by the number of coefficients.
void normalize ()
 Normalizes the polynomial by dividing all coefficients with norm(), which is close to (but not identical to) the L1 norm of the polynomial.
BernsteinPoly deriv (int der) const
 Calculates the derivative in terms of a new BernsteinPoly.
double integral (double a=0.0, double b=1.0) const
 Calculates the integral of the polynomial over an interval.
double blossom (const std::vector< double > &tvec) const
 Evaluates the blossom of the polynomial.
BernsteinPoly pickInterval (double a, double b) const
 Finds a new BernsteinPoly representing the original on some interval.
void degreeElevate (int d)
 Degree elevation.
BernsteinPolyoperator *= (const BernsteinPoly &poly)
 Multiplication with another polynomial.
BernsteinPolyoperator *= (double c)
 Multiplication with a scalar.
BernsteinPolyoperator+= (const BernsteinPoly &poly)
 Addition with another polynomial.
BernsteinPolyoperator+= (double c)
 Addition with a scalar.
BernsteinPolyoperator-= (const BernsteinPoly &poly)
 Subtraction with another polynomial.
BernsteinPolyoperator-= (double c)
 Subtraction with a scalar.
BernsteinPolyoperator/= (double c)
 Division with a scalar.
void read (std::istream &is)
 Read from input stream.
void write (std::ostream &os) const
 Write to output stream.


Detailed Description

Class that implements Bernstein polynomials on the interval [0,1].

The formula for Bernstein polynomials is

\[ p(t) = \sum_{i=0}^n {n \choose i} t^i(1-t)^{n-i}c_i. \]

The coefficients $c_i$ are stored in a vector of doubles.

Definition at line 54 of file BernsteinPoly.h.


Constructor & Destructor Documentation

Go::BernsteinPoly::BernsteinPoly ( const std::vector< double > &  coefs  )  [inline, explicit]

Constructor.

Parameters:
coefs a vector of doubles containing the Bernstein coefficients

Definition at line 61 of file BernsteinPoly.h.

template<typename ForwardIterator>
Go::BernsteinPoly::BernsteinPoly ( ForwardIterator  begin,
ForwardIterator  end 
) [inline]

Constructor.

Parameters:
begin iterator to start of container containing the Bernstein coefficients
end iterator to end of same container

Definition at line 68 of file BernsteinPoly.h.

Go::BernsteinPoly::BernsteinPoly ( double  coef  )  [inline, explicit]

Constructor for a constant polynomial.

Parameters:
coef the constant value of the polynomial

Definition at line 72 of file BernsteinPoly.h.


Member Function Documentation

int Go::BernsteinPoly::degree (  )  const [inline]

Get the degree of the polynomial.

Returns:
the degree of the polynomial

Definition at line 77 of file BernsteinPoly.h.

double Go::BernsteinPoly::operator() ( double  t  )  const

Evaluation operator, based on the de Casteljau algorithm.

Parameters:
t the parameter value at which the polynomial is evaluated
Returns:
the value of the polynomial at t

bool Go::BernsteinPoly::isZero ( const double  eps = 0.0  )  const

Check if the polynomial is the zero function.

Parameters:
eps the threshold value with which every coefficient is compared
Returns:
true if for every coefficient c, $|c| <= eps$, false otherwise

bool Go::BernsteinPoly::isStrictlyPositive ( const double  eps = 0.0  )  const

Check if the polynomial is strictly positive.

NOTE: If the return value is 'true', then the polynomial is guaranteed to be strictly positive. If the return value is 'false', the situation is undetermined and the polynomial may still be strictly positive.

Parameters:
eps the threshold value with which every coefficient is compared
Returns:
true if for every coefficient c, $c > eps$, false otherwise

double Go::BernsteinPoly::norm (  )  const

Calculates a norm, defined as the sum of the absolute values of the coefficients divided by the number of coefficients.

This norm is not the same as the L1 norm of the polynomial (on the interval [0,1]), unless the polynomial does not change sign. In any case this norm is greater than or equal to the L1 norm of the polynomial.

void Go::BernsteinPoly::normalize (  ) 

Normalizes the polynomial by dividing all coefficients with norm(), which is close to (but not identical to) the L1 norm of the polynomial.

See also:
norm()

BernsteinPoly Go::BernsteinPoly::deriv ( int  der  )  const

Calculates the derivative in terms of a new BernsteinPoly.

Parameters:
der the order of derivatives requested
Returns:
a new polynomial q given by

\[ q(t) = p^{(der)}(t). \]

double Go::BernsteinPoly::integral ( double  a = 0.0,
double  b = 1.0 
) const

Calculates the integral of the polynomial over an interval.

The default interval is [0,1].

double Go::BernsteinPoly::blossom ( const std::vector< double > &  tvec  )  const

Evaluates the blossom of the polynomial.

The blossom of the polynomial $p$ of degree n is a multi-affine n-variate symmetric function $B_p$ that satisfies $B_p(t,\ldots,t) = /// p(t)$.

Parameters:
tvec the vector of values at which the blossom is evaluated.
Returns:
the value of the blossom at tvec

BernsteinPoly Go::BernsteinPoly::pickInterval ( double  a,
double  b 
) const

Finds a new BernsteinPoly representing the original on some interval.

The new polynomial is defined on [0,1]. If p is the old polynomial and q is the new one, q is defined by

\[ q(t) = p(a(1-t) + tb). \]

Parameters:
a the start of the interval
b the end of the interval
Returns:
a polynomial q as specified above

void Go::BernsteinPoly::degreeElevate ( int  d  ) 

Degree elevation.

Parameters:
d the polynomial degree in which you want to represent this polynomial.


The documentation for this class was generated from the following file:
Generated on Mon Jun 11 15:13:16 2007 for GoTools Implicitization Library by  doxygen 1.5.1