DGtal 1.3.0
|
Aim: Small class useful to compute, in an incremental way, the determinant of a 2x2 matrix from its four coefficients, ie. \( \begin{vmatrix} a & x \\ b & y \end{vmatrix} \). More...
#include <DGtal/geometry/tools/determinant/SimpleIncremental2x2DetComputer.h>
Public Types | |
typedef TArgumentInteger | ArgumentInteger |
typedef ArgumentInteger | Integer |
typedef ArgumentInteger | argument_type |
typedef TResultInteger | ResultInteger |
typedef ResultInteger | Value |
typedef ResultInteger | result_type |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CEuclideanRing< ArgumentInteger >)) | |
BOOST_CONCEPT_ASSERT ((concepts::CEuclideanRing< ArgumentInteger >)) | |
SimpleIncremental2x2DetComputer () | |
SimpleIncremental2x2DetComputer (const SimpleIncremental2x2DetComputer &other) | |
SimpleIncremental2x2DetComputer & | operator= (const SimpleIncremental2x2DetComputer &other) |
~SimpleIncremental2x2DetComputer () | |
void | init (const ArgumentInteger &aA, const ArgumentInteger &aB) |
ResultInteger | operator() (const ArgumentInteger &aX, const ArgumentInteger &aY) const |
ResultInteger | operator() (const ArgumentInteger &aA, const ArgumentInteger &aB, const ArgumentInteger &aX, const ArgumentInteger &aY) |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Private Member Functions | |
void | partialComputation () const |
Aim: Small class useful to compute, in an incremental way, the determinant of a 2x2 matrix from its four coefficients, ie. \( \begin{vmatrix} a & x \\ b & y \end{vmatrix} \).
This class is a model of C2x2DetComputer.
It should be used to compute the determinant \( ay - bx \), for various \( x, y \) and given \( a \) and \( b \). Let us assume that the determinant \( \delta_i = ay_i - bx_i \) is computed. The determinant \( \delta_j = ay_j - bx_j \) is then computed incrementally as follows: \( \delta_j = a(y_j - y_i) - b(x_j - x_i) \). The computation is simplified if the differences \( (x_j - x_i) \) and \( (y_j - y_i) \) are equal to 0 or 1, as it may occur in digital geometry.
In order to use SimpleIncremental2x2DetComputer
TArgumentInteger | a model of CEuclideanRing for the input coefficients of the 2x2 matrix |
TResultInteger | a model of CEuclideanRing for the result. It must be either unbounded or twice as big as TArgumentInteger, ie. if TArgumentInteger is a type coded on b bits, TResultInteger must be coded on 2b+1 bits |
Note that if you use the same type for the arguments and the result, the code may fail to provide the exact result because of a possible overflow.
Definition at line 93 of file SimpleIncremental2x2DetComputer.h.
typedef ArgumentInteger DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::argument_type |
STL alias of type ArgumentInteger
Definition at line 109 of file SimpleIncremental2x2DetComputer.h.
typedef TArgumentInteger DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::ArgumentInteger |
Type of integer for the input coefficients of the 2x2 matrix
Definition at line 100 of file SimpleIncremental2x2DetComputer.h.
typedef ArgumentInteger DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::Integer |
DGtal alias of type ArgumentInteger
Definition at line 105 of file SimpleIncremental2x2DetComputer.h.
typedef ResultInteger DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::result_type |
STL alias of type ResultInteger
Definition at line 124 of file SimpleIncremental2x2DetComputer.h.
typedef TResultInteger DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::ResultInteger |
Type of integer for the returned determinant
Definition at line 114 of file SimpleIncremental2x2DetComputer.h.
typedef ResultInteger DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::Value |
DGtal alias type of ResultInteger
Definition at line 120 of file SimpleIncremental2x2DetComputer.h.
DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::SimpleIncremental2x2DetComputer | ( | ) |
Default constructor.
DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::SimpleIncremental2x2DetComputer | ( | const SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger > & | other | ) |
Copy constructor.
other | the object to clone. |
DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::~SimpleIncremental2x2DetComputer | ( | ) |
Destructor.
DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::BOOST_CONCEPT_ASSERT | ( | (concepts::CEuclideanRing< ArgumentInteger >) | ) |
DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::BOOST_CONCEPT_ASSERT | ( | (concepts::CEuclideanRing< ArgumentInteger >) | ) |
void DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::init | ( | const ArgumentInteger & | aA, |
const ArgumentInteger & | aB | ||
) |
Initialisation.
aA | 0-component of the first column vector |
aB | 1-component of the first column vector |
bool DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
ResultInteger DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::operator() | ( | const ArgumentInteger & | aA, |
const ArgumentInteger & | aB, | ||
const ArgumentInteger & | aX, | ||
const ArgumentInteger & | aY | ||
) |
Operator.
aA | 0-component of the first column vector |
aB | 1-component of the first column vector |
aX | 0-component of the second column vector |
aY | 1-component of the second column vector |
ResultInteger DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::operator() | ( | const ArgumentInteger & | aX, |
const ArgumentInteger & | aY | ||
) | const |
Incremental operator.
aX | 0-component of the second column vector |
aY | 1-component of the second column vector |
SimpleIncremental2x2DetComputer & DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::operator= | ( | const SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger > & | other | ) |
Assignment.
other | the object to copy. |
|
private |
Update myDet with respect to the new value of myDY.
void DGtal::SimpleIncremental2x2DetComputer< TArgumentInteger, TResultInteger >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
|
private |
Data member used to store the 0-component of the first column vector, ie. a.
Definition at line 204 of file SimpleIncremental2x2DetComputer.h.
|
mutableprivate |
Data member used to store the product a.dy.
Definition at line 245 of file SimpleIncremental2x2DetComputer.h.
|
mutableprivate |
Data member used to store the product a.y
Definition at line 213 of file SimpleIncremental2x2DetComputer.h.
|
private |
Data member used to store the 1-component of the first column vector, ie. b.
Definition at line 209 of file SimpleIncremental2x2DetComputer.h.
|
mutableprivate |
Data member used to store the product b.dx.
Definition at line 249 of file SimpleIncremental2x2DetComputer.h.
|
mutableprivate |
Data member used to store the product b.x
Definition at line 217 of file SimpleIncremental2x2DetComputer.h.
|
mutableprivate |
Data member used to store the partial determinant, ie. a.dy - b.dx
Definition at line 253 of file SimpleIncremental2x2DetComputer.h.
|
mutableprivate |
Data member used to store the determinant, ie. ay - bx
Definition at line 221 of file SimpleIncremental2x2DetComputer.h.
|
mutableprivate |
Data member used to store the difference between the last 0-component of the second column vector and a new one.
Definition at line 236 of file SimpleIncremental2x2DetComputer.h.
|
mutableprivate |
Data member used to store the difference between the last 1-component of the second column vector and a new one.
Definition at line 241 of file SimpleIncremental2x2DetComputer.h.
|
mutableprivate |
Data member used to store the 0-component of the second column vector, ie. x.
Definition at line 226 of file SimpleIncremental2x2DetComputer.h.
|
mutableprivate |
Data member used to store the 1-component of the second column vector, ie. y.
Definition at line 231 of file SimpleIncremental2x2DetComputer.h.
|
private |
Definition at line 255 of file SimpleIncremental2x2DetComputer.h.