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
- Jacques-Olivier Lachaud (
jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr
) Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
- Date
- 2012/03/05
Functions for testing class COBANaivePlaneComputer.
This file is part of the DGtal library.
Definition in file viewer3D-7-planes.cpp.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 75 of file viewer3D-7-planes.cpp.
79 QApplication application(argc,argv);
82 unsigned int nbok = 0;
86 typedef PlaneComputer::Primitive Primitive;
89 plane.
init( 2, 100, 1, 1 );
91 bool pt0_inside = plane.extend( pt0 );
92 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") Plane=" << plane
95 bool pt1_inside = plane.extend( pt1 );
96 ++nb, nbok += pt1_inside ==
true ? 1 : 0;
97 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt1
98 <<
" Plane=" << plane << std::endl;
100 bool pt2_inside = plane.extend( pt2 );
101 ++nb, nbok += pt2_inside ==
true ? 1 : 0;
102 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt2
103 <<
" Plane=" << plane << std::endl;
105 Point pt3( 0, 5, 12 );
106 bool pt3_inside = plane.extend( pt3 );
107 ++nb, nbok += pt3_inside ==
false ? 1 : 0;
108 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt3
109 <<
" Plane=" << plane << std::endl;
111 Point pt4( -5, -5, 10 );
112 bool pt4_inside = plane.extend( pt4 );
113 ++nb, nbok += pt4_inside ==
false ? 1 : 0;
114 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt4
115 <<
" Plane=" << plane << std::endl;
117 Point pt5 = pt0 + pt1 + pt2 +
Point( 0, 0, 1 );
118 bool pt5_inside = plane.extend( pt5 );
119 ++nb, nbok += pt5_inside ==
true ? 1 : 0;
120 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt5
121 <<
" Plane=" << plane << std::endl;
124 bool pt6_inside = plane.extend( pt6 );
125 ++nb, nbok += pt6_inside ==
true ? 1 : 0;
126 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt5
127 <<
" Plane=" << plane << std::endl;
129 Primitive strip = plane.primitive();
131 <<
" axis=" << strip.mainAxis()
132 <<
" axiswidth=" << strip.axisWidth()
133 <<
" diag=" << strip.mainDiagonal()
134 <<
" diagwidth=" << strip.diagonalWidth()
136 ++nb, nbok += strip.axisWidth() < 1.0 ? 1 : 0;
137 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") axiswidth < 1 " 139 ++nb, nbok += strip.diagonalWidth() < sqrt(3.0) ? 1 : 0;
140 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") axiswidth < sqrt(3) " 142 trace.
emphase() << ( nbok == nb ?
"Passed." :
"Error." ) << endl;
148 Color red( 255, 0, 0 );
149 Color green( 0, 255, 0 );
150 Color grey( 200, 200, 200 );
165 return application.exec();
void beginBlock(const std::string &keyword="")
void init(Dimension axis, InternalInteger diameter, InternalInteger widthNumerator=NumberTraits< InternalInteger >::ONE, InternalInteger widthDenominator=NumberTraits< InternalInteger >::ONE)
void displayPredicate(Viewer3D &viewer, const Domain &domain, const Predicate &pred)
Aim: A class that contains the COBA algorithm (Emilie Charrier, Lilian Buzer, DGCI2008) for recognizi...
Structure representing an RGB triple with alpha component.
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
References DGtal::Trace::beginBlock(), displayPredicate(), domain, DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), DGtal::COBANaivePlaneComputer< TSpace, TInternalInteger >::init(), DGtal::Viewer3D< TSpace, TKSpace >::show(), DGtal::trace, and DGtal::Display3D< Space, KSpace >::updateDisplay.