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"
48 using namespace DGtal;
57 template<
typename Po
int>
60 unsigned int nbok = 0;
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;
127 trace.
info() <<
"Ray intersection with huge quad "<<std::endl;
131 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
132 <<
"true " << std::endl;
135 trace.
info() <<
"Ray intersection with far quad "<<std::endl;
139 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
140 <<
"false " << std::endl;
150 unsigned int nbok = 0;
168 trace.
info() <<
"Ray intersection with surf "<<std::endl;
169 nbok += ray(surf) ? 1 : 0;
171 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
172 <<
"true " << 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;
203 trace.
error() <<
"Problem with Khalimsky space init" << std::endl;
222 trace.
info() <<
"Ray shooting returns : "<< *it<<std::endl;
225 trace.
info() <<
"Ray shooting returns : "<< *it2<<std::endl;
236 int main(
int argc,
char** argv )
240 for (
int i = 0; i < argc; ++i )
244 bool res = testRayIntersection<Z3i::Point>()
245 && testRayIntersection<Z3i::RealPoint>()
249 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
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 & getLowerBound() const
void attach(ConstAlias< EuclideanShape > shape)
const Point & getUpperBound() 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....
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
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.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
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,...
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
int main(int argc, char **argv)
bool testRayQuadIntersection()
bool testRayIntersection()
bool testRaySurfelIntersection()