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 ChordNaivePlaneComputer.
This file is part of the DGtal library.
Definition in file viewer3D-7bis-planes.cpp.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 78 of file viewer3D-7bis-planes.cpp.
82 QApplication application(argc,argv);
85 unsigned int nbok = 0;
88 typedef PlaneComputer::Primitive Primitive;
91 plane.
init( 2, 1, 1 );
93 bool pt0_inside = plane.extend( pt0 );
94 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") Plane=" << plane
97 bool pt1_inside = plane.extend( pt1 );
98 ++nb; nbok += pt1_inside ==
true ? 1 : 0;
99 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt1
100 <<
" Plane=" << plane << std::endl;
101 Point pt2( 2, 7, 1 );
102 bool pt2_inside = plane.extend( pt2 );
103 ++nb; nbok += pt2_inside ==
true ? 1 : 0;
104 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt2
105 <<
" Plane=" << plane << std::endl;
107 Point pt3( 0, 5, 12 );
108 bool pt3_inside = plane.extend( pt3 );
109 ++nb; nbok += pt3_inside ==
false ? 1 : 0;
110 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt3
111 <<
" Plane=" << plane << std::endl;
113 Point pt4( -5, -5, 10 );
114 bool pt4_inside = plane.extend( pt4 );
115 ++nb; nbok += pt4_inside ==
false ? 1 : 0;
116 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt4
117 <<
" Plane=" << plane << std::endl;
119 Point pt5 = pt0 + pt1 + pt2 +
Point( 0, 0, 1 );
120 bool pt5_inside = plane.extend( pt5 );
121 ++nb; nbok += pt5_inside ==
true ? 1 : 0;
122 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt5
123 <<
" Plane=" << plane << std::endl;
126 bool pt6_inside = plane.extend( pt6 );
127 ++nb; nbok += pt6_inside ==
true ? 1 : 0;
128 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt5
129 <<
" Plane=" << plane << std::endl;
131 Primitive strip = plane.primitive();
133 <<
" axis=" << strip.mainAxis()
134 <<
" axiswidth=" << strip.axisWidth()
135 <<
" diag=" << strip.mainDiagonal()
136 <<
" diagwidth=" << strip.diagonalWidth()
138 ++nb; nbok += strip.axisWidth() < 1.0 ? 1 : 0;
139 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") axiswidth < 1 "
141 ++nb; nbok += strip.diagonalWidth() < sqrt(3.0) ? 1 : 0;
142 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") axiswidth < sqrt(3) "
145 trace.
emphase() << ( nbok == nb ?
"Passed." :
"Error." ) << endl;
151 Color red( 255, 0, 0 );
152 Color green( 0, 255, 0 );
153 Color grey( 200, 200, 200 );
165 viewer << MyViewer::updateDisplay;
168 return application.exec();
Aim: A class that contains the chord-based algorithm for recognizing pieces of digital planes of give...
void init(Dimension axis, InternalScalar widthNumerator=NumberTraits< InternalScalar >::ONE, InternalScalar widthDenominator=NumberTraits< InternalScalar >::ONE)
Structure representing an RGB triple with alpha component.
void beginBlock(const std::string &keyword="")
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
void displayPredicate(Viewer3D &viewer, const Domain &domain, const Predicate &pred)
References DGtal::Trace::beginBlock(), displayPredicate(), domain, DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), DGtal::ChordNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::init(), DGtal::Viewer3D< TSpace, TKSpace >::show(), and DGtal::trace.