Go::BernsteinMulti Class Reference
[Implicitization]

Class that implements bivariate tensor product Bernstein polynomials on the domain [0,1]x[0,1]. More...

#include <BernsteinMulti.h>

List of all members.

Public Member Functions

 BernsteinMulti ()
 Default constructor.
 BernsteinMulti (int m, int n, const std::vector< double > &coefs)
 Constructor.
template<typename ForwardIterator>
 BernsteinMulti (int m, int n, ForwardIterator begin, ForwardIterator end)
 Constructor.
 BernsteinMulti (double coef)
 Constructs a constant polynomial.
int degreeU () const
 Get the degree in the first parameter direction.
int degreeV () const
 Get the degree in the second parameter direction.
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 u, double v) const
 Evaluation operator, based on the de Casteljau algorithm.
double operator() (const Vector2D &pt) const
 Evaluation operator - as above, but taking the arguments in a Vector2D.
double operator() (const std::vector< double > &pt) const
 Evaluation operator - as above, but taking the arguments in a std::vector.
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 polynomial is strictly positive.
bool isStrictlyNegative (const double eps=0.0) const
 Check if polynomial is strictly negative.
bool isNonNegative (const double eps=0.0) const
 Check if polynomial is non-negative.
double norm () const
 Calculates the norm of the polynomial, defined as the sum of 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.
double mean () const
 Calculates the mean value of the coefficients.
BernsteinMulti deriv (int der1, int der2) const
 Finds the derivative of the polynomial in terms of a new BernsteinMulti.
BernsteinMulti detHess () const
 Calculates the determinant of the Hessian as a BernsteinMulti Describes Gaussian curvature of the graph of the polynomial.
BernsteinMulti traceHess () const
 Calculates the trace of the Hessian as a BernsteinMUlti Describes mean curvature (modulo a factor 2) of the graph of the polynomial.
double blossom (const std::vector< double > &uvec, const std::vector< double > &vvec) const
 Evaluates the blossom of the polynomial.
BernsteinMulti pickDomain (double u0, double u1, double v0, double v1) const
 Finds a new BernsteinMulti representing the original on some rectangular domain.
BernsteinPoly pickLine (Array< double, 2 > a, Array< double, 2 > b) const
 Routine that picks out the line with endpoints a and b as a new BernsteinPoly.
void degreeElevate (int du, int dv)
 Degree elevation.
BernsteinMultioperator *= (const BernsteinMulti &multi)
 Multiplication with another polynomial.
BernsteinMultioperator *= (double c)
 Multiplication with a scalar.
BernsteinMultioperator+= (const BernsteinMulti &multi)
 Addition with another polynomial.
BernsteinMultioperator+= (double c)
 Addition with a scalar.
BernsteinMultioperator-= (const BernsteinMulti &multi)
 Subtraction with another polynomial.
BernsteinMultioperator-= (double c)
 Subtraction with a scalar.
BernsteinMultioperator/= (double c)
 Division with a scalar.
BernsteinPoly bindU (double u) const
 Function that "binds" the u-parameter.
BernsteinPoly bindV (double v) const
 Function that "binds" the v-parameter.
void read (std::istream &is)
 Read from an input stream.
void write (std::ostream &os) const
 Write to an output stream.


Detailed Description

Class that implements bivariate tensor product Bernstein polynomials on the domain [0,1]x[0,1].

The formula for a degree (m,n) polynomial is

\[ p(u,v) = \sum_{i=0}^m \sum_{j=0}^n B_i(u) B_j(v) c_{ij} \]

where the basis functions in the first parameter direction are defined by

\[ B_i(u) = {m \choose i} u^i(1-u)^{n-i} \]

The coefficients $c_{ij}$ are stored in the following order: $ c_{00}, c_{10}, c_{20}, \ldots c_{mn} $.

Definition at line 67 of file BernsteinMulti.h.


Constructor & Destructor Documentation

Go::BernsteinMulti::BernsteinMulti ( int  m,
int  n,
const std::vector< double > &  coefs 
) [inline]

Constructor.

Parameters:
m degree in the first parameter direction
n degree in the second parameter direction
coefs vector of Bernstein coefficients

Definition at line 75 of file BernsteinMulti.h.

template<typename ForwardIterator>
Go::BernsteinMulti::BernsteinMulti ( int  m,
int  n,
ForwardIterator  begin,
ForwardIterator  end 
) [inline]

Constructor.

Parameters:
m degree in the first parameter direction
n degree in the second parameter direction
begin iterator to start of container with Bernstein coefficients
end iterator to end of container

Definition at line 89 of file BernsteinMulti.h.

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

Constructs a constant polynomial.

Parameters:
coef the constant value of the polynomial

