32#include "DGtal/base/Common.h"
33#include "ConfigTest.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/geometry/tools/RayIntersectionPredicates.h"
38#include "DGtal/shapes/implicit/ImplicitBall.h"
41#include "DGtal/shapes/GaussDigitizer.h"
42#include "DGtal/topology/LightImplicitDigitalSurface.h"
43#include "DGtal/topology/DigitalSurface.h"
57template<
typename Po
int>
60 unsigned int nbok = 0;
63 trace.beginBlock (
"Testing RayTriangle ..." );
68 trace.info() <<
"Ray intersection with 222-triangle "<<std::endl;
71 trace.info() <<
"(" << nbok <<
"/" << nb <<
") "
72 <<
"true " << std::endl;
74 trace.info() <<
"Ray intersection with reversed 222-triangle "<<std::endl;
77 trace.info() <<
"(" << nbok <<
"/" << nb <<
") "
78 <<
"true (no culling) " << std::endl;
81 trace.info() <<
"Ray intersection wrong ray with 222-triangle"<<std::endl;
84 trace.info() <<
"(" << nbok <<
"/" << nb <<
") "
85 <<
"false (no intersection)" << std::endl;
89 trace.info() <<
"Ray intersection reversed ray with 222-triangle "<<std::endl;
92 trace.info() <<
"(" << nbok <<
"/" << nb <<
") "
93 <<
"false (reversed ray)" << std::endl;
96 trace.info() <<
"Ray intersection with -2-2-2-triangle "<<std::endl;
99 trace.info() <<
"(" << nbok <<
"/" << nb <<
") "
100 <<
"false (reversed triangle)" << std::endl;
103 trace.info() <<
"Ray intersection in plane "<<std::endl;
106 trace.info() <<
"(" << nbok <<
"/" << nb <<
") "
107 <<
"false (in plane)" << std::endl;
117 unsigned int nbok = 0;
120 trace.beginBlock (
"Testing RayQuad ..." );
127 trace.info() <<
"Ray intersection with huge quad "<<std::endl;
131 trace.info() <<
"(" << nbok <<
"/" << nb <<
") "
132 <<
"true " << std::endl;
133 trace.info()<<std::endl;
135 trace.info() <<
"Ray intersection with far quad "<<std::endl;
139 trace.info() <<
"(" << nbok <<
"/" << nb <<
") "
140 <<
"false " << std::endl;
141 trace.info()<<std::endl;
150 unsigned int nbok = 0;
153 trace.beginBlock (
"Testing RaySurfel ..." );
168 trace.info() <<
"Ray intersection with surf "<<std::endl;
169 nbok += ray(surf) ? 1 : 0;
171 trace.info() <<
"(" << nbok <<
"/" << nb <<
") "
172 <<
"true " << std::endl;
173 trace.info()<<std::endl;
175 trace.info() <<
"Ray intersection with surf2 "<<std::endl;
176 nbok += !ray(surf2 ) ? 1 : 0;
178 trace.info() <<
"(" << nbok <<
"/" << nb <<
") "
179 <<
"false " << std::endl;
180 trace.info()<<std::endl;
194 trace.beginBlock(
" Ray shooting in digital surface");
195 trace.beginBlock(
"Shape initialisation ..." );
203 trace.error() <<
"Problem with Khalimsky space init" << std::endl;
213 trace.beginBlock(
" Ray shooting the shape");
222 trace.info() <<
"Ray shooting returns : "<< *it<<std::endl;
225 trace.info() <<
"Ray shooting returns : "<< *it2<<std::endl;
236int main(
int argc,
char** argv )
238 trace.beginBlock (
"Testing class RayIntersection" );
239 trace.info() <<
"Args:";
240 for (
int i = 0; i < argc; ++i )
241 trace.info() <<
" " << argv[ i ];
242 trace.info() << endl;
249 trace.emphase() << ( res ?
"Passed." :
"Error." ) << endl;
236int main(
int argc,
char** argv ) {
…}
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
DigitalSurfaceContainer::SurfelConstIterator ConstIterator
ConstIterator begin() const
ConstIterator end() const
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
const Point & getUpperBound() const
void attach(ConstAlias< EuclideanShape > shape)
const Point & getLowerBound() const
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
SCell sCell(const SPreCell &c) const
From a signed cell, returns a signed cell lying into this Khalismky space.
PointVector< dim, Integer > Point
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
Z3i this namespace gathers the standard of types for 3D imagery.
KhalimskySpaceND< 3, Integer > KSpace
Space::RealPoint RealPoint
DGtal is the top-level namespace which contains all DGtal functions and types.
This class implements various intersection predicates between a ray and a triangle,...
GaussDigitizer< Space, ImplicitShape > DigitalShape
ImplicitPolynomial3Shape< Space > ImplicitShape
bool testRayQuadIntersection()
bool testRayIntersection()
bool testRaySurfelIntersection()