#include <BernsteinTetrahedralPoly.h>
Public Member Functions | |
BernsteinTetrahedralPoly () | |
Default constructor. | |
BernsteinTetrahedralPoly (int deg, const std::vector< double > &coefs) | |
Constructor. | |
template<typename ForwardIterator> | |
BernsteinTetrahedralPoly (int deg, ForwardIterator begin, ForwardIterator end) | |
Constructor. | |
BernsteinTetrahedralPoly (double coef) | |
Constructor for a constant polynomial. | |
int | degree () const |
Get the degree. | |
const double & | operator[] (int num) const |
Access function for coefficients. | |
double & | operator[] (int num) |
Access function for coefficients. | |
template<typename T> | |
T | operator() (const Array< T, 4 > &u) const |
Evaluation operator, based on the tetrahedral de Casteljau algorithm. | |
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 related to (but not identical to) the L1 norm of the polynomial. | |
void | deriv (int der, const Vector4D &d, BernsteinTetrahedralPoly &btp) const |
Calculates the der'th derivative in the d-direction in terms of a new BernsteinTetrahedralPoly. | |
template<typename T> | |
T | blossom (const std::vector< Array< T, 4 > > &uvec) const |
Evaluates the blossom of the polynomial. | |
BernsteinPoly | pickLine (const Array< double, 4 > &a, const Array< double, 4 > &b) const |
Routine that picks out the line with endpoints a and b as a new BernsteinPoly. | |
BernsteinTetrahedralPoly & | operator *= (const BernsteinTetrahedralPoly &poly) |
Multiplication with another polynomial. | |
BernsteinTetrahedralPoly & | operator *= (double c) |
Multiplication with a scalar. | |
BernsteinTetrahedralPoly & | operator+= (const BernsteinTetrahedralPoly &poly) |
Addition with another polynomial. | |
BernsteinTetrahedralPoly & | operator+= (double c) |
Addition with a scalar. | |
BernsteinTetrahedralPoly & | operator-= (const BernsteinTetrahedralPoly &poly) |
Subtraction with another polynomial. | |
BernsteinTetrahedralPoly & | operator-= (double c) |
Subtraction with a scalar. | |
BernsteinTetrahedralPoly & | operator/= (double c) |
Division with a scalar. | |
void | read (std::istream &is) |
Read from an input stream. | |
void | write (std::ostream &os) const |
Write to an output stream. |
The formula for a tetrahedral Bernstein polynomial of degree n is
The coefficients are stored in the following order: . That is, a reverse lexicographical ordering with the most significant index being the last one.
Definition at line 67 of file BernsteinTetrahedralPoly.h.
Go::BernsteinTetrahedralPoly::BernsteinTetrahedralPoly | ( | int | deg, | |
const std::vector< double > & | coefs | |||
) | [inline] |
Constructor.
deg | degree of the polynomial | |
coefs | vector of Bernstein coefficients |
Definition at line 74 of file BernsteinTetrahedralPoly.h.
Go::BernsteinTetrahedralPoly::BernsteinTetrahedralPoly | ( | int | deg, | |
ForwardIterator | begin, | |||
ForwardIterator | end | |||
) | [inline] |
Constructor.
deg | degree of the polynomial | |
begin | iterator to start of vector of Bernstein coefficients | |
end | iterator to end of vector of Bernstein coefficients |
Definition at line 82 of file BernsteinTetrahedralPoly.h.
Go::BernsteinTetrahedralPoly::BernsteinTetrahedralPoly | ( | double | coef | ) | [inline, explicit] |
Constructor for a constant polynomial.
coef | the constant value of the polynomial |
Definition at line 87 of file BernsteinTetrahedralPoly.h.
int Go::BernsteinTetrahedralPoly::degree | ( | ) | const [inline] |
Get the degree.
Definition at line 92 of file BernsteinTetrahedralPoly.h.
T Go::BernsteinTetrahedralPoly::operator() | ( | const Array< T, 4 > & | u | ) | const [inline] |
Evaluation operator, based on the tetrahedral de Casteljau algorithm.
Generalized from 'tri_decas' in Farin: "Curves and Surfaces for CAGD".
u | parameter point given in barycentric coordinates |
Definition at line 108 of file BernsteinTetrahedralPoly.h.
double Go::BernsteinTetrahedralPoly::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 over the tetrahedron, but is an upper bound for it.
void Go::BernsteinTetrahedralPoly::normalize | ( | ) |
void Go::BernsteinTetrahedralPoly::deriv | ( | int | der, | |
const Vector4D & | d, | |||
BernsteinTetrahedralPoly & | btp | |||
) | const |
Calculates the der'th derivative in the d-direction in terms of a new BernsteinTetrahedralPoly.
The direction is given in barycentric coordinates, so it is a vector whose elements sum to zero.
der | order of derivative requested | |
d | direction of derivative |
btp | the derivative polynomial |
T Go::BernsteinTetrahedralPoly::blossom | ( | const std::vector< Array< T, 4 > > & | uvec | ) | const [inline] |
Evaluates the blossom of the polynomial.
The blossom of the polynomial of degree n is a multi-affine, symmetric n-variate function that satisfies
uvec | the vector of values at which the blossom is evaluated, each value is a domain point given in barycentric coordinates. |
Definition at line 168 of file BernsteinTetrahedralPoly.h.
BernsteinPoly Go::BernsteinTetrahedralPoly::pickLine | ( | const Array< double, 4 > & | a, | |
const Array< double, 4 > & | 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
The function is implemented by blossoming.
a | the starting point of the line in barycentric coordinates | |
b | the endpoint of the line in barycentric coordinates |