added test for point location with extended

and bounded kernel
This commit is contained in:
Peter Hachenberger 2006-02-28 20:16:03 +00:00
parent 6e10c0c89a
commit bca17f414a
3 changed files with 76 additions and 5 deletions

1
.gitattributes vendored
View File

@ -1066,6 +1066,7 @@ Nef_2/doc_tex/Nef_2/halfplane.ps -text
Nef_2/doc_tex/Nef_2_ref/extsegs.eps -text
Nef_2/doc_tex/Nef_2_ref/extsegs.gif -text svneol=unset#unset
Nef_2/doc_tex/Nef_2_ref/extsegs.pdf -text svneol=unset#unset
Nef_2/test/Nef_2/point_location.C -text
Nef_3/Visual_hull/Nef_3/corner.off -text
Nef_3/Visual_hull/Nef_3/hole.off -text
Nef_3/Visual_hull/Nef_3/mpi.off -text

View File

@ -6,8 +6,7 @@
#---------------------------------------------------------------------#
# Choose the right include file from the <cgalroot>/make directory.
CGAL_MAKEFILE = c:/cgal/CGAL-3.1/make/makefile_i686_CYGWINNT-5.1-1.5.17_g++-3.4.4
# CGAL_MAKEFILE = ENTER_YOUR_INCLUDE_MAKEFILE_HERE
CGAL_MAKEFILE = ENTER_YOUR_INCLUDE_MAKEFILE_HERE
include $(CGAL_MAKEFILE)
#---------------------------------------------------------------------#
@ -16,7 +15,6 @@ include $(CGAL_MAKEFILE)
CXXFLAGS = \
-I../../include \
-I../../../Polynomial/include \
$(TESTSUITE_CXXFLAGS) \
$(EXTRA_FLAGS) \
-Iinclude \
@ -42,7 +40,8 @@ LDFLAGS = \
all: \
EPoint-test \
Nef_polyhedron_2-test
Nef_polyhedron_2-test \
point_location
EPoint-test$(EXE_EXT): EPoint-test$(OBJ_EXT)
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)EPoint-test EPoint-test$(OBJ_EXT) $(LDFLAGS)
@ -50,9 +49,13 @@ EPoint-test$(EXE_EXT): EPoint-test$(OBJ_EXT)
Nef_polyhedron_2-test$(EXE_EXT): Nef_polyhedron_2-test$(OBJ_EXT)
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)Nef_polyhedron_2-test Nef_polyhedron_2-test$(OBJ_EXT) $(LDFLAGS)
point_location$(EXE_EXT): point_location$(OBJ_EXT)
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)point_location point_location$(OBJ_EXT) $(LDFLAGS)
clean: \
EPoint-test.clean \
Nef_polyhedron_2-test.clean
Nef_polyhedron_2-test.clean \
point_location.clean
#---------------------------------------------------------------------#
# suffix rules

View File

@ -0,0 +1,67 @@
// file : examples/Nef_2/point_location.C
#include <CGAL/Gmpz.h>
#include <CGAL/Bounded_kernel.h>
#include <CGAL/Homogeneous.h>
#include <CGAL/Filtered_extended_homogeneous.h>
#include <CGAL/Nef_polyhedron_2.h>
template<typename Kernel>
void test() {
typedef CGAL::Nef_polyhedron_2<Kernel> Nef_polyhedron;
typedef typename Nef_polyhedron::Point Point;
typedef typename Nef_polyhedron::Direction Direction;
typedef typename Nef_polyhedron::Line Line;
typedef typename Nef_polyhedron::Explorer Explorer;
typedef typename Nef_polyhedron::Object_handle Object_handle;
typedef typename Explorer::Vertex_const_handle Vertex_const_handle;
typedef typename Explorer::Halfedge_const_handle Halfedge_const_handle;
typedef typename Explorer::Face_const_handle Face_const_handle;
Point p11(0,0), p12(-1,1), p13(0,2);
Point p31(0,0), p32(0,1), p33(1,2);
Point p41(0,0), p42(1,1), p43(0,2);
Point line1[3] = { p11, p12, p13};
Point line3[3] = { p31, p32, p33};
Point line4[3] = { p41, p42, p43};
std::pair<Point*, Point*> pr1(line1, line1+3);
std::pair<Point*, Point*> pr3(line3, line3+3);
std::pair<Point*, Point*> pr4(line4, line4+3);
std::list<std::pair<Point*, Point*> > poly;
poly.push_back(pr1);
poly.push_back(pr3);
poly.push_back(pr4);
Nef_polyhedron N(poly.begin(), poly.end(), Nef_polyhedron::POLYLINES);
// Point q1(0,0), q2(1,0), q3(1,1), q4(0,1);
// Point x[4] = { q1,q2,q3,q4};
// Nef_polyhedron M(x,x+4, Nef_polyhedron::INCLUDED);
// std::cerr << M;
// CGAL_NEF_SETDTHREAD(17);
Object_handle o = N.locate(Point(2,1));
o = N.locate(Point(2,1));
o = N.ray_shoot(Point(4,3), Direction(-2,-1));
o = N.ray_shoot_to_boundary(Point(2,1), Direction(-1,0));
Vertex_const_handle v;
Explorer E = N.explorer();
CGAL_assertion(CGAL::assign(v,o));
CGAL_assertion(E.point(v) == Point(1,1));
}
int main() {
typedef CGAL::Gmpz RT;
typedef CGAL::Filtered_extended_homogeneous<RT> EKernel;
typedef CGAL::Homogeneous<RT> HOM;
typedef CGAL::Bounded_kernel<HOM> BKernel;
test<EKernel>();
test<BKernel>();
return 0;
}