Definition at line 94 of file BernsteinMulti.h.


Member Function Documentation

int Go::BernsteinMulti::degreeU (  )  const [inline]

Get the degree in the first parameter direction.

Returns:
the degree in the first parameter direction

Definition at line 99 of file BernsteinMulti.h.

int Go::BernsteinMulti::degreeV (  )  const [inline]

Get the degree in the second parameter direction.

Returns:
the degree in the second parameter direction

Definition at line 103 of file BernsteinMulti.h.

double Go::BernsteinMulti::operator() ( double  u,
double  v 
) const

Evaluation operator, based on the de Casteljau algorithm.

Parameters:
u first parameter
v second parameter
Returns:
the value of the polynomial at (u,v)

double Go::BernsteinMulti::operator() ( const Vector2D &  pt  )  const [inline]

Evaluation operator - as above, but taking the arguments in a Vector2D.

Parameters:
pt parameter point
Returns:
the value of the polynomial at pt

Definition at line 134 of file BernsteinMulti.h.

double Go::BernsteinMulti::operator() ( const std::vector< double > &  pt  )  const [inline]

Evaluation operator - as above, but taking the arguments in a std::vector.

Parameters:
pt parameter point
Returns:
the value of the polynomial at pt

Definition at line 140 of file BernsteinMulti.h.

bool Go::BernsteinMulti::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::BernsteinMulti::isStrictlyPositive ( const double  eps = 0.0  )  const

Check if polynomial is strictly positive.

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

bool Go::BernsteinMulti::isStrictlyNegative ( const double  eps = 0.0  )  const

Check if polynomial is strictly negative.

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

bool Go::BernsteinMulti::isNonNegative ( const double  eps = 0.0  )  const

Check if polynomial is non-negative.

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

double Go::BernsteinMulti::norm (  )  const

Calculates the norm of the polynomial, defined as the sum of 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 domain [0,1]x[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::BernsteinMulti::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()

BernsteinMulti Go::BernsteinMulti::deriv ( int  der1,
int  der2 
) const

Finds the derivative of the polynomial in terms of a new BernsteinMulti.

Parameters:
der1 the order of derivatives requested in the first parameter direction
der2 the order of derivatives requested in the second parameter direction
Returns:
a new polynomial q given by

\[ q(u,v) = D^{(der1,der2)}p(u,v). \]

double Go::BernsteinMulti::blossom ( const std::vector< double > &  uvec,
const std::vector< double > &  vvec 
) const

Evaluates the blossom of the polynomial.

The blossom of the polynomial $p$ of degree (m,n) is a multi-affine (m+n)-variate function $B_p$ that satisfies

\[ /// B_p(\underbrace{u, \ldots, u}_m, \underbrace{v, \ldots, v}_n) /// = p(u,v) /// \]

and is symmetric in the first m and last n arguments separately.

Parameters:
uvec the vector of values at which the blossom is evaluated in the first parameter direction
vvec the vector of values at which the blossom is evaluated in the second parameter direction
Returns:
the value of the blossom at (uvec,vvec)

BernsteinMulti Go::BernsteinMulti::pickDomain ( double  u0,
double  u1,
double  v0,
double  v1 
) const

Finds a new BernsteinMulti representing the original on some rectangular domain.

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

\[ /// q(u,v) = p((1-u) \cdot u_0 + u \cdot u_1, (1-v) \cdot v_0 + v /// \cdot v_1). /// \]

The function is implemented by blossoming.

Parameters:
u0 the start of the interval in the first parameter direction
u1 the end of the interval in the first parameter direction
v0 the start of the interval in the second parameter direction
v1 the end of the interval in the second parameter direction
Returns:
a polynomial q as specified above

BernsteinPoly Go::BernsteinMulti::pickLine ( Array< double, 2 >  a,
Array< double, 2 >  b 
) const

Routine that picks out the line with endpoints a and b as a new BernsteinPoly.

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

\[ q(t) = p((1-t)a_0 + tb_0, (1-t)a_1 + tv_1). \]

The function is implemented by blossoming.

void Go::BernsteinMulti::degreeElevate ( int  du,
int  dv 
)

Degree elevation.

Parameters:
du the polynomial degree in which you want to represent this polynomial in the first parameter direction
dv the polynomial degree in which you want to represent this polynomial in the second parameter direction

BernsteinPoly Go::BernsteinMulti::bindU ( double  u  )  const

Function that "binds" the u-parameter.

Returns:
a BernsteinPoly in the v-direction for a constant value of u.

BernsteinPoly Go::BernsteinMulti::bindV ( double  v  )  const

Function that "binds" the v-parameter.

Returns:
a BernsteinPoly in the u-direction for a constant value of v.


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