Linear polynomials.
More...
#include <linear.h>
|
| Linear () |
| Empty.
|
|
| Linear (const double &, const double &) |
| Creates a linear function.
|
|
| Linear (const double &) |
| Creates a constant function.
|
|
| ~Linear () |
| Empty.
|
|
constexpr double & | operator[] (int) |
| Access class components.
|
|
constexpr double | operator[] (int) const |
| Overloaded.
|
|
Linear | operator- () const |
| Unary.
|
|
Linear & | operator+= (const Linear &) |
| Destructive sum of two linear polynomials.
|
|
Linear & | operator-= (const Linear &) |
| Destructive difference of two linear polynomials.
|
|
Linear & | operator*= (const double &) |
| Scale a linear polynomial by a double value.
|
|
Linear & | operator/= (const double &) |
| Scales a linear polynomial by a double value.
|
|
constexpr double | operator() (const double &) const |
| Evaluates the linear function.
|
|
int | Solve (double &) const |
| Solve linear equations.
|
|
int | Solve (double &, const double &, const double &) const |
| Search the roots of a linear 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 Linear over a given interval.
|
|
|
static double | Step (const double &, const double &, const double &) |
| Create a linear step.
|
|
static double | Step (const double &, const double &, const double &, const double &, const double &) |
| Create a linear step.
|
|
static double | Affine (const double &, const double &, const double &) |
| Create the linear part of a linear step.
|
|
static double | Solve (const double &, const double &, const double &, const double &) |
| Compute the root of a linear function such that f(a)=va and f(b)=vb.
|
|
static double | SolveAlpha (const double &, const double &, const double &, const double &) |
| Compute the root of a linear function.
|
|
|
double | c [2] = { 0.0 } |
| Array of coefficients.
|
|
|
Linear | operator+ (const Linear &u, const Linear &v) |
| Overloaded.
|
|
Linear | operator- (const Linear &v, const Linear &u) |
| Overloaded.
|
|
Linear | operator* (const Linear &u, const double &e) |
| Multiply a polynomial by a scalar value.
|
|
Linear | operator* (const double &a, const Linear &p) |
| Overloaded.
|
|
Linear | operator/ (const Linear &p, const double &a) |
| Overloaded.
|
|
std::ostream & | operator<< (std::ostream &s, const Linear &p) |
| Overloaded output-stream operator.
|
|
Linear polynomials.
When using constructors, the coefficients are given in descending order:
Linear()
Empty.
Definition linear.h:12
◆ Linear() [1/2]
Linear::Linear |
( |
const double & | a, |
|
|
const double & | b ) |
|
inlineexplicit |
Creates a linear function.
The function is defined as f(x) = a x + b.
- Parameters
-
◆ Linear() [2/2]
Linear::Linear |
( |
const double & | a | ) |
|
|
inlineexplicit |
Creates a constant function.
- Parameters
-
◆ Affine()
double Linear::Affine |
( |
const double & | x, |
|
|
const double & | a, |
|
|
const double & | b ) |
|
inlinestatic |
Create the linear part of a linear step.
This function does not test limits.
- Parameters
-
x | Value |
a,b | Interval values. |
- Returns
- Real in unit inverval.
- See also
- Linear::Step
◆ operator()()
double Linear::operator() |
( |
const double & | x | ) |
const |
|
inlineconstexpr |
Evaluates the linear function.
- Parameters
-
◆ Range()
void Linear::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 Linear over a given interval.
- Parameters
-
a,b | Interval. |
x,y | Returned range. |
◆ Solve() [1/3]
double Linear::Solve |
( |
const double & | a, |
|
|
const double & | b, |
|
|
const double & | va, |
|
|
const double & | vb ) |
|
inlinestatic |
◆ Solve() [2/3]
int Linear::Solve |
( |
double & | x | ) |
const |
Solve linear equations.
This function store the root (ifit exists) in a double and returns the number of roots.
- Parameters
-
◆ Solve() [3/3]
int Linear::Solve |
( |
double & | x, |
|
|
const double & | a, |
|
|
const double & | b ) const |
Search the roots of a linear equation over a given interval.
- Parameters
-
◆ SolveAlpha()
double Linear::SolveAlpha |
( |
const double & | a, |
|
|
const double & | b, |
|
|
const double & | va, |
|
|
const double & | vb ) |
|
static |
Compute the root of a linear function.
The linear function satisfies the constraints: f(a)=va and f(b)=vb; the function returns an interpolant t such that the root satisties r=(1-t) a+t b.
- See also
- Linear::Solve(const Vector& a, const Vector& b, const double&, const double&);
◆ Step() [1/2]
double Linear::Step |
( |
const double & | x, |
|
|
const double & | a, |
|
|
const double & | b ) |
|
inlinestatic |
◆ Step() [2/2]
double Linear::Step |
( |
const double & | x, |
|
|
const double & | a, |
|
|
const double & | b, |
|
|
const double & | ya, |
|
|
const double & | yb ) |
|
inlinestatic |
Create a linear step.
This function is the same as coding:
static double Step(const double &, const double &, const double &)
Create a linear step.
Definition linear.h:195
static double Lerp(const double &, const double &, const double &)
Linear interpolation.
Definition mathematics.h:529
- Parameters
-
x | Value |
a,b | Interval values. |
ya,yb | Output interval values. |
- See also
- Cubic::SmoothStep, Quintic::SmoothStep
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | s, |
|
|
const Linear & | p ) |
|
friend |
Overloaded output-stream operator.
- Parameters
-