DGtal 1.4.0
Loading...
Searching...
No Matches
exampleInHalfPlane.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/kernel/SpaceND.h"
#include "DGtal/kernel/domains/HyperRectDomain.h"
#include "DGtal/geometry/tools/determinant/Simple2x2DetComputer.h"
#include "DGtal/geometry/tools/determinant/SimpleIncremental2x2DetComputer.h"
#include "DGtal/geometry/tools/determinant/AvnaimEtAl2x2DetSignComputer.h"
#include "DGtal/geometry/tools/determinant/Filtered2x2DetComputer.h"
#include "DGtal/geometry/tools/determinant/InHalfPlaneBy2x2DetComputer.h"
#include "DGtal/geometry/tools/determinant/PredicateFromOrientationFunctor2.h"
#include "DGtal/geometry/tools/determinant/InHalfPlaneBySimple3x3Matrix.h"
Include dependency graph for exampleInHalfPlane.cpp:

Go to the source code of this file.

Functions

bool basicUsage ()
 
void advice ()
 
int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Tristan Roussillon (trist.nosp@m.an.r.nosp@m.oussi.nosp@m.llon.nosp@m.@liri.nosp@m.s.cn.nosp@m.rs.fr ) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2013/11/28

An example file named exampleInHalfPlane.

This file is part of the DGtal library.

Definition in file exampleInHalfPlane.cpp.

Function Documentation

◆ advice()

void advice ( )

[FunctorDefinition30]

[FunctorDefinition30]

[FunctorDefinition52]

[FunctorDefinition52]

[FunctorDefinition62]

[FunctorDefinition62]

[FunctorDefinition62bis]

[FunctorDefinition62bis]

[FunctorDefinition62plus]

[FunctorDefinition62plus]

Examples
geometry/tools/determinant/exampleInHalfPlane.cpp.

Definition at line 112 of file exampleInHalfPlane.cpp.

113{
114 {
116 //for coordinates of 30 (not zero) bits
120 Functor *a = new Functor();
121 BOOST_VERIFY(a);
122 delete a;
123 }
124
125 {
127 //for coordinates of 52 (not zero) bits
129 typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
130 typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
133 Functor *a = new Functor();
134 BOOST_VERIFY(a);
135 delete a;
136 //NB. using double as coordinate type is slightly faster than using DGtal::int64_t
137 //typedef PointVector<2, double> Point;
138 }
139
140 {
142 //for coordinates of 62 (not zero) bits
147 Functor *a= new Functor();
148 BOOST_VERIFY( a);
149 delete a;
150 }
151
152 {
154 //for coordinates of 62 (not zero) bits
155 //if long double is implemented as the 80-bit extended precision type
158 typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
160 Functor *a = new Functor();
161 BOOST_VERIFY(a == a);
163 delete a;
164 }
165
166#ifdef WITH_BIGINTEGER
167 {
169 //for arbitrary coordinates
171 typedef Simple2x2DetComputer<DGtal::BigInteger> DetComputer;
173 Functor *a= new Functor();
174 BOOST_VERIFY( a);
176 delete a;
177 }
178#endif
179
180}
Aim: Class that provides a way of computing the sign of the determinant of a 2x2 matrix from its four...
Aim: Class that provides a way of computing the sign of the determinant of a 2x2 matrix from its four...
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: Small class useful to compute the determinant of a 2x2 matrix from its four coefficients,...
MyPointD Point
InHalfPlaneBySimple3x3Matrix< Point, double > Functor

Referenced by main().

◆ basicUsage()

bool basicUsage ( )

[DomainDefinition]

[DomainDefinition]

[ProblemStatement]

[ProblemStatement]

[FunctorDefinition]

[FunctorDefinition]

[PredicateDefinition]

[PredicateDefinition]

[FunctorInitialization]

[FunctorInitialization]

[PredicateUsage]

[PredicateUsage]

Definition at line 62 of file exampleInHalfPlane.cpp.

63{
65 //domain definition
66 typedef SpaceND< 2, DGtal::int16_t > DigitalSpace;
68 typedef Domain::Point Point;
69 Domain domain( Point(-32767,-32767), Point(32767,32767) );
71
73 Point P, Q, R;
74 P = Point(0,0);
75 Q = Point(5,2);
76 R = Point(2,1);
77 //problem: are P, Q, R counter-clockwise oriented ?
79
81 //orientation functor
83 OrientationFunctor orientationFunctor;
85
87 //geometric predicate
89 pointPredicate( orientationFunctor );
91
93 //initialization
94 pointPredicate.init( P, Q );
95 //which is equivalent to
96 //orientationFunctor.init( P, Q );
97 //because the predicate stores a pointer to the functor
99
100 bool isCCW;
102 //decision
103 isCCW = pointPredicate( R );
104 //which is equivalent to the following shortcut:
105 //isCCW = pointPredicate( P, Q, R );
107
108 return isCCW;
109}
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: Small adapter to models of COrientationFunctor2. It is a model of concepts::CPointPredicate....
Domain domain
HyperRectDomain< Space > Domain

References domain, DGtal::PredicateFromOrientationFunctor2< TOrientationFunctor, acceptNeg, acceptZero >::init(), and DGtal::R.

Referenced by main().

◆ main()

int main ( int argc,
char ** argv )

Definition at line 182 of file exampleInHalfPlane.cpp.

183{
184 trace.beginBlock ( "Example exampleInHalfPlane" );
185 trace.info() << "Args:";
186 for ( int i = 0; i < argc; ++i )
187 trace.info() << " " << argv[ i ];
188 trace.info() << endl;
189
190 basicUsage();
191 advice();
192
193 trace.endBlock();
194 return 0;
195}
void beginBlock(const std::string &keyword="")
std::ostream & info()
double endBlock()
bool basicUsage()
void advice()
Trace trace
Definition Common.h:153

References advice(), basicUsage(), DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Trace::info(), and DGtal::trace.