|
|
| Cubic () |
| | Empty.
|
| | Cubic (const double &, const double &, const double &, const double &) |
| | Creates a cubic.
|
|
| Cubic (const Quadric &) |
| | Creates a cubic given a quadric.
|
|
| ~Cubic () |
| | Empty.
|
|
constexpr double & | operator[] (int) |
| | Access class components.
|
|
constexpr double | operator[] (int) const |
| | Overloaded.
|
|
int | CheckDegree () const |
| | Check the degree of the cubic.
|
|
Cubic | operator- () const |
| | Unary.
|
|
Cubic & | operator+= (const Cubic &) |
| | Destructive sum of two cubics.
|
|
Cubic & | operator-= (const Cubic &) |
| | Destructive difference of two cubics.
|
|
Cubic & | operator*= (const double &) |
| | Scale a cubic by a double value.
|
|
Cubic & | operator/= (const double &) |
| | Scale a cubic by a double value.
|
| Cubic | operator+ (const double &) const |
| | Add a constant to a cubic.
|
| constexpr double | operator() (const double &) const |
| | Evaluates the cubic.
|
| constexpr double | Derivative (const double &) const |
| | Computes the derivative of the cubic.
|
|
Quadric | Prime () const |
| | Computes the first derivative of a cubic, which is a quadric.
|
|
Linear | Second () const |
| | Computes the second derivative of a cubic, which is a linear polynomial.
|
| int | Solve (double *) const |
| | Solve the cubic equation.
|
| int | Solve (double *, const double &, const double &) const |
| | Search the roots of a polynomial equation over a given interval.
|
| int | SolveNormalized (double *) const |
| | Solve a normalized cubic equation.
|
| void | Range (double &, double &, const double &=0.0, const double &=1.0) const |
| | Compute the range of values taken by the cubic over a given interval.
|
| double | K (const double &, const double &) const |
| | Compute the Lipschitz constant of the cubic.
|
|
| static Cubic | Compose (const Cubic &, const Linear &) |
| | Compose the cubic by a linear.
|
| static Cubic | Hermite (const double &, const double &, const double &, const double &) |
| | Creates an Hermite cubic polynomial.
|
| static Cubic | Bezier (const double &, const double &, const double &, const double &) |
| | Creates a cubic Bezier polynomial.
|
| static Cubic | Spline (const double &, const double &, const double &, const double &) |
| | Creates a cubic Spline polynomial.
|
| static double | Interpolation (const double &, const double &, const double &, const double &, const double &) |
| | Cubic (Catmull-Rom) interpolation based on four consecutive values.
|
| static double | Smooth (const double &, const double &) |
| | Compute the value of a \( C^2 \) smooth interpolating function \( (1-x/r)^3 \).
|
| static double | SmoothCompact (const double &, const double &) |
| | Compactly supported smooth interpolating function.
|
| static double | SmoothCompact (const double &, const double &, const double &) |
| | Compactly supported smooth interpolating function.
|
| static double | Smooth (const double &) |
| | Compute the value of a \( C^1 \) smooth interpolating function.
|
| static double | SmoothDerivative (const double &) |
| | Compute the derivative of the smooth cubic Cubic::Smooth().
|
| static double | SmoothStep (const double &, const double &, const double &) |
| | Compute a smooth cubic step.
|
| static double | Gaussian (const double &, const double &, const double &) |
| | Compute a compactly supported Gaussian-like pulse.
|
| static double | GaussianThick (const double &, const double &, const double &, const double &) |
| | Compute a compactly supported Gaussian-like pulse with a thick plateau.
|
| static double | Sigmoid (const double &, const double &, const double &) |
| | Compute the value of a compactly supported sigmoid-shaped symmetric cubic.
|
| static double | Warp (const double &) |
| | Unit interval warping function.
|
| static Cubic | Bernstein (int) |
| | Creates a cubic Bernstein polynomial.
|
| static double | Bernstein (int, const double &) |
| | Compute the cubic Bernstein polynomial for a given value.
|
|
|
Cubic | operator+ (const Cubic &u, const Cubic &v) |
| | Overloaded.
|
|
Cubic | operator- (const Cubic &v, const Cubic &u) |
| | Overloaded.
|
|
Cubic | operator* (const Cubic &u, const double &e) |
| | Multiply a cubic by a scalar value.
|
|
Cubic | operator* (const double &a, const Cubic &p) |
| | Overloaded.
|
|
Cubic | operator/ (const Cubic &p, const double &a) |
| | Overloaded.
|
| Cubic | operator* (const Quadric &q, const Linear &l) |
| | Multiply a quadric by a linear polynomial.
|
| std::ostream & | operator<< (std::ostream &s, const Cubic &c) |
| | Overloaded output-stream operator.
|
Cubic polynomials.
Closed form expression of roots exist for such polynomials.
Constructors should provide the coefficients in descending order. Here is an example of how to code the cubic \( 2x^3 - x + 1 \):
Cubic p(2.0,0.0,-1.0,1.0);
Cubic()
Empty.
Definition cubic.h:12
How do I compute the interpolating smooth cubic \( (1-x/r)^3 \) for values \( x \in [0,r] \)?
A first solution is to use the Cubic class as follows:
double y=
Cubic(-1.0/(r*r*r),3.0/(r*r),-3.0/r,1.0)(x)
Cubic also implements some inline static member function such as :
{
return (1.0-x/r)*(1.0-x/r)*(1.0-x/r);
}
static double Smooth(const double &, const double &)
Compute the value of a smooth interpolating function .
Definition cubic.h:286
This function is more efficient if only one or two function calls are needed.
How do I create a Hermite cubic spline curve?
A simple way to do this is to use the static member function of the CubicCurve class, for example:
CubicCurve c=
CubicCurve::Hermite(
Vector(0,0,0),
Vector(2,1,0),
Vector(0,1,0),
Vector(1,0,0));
Cubic curves.
Definition curve.h:91
static CubicCurve Hermite(const Vector &, const Vector &, const Vector &, const Vector &)
Creates an Hermite cubic curve on interval [0,1] given vertex locations and tangent vectors (in that ...
Definition curvecubic.cpp:211
double c[4]
Array of coefficients.
Definition cubic.h:9
Vector()
Empty.
Definition evector.h:18
| double Cubic::Sigmoid |
( |
const double & | x, |
|
|
const double & | r, |
|
|
const double & | t ) |
|
static |
Compute the value of a compactly supported sigmoid-shaped symmetric cubic.
The cubic was obtained by solving the Hermite cubic constraints: \( f(0)=0 \), \( f'(0)=1 \), \( f(r)=T \) and \( f'(r)=0 \). Coefficients are: \( a_0=0 \), \( a_1=1 \), \( a_2=(3T-2r)/r^2 \), \( a_3=(r-2T)/r^3 \).
- See also
- Math::SigmoidQuadric
- Parameters
-
| x | Real. |
| r | Radius of influence. |
| t | Value. |
| int Cubic::Solve |
( |
double * | y | ) |
const |
Solve the cubic equation.
This function stores the roots in an array and returns the number of roots. The roots are not sorted.
The cubic is solved as a quadric when the cubic term is negligible compared to the other coefficients, that is when
\[ |c_3| \leq \varepsilon \max(|c_0|,|c_1|,|c_2|,|c_3|), \]
where \( \varepsilon = 10^{-14} \) is Cubic::epsilon. The threshold is relative: the result does not depend on the scale of the coefficients. The quadric (and the null cubic) cases are handled by Quadric::Solve().
- Parameters
-
| y | Array for storing the roots. |