|
Core 1.0
|
Quadric polynomials. More...
#include <quadric.h>
Public Member Functions | |
| Quadric () | |
| Empty. | |
| Quadric (const double &, const double &, const double &) | |
| Creates a quadric. | |
| Quadric (const Linear &) | |
| Creates a quadric from a Linear polynomial. | |
| ~Quadric () | |
| Empty. | |
| constexpr double & | operator[] (int) |
| Access class components. | |
| constexpr double | operator[] (int) const |
| Overloaded. | |
| Quadric | operator- () const |
| Overloaded. | |
| Quadric & | operator+= (const Quadric &) |
| Destructive sum of two polynomials. | |
| Quadric & | operator-= (const Quadric &) |
| Destructive difference of two polynomials. | |
| Quadric & | operator*= (const double &) |
| Scale a polynomial by a double value. | |
| Quadric & | operator/= (const double &) |
| Scale a polynomial by a double value. | |
| constexpr double | operator() (const double &) const |
| Evaluates the quadric. | |
| constexpr double | Derivative (const double &) const |
| Computes the derivative value at a given point. | |
| Linear | Prime () const |
| Compute the derivative of a quadric, which is a linear expression. | |
| int | Solve (double &, double &) const |
| Solve quadratic equations. | |
| int | Solve (double *) const |
| Solve quadratic equations. This function store the sorted roots in an array and returns the number of roots. | |
| int | Solve (double *, const double &, const double &) const |
| Solve the quadratic equation over a given interval. | |
| void | Range (double &, double &, const double &=0.0, const double &=1.0) const |
| This function computes the range of values taken by a quadric over a given interval. | |
| double | Maximum (const double &=0.0, const double &=1.0) const |
| This function computes the maximum value taken by a quadric over a given interval. | |
| double | Minimum (const double &=0.0, const double &=1.0) const |
| This function computes the minimum value taken by a quadric over a given interval. | |
| double | K (const double &, const double &) const |
| Compute the Lipschitz constant of the quadric. | |
Static Public Member Functions | |
| static Quadric | Bezier (const double &, const double &, const double &) |
| Creates a quadratic Bezier polynomial on interval [0,1]. | |
| static double | Smooth (const double &, const double &) |
| Compute the value of the C1 smooth interpolating function (1-x/r)2. | |
| static double | Smooth (const double &) |
| Compute the value of the C1 smooth interpolating function (1-x)2. | |
| static double | SmoothCompact (const double &, const double &) |
| Compact support version of the smooth interpolating function Quadric::Smooth(). | |
| static double | SmoothCompact (const double &, const double &, const double &) |
| Compact support version of the smooth interpolating function Quadric::Smooth() with interior and exterior radii. | |
| static double | Warp (const double &) |
| Unit interval warping function. | |
| static Quadric | Bernstein (int) |
| Creates a quadric Bernstein polynomial. | |
| static double | Bernstein (int, const double &) |
| Compute the quadric Bernstein polynomial for a given value. | |
| static Quadric | FromRoots (const QVector< double > &) |
| Create a quadric from a set of roots. | |
Static Public Attributes | |
| static double | epsilon = 1.0e-16 |
| Epsilon value used to check b2-4ac term in the root finding process. | |
Protected Attributes | |
| double | c [3] = { 0.0,0.0,0.0 } |
| Array of coefficients. | |
Friends | |
| Quadric | operator+ (const Quadric &u, const Quadric &v) |
| Overloaded. | |
| Quadric | operator- (const Quadric &v, const Quadric &u) |
| Overloaded. | |
| Quadric | operator* (const Quadric &p, const double &e) |
| Multiply a quadric by a scalar value. | |
| Quadric | operator* (const double &a, const Quadric &p) |
| Overloaded. | |
| Quadric | operator/ (const Quadric &p, const double &a) |
| Overloaded. | |
| Quadric | operator* (const Linear &u, const Linear &v) |
| Multiply two linear polynomials. | |
| std::ostream & | operator<< (std::ostream &s, const Quadric &p) |
| Overloaded output-stream operator. | |
Quadric polynomials.
Constructors should provide the coefficients in descending order. is an example of how to code the quadric 2 x2-x+1:
|
static |
Creates a quadric Bernstein polynomial.
| p | p-th polynomial. |
|
static |
Compute the quadric Bernstein polynomial for a given value.
| p | p-th polynomial. |
| x | Real. |
|
static |
Creates a quadratic Bezier polynomial on interval [0,1].
| a,b,c | The parameters of the Bézier polynomial. |
Parameters are as follows:
c(t)=a (1-t)2+2b t(1-t)+c t2=(a-2b+c) t2+2(b-a) t+a
|
inlineconstexpr |
Computes the derivative value at a given point.
If only one evaluation is to be made, this function is more efficient than Prime() and then evaluating the derivative for a given input value.
| x | Real. |
|
static |
Create a quadric from a set of roots.
| r | Set of roots. |
Example of how to code the quadric (x-2)(x+1):
| double Quadric::K | ( | const double & | a, |
| const double & | b ) const |
Compute the Lipschitz constant of the quadric.
| a,b | Interval. |
| double Quadric::Maximum | ( | const double & | a = 0.0, |
| const double & | b = 1.0 ) const |
This function computes the maximum value taken by a quadric over a given interval.
| a,b | Interval. |
| double Quadric::Minimum | ( | const double & | a = 0.0, |
| const double & | b = 1.0 ) const |
This function computes the minimum value taken by a quadric over a given interval.
| a,b | Interval. |
|
inline |
Compute the derivative of a quadric, which is a linear expression.
| void Quadric::Range | ( | double & | x, |
| double & | y, | ||
| const double & | a = 0.0, | ||
| const double & | b = 1.0 ) const |
This function computes the range of values taken by a quadric over a given interval.
Bascially computes the roots of the first derivative, and evaluates the polynomial at the roots if they are within the interval bounds.
| a,b | Interval. |
| x,y | Returned range. |
|
inlinestatic |
Compute the value of the C1 smooth interpolating function (1-x)2.
| x | Argument value. |
|
inlinestatic |
Compute the value of the C1 smooth interpolating function (1-x/r)2.
| x | Argument value. |
| r | Radius. |
|
inlinestatic |
Compact support version of the smooth interpolating function Quadric::Smooth().
Return Quadric::Smooth(x/r) if x<r and 0 otherwise.
| x | Argument value. |
| r | Radius. |
|
inlinestatic |
Compact support version of the smooth interpolating function Quadric::Smooth() with interior and exterior radii.
| x | Argument value. |
| i,e | Interior and exterior radii. |
| int Quadric::Solve | ( | double & | u, |
| double & | v ) const |
Solve quadratic equations.
This function uses two double arguments to store the roots and returns the number of roots.
| u,v | The two of roots, if they exist. |
| int Quadric::Solve | ( | double * | y | ) | const |
Solve quadratic equations. This function store the sorted roots in an array and returns the number of roots.
| y | The array of roots. |
| int Quadric::Solve | ( | double * | roots, |
| const double & | a, | ||
| const double & | b ) const |
Solve the quadratic equation over a given interval.
This function store the sorted roots in an array and returns the number of roots.
| roots | The array of roots. |
| a,b | The interval. |
|
inlinestatic |
Unit interval warping function.
Remaps the unit interval into the unit interval by expanding the sides and compressing the center, keeping 1/2 mapped to 1/2.
| x | Real in [0,1]. |
|
friend |
Overloaded output-stream operator.
| s | Stream. |
| p | The quadric. |