DGtal
1.5.beta
|
Aim: This class implements an orientation functor that
provides a way to determine the position of a given point with respect to the unique circle passing by the same two given points and whose radius and orientation is given.
More...
#include <DGtal/geometry/tools/determinant/InGeneralizedDiskOfGivenRadius.h>
Public Types | |
typedef TPoint | Point |
typedef std::array< Point, 2 > | PointArray |
typedef PointArray::size_type | SizeArray |
typedef TDetComputer | DetComputer |
typedef DetComputer::ArgumentInteger | Integer |
typedef DetComputer::ResultInteger | Value |
typedef Simple2x2DetComputer< Integer > | AreaFunctor |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((C2x2DetComputer< DetComputer >)) | |
InGeneralizedDiskOfGivenRadius (bool isPositive=true, const Integer &aNum2=NumberTraits< Integer >::ONE, const Integer &aDen2=NumberTraits< Integer >::ZERO) | |
InGeneralizedDiskOfGivenRadius (const InGeneralizedDiskOfGivenRadius &other) | |
InGeneralizedDiskOfGivenRadius & | operator= (const InGeneralizedDiskOfGivenRadius &other) |
void | init (const Point &aP, const Point &aQ) |
void | init (const PointArray &aA) |
Value | operator() (const Point &aR) const |
void | selfDisplay (std::ostream &out) const |
bool | lengthIsValid (const Integer &aL2) const |
bool | isValid () const |
void | finalizeComputation () const |
Static Public Attributes | |
static const SizeArray | size = 2 |
Aim: This class implements an orientation functor that
provides a way to determine the position of a given point with respect to the unique circle passing by the same two given points and whose radius and orientation is given.
This class is useful for some geometric algorithm involving disks of given radius, such as alpha-hull and alpha-shape computations.
The radius is given at construction. It is described by a pair of integers myNum2 and myDen2 that stands for the numerator and denominator of the squared radius. The orientation is also given at construction. It is described by a boolean equal to 'true' (resp. 'false') if the center C of the circle of squared radius myNum2 / myDen2 and passing by myP and myQ is located on the left side (resp. right side) of the oriented line myP myQ, ie. if myP , myQ , C are counter-clockwise oriented (resp. clockwise oriented).
The test is done in two steps. After an initialization step that memorizes the two points that uniquely defines the circle whose radius and orientation is given, we can test the position of a third point myR with respect to this circle. Note that the distance between myP and myR is assumed to be greater than the distance between myP and myQ and between myQ and myR.
The test is reduced to the computation of the determinant of a 2x2 matrix of integral entries, the implementation of which is delegated to a determinant computer. The reduction involves many multiplications and additions so that temporary integers must be coded with at least \( 6b + 9 \) bits for point coordinates coded with \( b \) bits. That's why it is a best practice to use BigInteger to avoid any overflows. You can use however 64 bits integers together with a smart determinant computer, like AvnaimEtAl2x2DetSignComputer, for small domains where point coordinates range within ]-2^9; 2^9[.
Basic usage:
Note that since a substantial part of the execution time comes from the allocation/desallocation of integers, we follow the same strategy used in IntegerComputer: the user instantiates once this object and performs several tests with it.
TPoint | a model of point |
TDetComputer | a model of C2x2DetComputer |
Definition at line 126 of file InGeneralizedDiskOfGivenRadius.h.
typedef Simple2x2DetComputer<Integer> DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::AreaFunctor |
Type of functor returning the area of a parallelogram based on two vectors. Used to compute the radius of a circle passing by 3 points.
Definition at line 166 of file InGeneralizedDiskOfGivenRadius.h.
typedef TDetComputer DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::DetComputer |
Type of determinant computer
Definition at line 151 of file InGeneralizedDiskOfGivenRadius.h.
typedef DetComputer::ArgumentInteger DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::Integer |
Type of integers used during the computation
Definition at line 156 of file InGeneralizedDiskOfGivenRadius.h.
typedef TPoint DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::Point |
Type of input points
Definition at line 133 of file InGeneralizedDiskOfGivenRadius.h.
typedef std::array<Point,2> DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::PointArray |
Type of point array
Definition at line 138 of file InGeneralizedDiskOfGivenRadius.h.
typedef PointArray::size_type DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::SizeArray |
Type used to represent the size of the array
Definition at line 142 of file InGeneralizedDiskOfGivenRadius.h.
typedef DetComputer::ResultInteger DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::Value |
Type of returned value
Definition at line 160 of file InGeneralizedDiskOfGivenRadius.h.
DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::InGeneralizedDiskOfGivenRadius | ( | bool | isPositive = true , |
const Integer & | aNum2 = NumberTraits< Integer >::ONE , |
||
const Integer & | aDen2 = NumberTraits< Integer >::ZERO |
||
) |
Constructor of the functor from a given radius.
isPositive | bool equal to 'true' (resp. 'false') if the center C of the circle of squared radius myNum2 / myDen2 and passing by myP and myQ is located on the left side (resp. right side) of the oriented line myP myQ, ie. myP , myQ , C are counter-clockwise oriented (resp. clockwise oriented). |
aNum2 | squared numerator of the radius (0 by default) |
aDen2 | squared denominator of the radius (1 by default) |
DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::InGeneralizedDiskOfGivenRadius | ( | const InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer > & | other | ) |
Copy constructor.
other | the object to clone. |
DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::BOOST_CONCEPT_ASSERT | ( | (C2x2DetComputer< DetComputer >) | ) |
void DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::finalizeComputation | ( | ) | const |
Update myComputedNum2 and myComputedDen2 from other private datas.
void DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::init | ( | const Point & | aP, |
const Point & | aQ | ||
) |
Initialization from two points.
aP | a first point |
aQ | a second point |
void DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::init | ( | const PointArray & | aA | ) |
Initialisation from two points.
aA | array of two points |
bool DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::isValid | ( | ) | const |
Checks the validity/consistency of the object. More precisely, myNum2 and myDen2 must be positive, myNum2 must not be zero (only strictly positive radius are valid)
bool DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::lengthIsValid | ( | const Integer & | aL2 | ) | const |
Compares the length of two consecutive input points to the diameter of the circle.
aL2 | any squared length between two points |
Value DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::operator() | ( | const Point & | aR | ) | const |
Main operator.
aR | any point to test |
InGeneralizedDiskOfGivenRadius& DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::operator= | ( | const InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer > & | other | ) |
Assignment.
other | the object to copy. |
void DGtal::InGeneralizedDiskOfGivenRadius< TPoint, TDetComputer >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
|
mutableprivate |
area of triangle myP myQ myR
Definition at line 363 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
Functor returning the area of a parallelogram based on two vectors.
Definition at line 368 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
Denominator of the squared radius of the circle myP , myQ , myR
Definition at line 323 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
Numerator of the squared radius of the circle myP , myQ , myR
Definition at line 319 of file InGeneralizedDiskOfGivenRadius.h.
|
private |
Denominator of the given squared radius
Definition at line 286 of file InGeneralizedDiskOfGivenRadius.h.
|
private |
Determinant computer used to compare the given (squared) radius myNum2 / myDen2 to the (squared) radius of the circle passing by myP , myQ , myR , ie. myComputedNum2 / myComputedDen2
Definition at line 302 of file InGeneralizedDiskOfGivenRadius.h.
|
private |
boolean equal to 'true' (resp. 'false') if the center C of the circle of squared radius myNum2 / myDen2 and passing by myP and myQ is located on the left side (resp. right side) of the oriented line myP myQ, ie. if myP , myQ , C are counter-clockwise oriented (resp. clockwise oriented).
Definition at line 295 of file InGeneralizedDiskOfGivenRadius.h.
|
private |
Numerator of the given squared radius
Definition at line 282 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
First point
Definition at line 307 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
x-coordinate of myQ - myP
Definition at line 327 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
y-coordinate of myQ - myP
Definition at line 331 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
Squared length of myQ - myP
Definition at line 335 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
Second point
Definition at line 311 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
x-coordinate of myR - myQ
Definition at line 339 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
y-coordinate of myR - myQ
Definition at line 343 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
Squared length of myR - myQ
Definition at line 347 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
Third point
Definition at line 315 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
x-coordinate of myP - myR
Definition at line 351 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
y-coordinate of myP - myR
Definition at line 355 of file InGeneralizedDiskOfGivenRadius.h.
|
mutableprivate |
Squared length of myP - myR
Definition at line 359 of file InGeneralizedDiskOfGivenRadius.h.
|
static |
static size of the array, ie. 2
Definition at line 146 of file InGeneralizedDiskOfGivenRadius.h.