diff --git a/.gitattributes b/.gitattributes index b83043fe8f8..6fcac5f3327 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/Nef_2/test/Nef_2/makefile b/Nef_2/test/Nef_2/makefile index 892f0609134..8242c270571 100644 --- a/Nef_2/test/Nef_2/makefile +++ b/Nef_2/test/Nef_2/makefile @@ -6,8 +6,7 @@ #---------------------------------------------------------------------# # Choose the right include file from the /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 diff --git a/Nef_2/test/Nef_2/point_location.C b/Nef_2/test/Nef_2/point_location.C new file mode 100644 index 00000000000..ddbf9422b90 --- /dev/null +++ b/Nef_2/test/Nef_2/point_location.C @@ -0,0 +1,67 @@ +// file : examples/Nef_2/point_location.C + +#include +#include +#include +#include +#include + +template +void test() { + + typedef CGAL::Nef_polyhedron_2 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 pr1(line1, line1+3); + std::pair pr3(line3, line3+3); + std::pair pr4(line4, line4+3); + std::list > 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 EKernel; + typedef CGAL::Homogeneous HOM; + typedef CGAL::Bounded_kernel BKernel; + + test(); + test(); + + return 0; +} + +