#include <BernsteinTriangularPoly.h>
Public Member Functions | |
BernsteinTriangularPoly () | |
Default constructor. | |
BernsteinTriangularPoly (int deg, const std::vector< double > &coefs) | |
Constructor. | |
template<typename ForwardIterator> | |
BernsteinTriangularPoly (int deg, ForwardIterator begin, ForwardIterator end) | |
Constructor. | |
BernsteinTriangularPoly (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, 3 > &u) const |
Evaluation operator, based on the triangular 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 Vector3D &d, BernsteinTriangularPoly &btp) const |
Calculates the der'th derivative in the d-direction in terms of a new BernsteinTriangularPoly. | |
template<typename T> | |
T | blossom (const std::vector< Array< T, 3 > > &uvec) const |
Evaluates the blossom of the polynomial. | |
BernsteinTriangularPoly & | operator *= (const BernsteinTriangularPoly &poly) |
Multiplication with another polynomial. | |
BernsteinTriangularPoly & | operator *= (double c) |
Multiplication with a scalar. | |
BernsteinTriangularPoly & | operator+= (const BernsteinTriangularPoly &poly) |
Addition with another polynomial. | |
BernsteinTriangularPoly & | operator+= (double c) |
Addition with a scalar. | |
BernsteinTriangularPoly & | operator-= (const BernsteinTriangularPoly &poly) |
Subtraction with another polynomial. | |
BernsteinTriangularPoly & | operator-= (double c) |
Subtraction with a scalar. | |
BernsteinTriangularPoly & | 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 triangular Bernstein polynomial of degree n is
The coefficients are stored in the following order: .
Definition at line 62 of file BernsteinTriangularPoly.h.
Go::BernsteinTriangularPoly::BernsteinTriangularPoly | ( | int | deg, | |
const std::vector< double > & | coefs | |||
) | [inline] |
Constructor.
deg | degree of the polynomial | |
coefs | vector of Bernstein coefficients |
Definition at line 69 of file BernsteinTriangularPoly.h.
Go::BernsteinTriangularPoly::BernsteinTriangularPoly | ( | 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 77 of file BernsteinTriangularPoly.h.
Go::BernsteinTriangularPoly::BernsteinTriangularPoly | ( | double | coef | ) | [inline, explicit] |
Constructor for a constant polynomial.
coef | the constant value of the polynomial |
Definition at line 82 of file BernsteinTriangularPoly.h.
int Go::BernsteinTriangularPoly::degree | ( | ) | const [inline] |
Get the degree.
Definition at line 87 of file BernsteinTriangularPoly.h.
T Go::BernsteinTriangularPoly::operator() | ( | const Array< T, 3 > & | u | ) | const [inline] |
Evaluation operator, based on the triangular de Casteljau algorithm.
Adapted from 'tri_decas' in Farin: "Curves and Surfaces for CAGD".
u | parameter point given in barycentric coordinates |
Definition at line 103 of file BernsteinTriangularPoly.h.
double Go::BernsteinTriangularPoly::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 triangle, but is an upper bound for it.
void Go::BernsteinTriangularPoly::normalize | ( | ) |
void Go::BernsteinTriangularPoly::deriv | ( | int | der, | |
const Vector3D & | d, | |||
BernsteinTriangularPoly & | btp | |||
) | const |
Calculates the der'th derivative in the d-direction in terms of a new BernsteinTriangularPoly.
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::BernsteinTriangularPoly::blossom | ( | const std::vector< Array< T, 3 > > & | 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 160 of file BernsteinTriangularPoly.h.