From bf2a73f220c6de25cf1f58ec94122e6ed835faea Mon Sep 17 00:00:00 2001 From: Aymeric PELLE Date: Tue, 11 Mar 2014 16:31:58 +0100 Subject: [PATCH 01/12] Add inexact_locate() in P3T3. But, it does nothing for the moment. --- .../include/CGAL/Periodic_3_triangulation_3.h | 118 +++++++++++++++++- 1 file changed, 113 insertions(+), 5 deletions(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index 331ee2b3a8b..357845fb380 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -53,6 +53,11 @@ #include #include +#ifndef CGAL_NO_STRUCTURAL_FILTERING +#include +#include +#endif // no CGAL_NO_STRUCTURAL_FILTERING + namespace CGAL { template < class GT, class TDS > class Periodic_3_triangulation_3; @@ -62,6 +67,28 @@ template < class GT, class TDS > std::istream& operator>> template < class GT, class TDS > std::ostream& operator<< (std::ostream& os, const Periodic_3_triangulation_3 &tr); +#ifndef CGAL_NO_STRUCTURAL_FILTERING +namespace internal { +// structural filtering is performed only for EPIC +struct Periodic_structural_filtering_3_tag {}; +struct No_periodic_structural_filtering_3_tag {}; + +template +struct Periodic_structural_filtering_selector_3 { +#ifdef FORCE_STRUCTURAL_FILTERING + typedef Periodic_structural_filtering_3_tag Tag; +#else + typedef No_periodic_structural_filtering_3_tag Tag; +#endif +}; + +template <> +struct Periodic_structural_filtering_selector_3 { + typedef Periodic_structural_filtering_3_tag Tag; +}; +} +#endif // no CGAL_NO_STRUCTURAL_FILTERING + /**\class Periodic_3_triangulation_3 * * \brief Implements functionality for computing in periodic space. @@ -766,7 +793,62 @@ public: return _tds.are_equal(f.first, f.second, n, j); } //@} - + +#ifdef CGAL_NO_STRUCTURAL_FILTERING + Cell_handle + locate(const Point & p, + Locate_type & lt, int & li, int & lj, + Cell_handle start = Cell_handle()) const; +#else // no CGAL_NO_STRUCTURAL_FILTERING +# ifndef CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS +# define CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS 2500 +# endif // no CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS + +public: + Cell_handle + inexact_locate(const Point& p, + Cell_handle start = Cell_handle(), + int max_num_cells = CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS) const; +protected: + Cell_handle + exact_locate(const Point& p, + Locate_type& lt, + int& li, int & lj, + Cell_handle start) const; + + Cell_handle + generic_locate(const Point& p, + Locate_type& lt, + int& li, int & lj, + Cell_handle start, + internal::Periodic_structural_filtering_3_tag) const { + return exact_locate(p, lt, li, lj, inexact_locate(p, start)); + } + + Cell_handle + generic_locate(const Point& p, + Locate_type& lt, + int& li, int & lj, + Cell_handle start, + internal::No_periodic_structural_filtering_3_tag) const { + return exact_locate(p, lt, li, lj, start); + } + +public: + + Cell_handle + locate(const Point & p, + Locate_type & lt, int & li, int & lj, + Cell_handle start = Cell_handle()) const + { + typedef Triangulation_structural_filtering_traits TSFT; + typedef typename internal::Periodic_structural_filtering_selector_3< + TSFT::Use_structural_filtering_tag::value >::Tag Should_filter_tag; + + return generic_locate(p, lt, li, lj, start, Should_filter_tag()); + } +#endif // no CGAL_NO_STRUCTURAL_FILTERING + protected: /** @name Location helpers */ //@{ Cell_handle periodic_locate(const Point & p, const Offset &o_p, @@ -789,10 +871,10 @@ public: /** Wrapper function calling locate with an empty offset if there was no * offset given. */ - Cell_handle locate(const Point & p, Locate_type & lt, int & li, int & lj, - Cell_handle start = Cell_handle()) const { - return periodic_locate(p, Offset(), lt, li, lj, start); - } +// Cell_handle locate(const Point & p, Locate_type & lt, int & li, int & lj, +// Cell_handle start = Cell_handle()) const { +// return periodic_locate(p, Offset(), lt, li, lj, start); +// } Bounded_side side_of_cell(const Point & p, Cell_handle c, Locate_type & lt, int & i, int & j) const { @@ -1672,6 +1754,32 @@ try_next_cell: return c; } +template < class GT, class TDS > +inline typename Periodic_3_triangulation_3::Cell_handle +Periodic_3_triangulation_3:: +#ifdef CGAL_NO_STRUCTURAL_FILTERING +locate +#else +exact_locate +#endif +(const Point & p, Locate_type & lt, int & li, int & lj, + Cell_handle start) const { + return periodic_locate(p, Offset(), lt, li, lj, start); +} + +#ifndef CGAL_NO_STRUCTURAL_FILTERING +template < class GT, class TDS > +typename Periodic_3_triangulation_3::Cell_handle +Periodic_3_triangulation_3:: +inexact_locate(const Point& p, + Cell_handle start, + int max_num_cells) const +{ + return start; +} +#endif + + /** * returns * ON_BOUNDED_SIDE if p inside the cell From bec402f3c32d31844e56986092f229c3006a9fab Mon Sep 17 00:00:00 2001 From: Aymeric PELLE Date: Tue, 11 Mar 2014 17:24:37 +0100 Subject: [PATCH 02/12] The inexact_locate architecture is applied on periodic_locate function instead. --- .../include/CGAL/Periodic_3_triangulation_3.h | 55 ++++++++----------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index 357845fb380..b3954e69b20 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -796,7 +796,7 @@ public: #ifdef CGAL_NO_STRUCTURAL_FILTERING Cell_handle - locate(const Point & p, + periodic_locate(const Point & p, const Offset &o_p, Locate_type & lt, int & li, int & lj, Cell_handle start = Cell_handle()) const; #else // no CGAL_NO_STRUCTURAL_FILTERING @@ -806,38 +806,38 @@ public: public: Cell_handle - inexact_locate(const Point& p, + inexact_periodic_locate(const Point& p, const Offset &o_p, Cell_handle start = Cell_handle(), int max_num_cells = CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS) const; protected: Cell_handle - exact_locate(const Point& p, + exact_periodic_locate(const Point& p, const Offset &o_p, Locate_type& lt, int& li, int & lj, Cell_handle start) const; Cell_handle - generic_locate(const Point& p, + generic_periodic_locate(const Point& p, const Offset &o_p, Locate_type& lt, int& li, int & lj, Cell_handle start, internal::Periodic_structural_filtering_3_tag) const { - return exact_locate(p, lt, li, lj, inexact_locate(p, start)); + return exact_periodic_locate(p, o_p, lt, li, lj, inexact_periodic_locate(p, o_p, start)); } Cell_handle - generic_locate(const Point& p, + generic_periodic_locate(const Point& p, const Offset &o_p, Locate_type& lt, int& li, int & lj, Cell_handle start, internal::No_periodic_structural_filtering_3_tag) const { - return exact_locate(p, lt, li, lj, start); + return exact_periodic_locate(p, o_p, lt, li, lj, start); } public: Cell_handle - locate(const Point & p, + periodic_locate(const Point & p, const Offset &o_p, Locate_type & lt, int & li, int & lj, Cell_handle start = Cell_handle()) const { @@ -845,14 +845,14 @@ public: typedef typename internal::Periodic_structural_filtering_selector_3< TSFT::Use_structural_filtering_tag::value >::Tag Should_filter_tag; - return generic_locate(p, lt, li, lj, start, Should_filter_tag()); + return generic_periodic_locate(p, o_p, lt, li, lj, start, Should_filter_tag()); } #endif // no CGAL_NO_STRUCTURAL_FILTERING protected: /** @name Location helpers */ //@{ - Cell_handle periodic_locate(const Point & p, const Offset &o_p, - Locate_type & lt, int & li, int & lj, Cell_handle start) const; +// Cell_handle periodic_locate(const Point & p, const Offset &o_p, +// Locate_type & lt, int & li, int & lj, Cell_handle start) const; Bounded_side side_of_cell(const Point & p, const Offset &off, Cell_handle c, Locate_type & lt, int & i, int & j) const; @@ -871,10 +871,10 @@ public: /** Wrapper function calling locate with an empty offset if there was no * offset given. */ -// Cell_handle locate(const Point & p, Locate_type & lt, int & li, int & lj, -// Cell_handle start = Cell_handle()) const { -// return periodic_locate(p, Offset(), lt, li, lj, start); -// } + Cell_handle locate(const Point & p, Locate_type & lt, int & li, int & lj, + Cell_handle start = Cell_handle()) const { + return periodic_locate(p, Offset(), lt, li, lj, start); + } Bounded_side side_of_cell(const Point & p, Cell_handle c, Locate_type & lt, int & i, int & j) const { @@ -1582,9 +1582,14 @@ periodic_triangle(const Cell_handle c, int i) const * returns a vertex (Cell_handle,li) if lt == VERTEX */ template < class GT, class TDS > -typename Periodic_3_triangulation_3::Cell_handle -Periodic_3_triangulation_3::periodic_locate( - const Point & p, const Offset &o_p, +inline typename Periodic_3_triangulation_3::Cell_handle +Periodic_3_triangulation_3:: +#ifdef CGAL_NO_STRUCTURAL_FILTERING +periodic_locate +#else +exact_periodic_locate +#endif +(const Point & p, const Offset &o_p, Locate_type & lt, int & li, int & lj, Cell_handle start) const { int cumm_off = 0; Offset off_query = o_p; @@ -1754,24 +1759,12 @@ try_next_cell: return c; } -template < class GT, class TDS > -inline typename Periodic_3_triangulation_3::Cell_handle -Periodic_3_triangulation_3:: -#ifdef CGAL_NO_STRUCTURAL_FILTERING -locate -#else -exact_locate -#endif -(const Point & p, Locate_type & lt, int & li, int & lj, - Cell_handle start) const { - return periodic_locate(p, Offset(), lt, li, lj, start); -} #ifndef CGAL_NO_STRUCTURAL_FILTERING template < class GT, class TDS > typename Periodic_3_triangulation_3::Cell_handle Periodic_3_triangulation_3:: -inexact_locate(const Point& p, +inexact_periodic_locate(const Point& p, const Offset& o_p, Cell_handle start, int max_num_cells) const { From 2175dd4237c1d2fd4c0f0450ee17e12b92a601a6 Mon Sep 17 00:00:00 2001 From: Aymeric PELLE Date: Tue, 11 Mar 2014 18:46:06 +0100 Subject: [PATCH 03/12] In P3T3, inexact_periodic_locate is done. inexact_locate() have to be done now. --- .../include/CGAL/Periodic_3_triangulation_3.h | 165 +++++++++++++++++- 1 file changed, 164 insertions(+), 1 deletion(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index b3954e69b20..ef3a793a494 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -834,6 +834,50 @@ protected: return exact_periodic_locate(p, o_p, lt, li, lj, start); } + Orientation + inexact_orientation(const Point &p, const Point &q, + const Point &r, const Point &s) const + { + const double px = to_double(p.x()); + const double py = to_double(p.y()); + const double pz = to_double(p.z()); + const double qx = to_double(q.x()); + const double qy = to_double(q.y()); + const double qz = to_double(q.z()); + const double rx = to_double(r.x()); + const double ry = to_double(r.y()); + const double rz = to_double(r.z()); + const double sx = to_double(s.x()); + const double sy = to_double(s.y()); + const double sz = to_double(s.z()); + + const double pqx = qx - px; + const double pqy = qy - py; + const double pqz = qz - pz; + const double prx = rx - px; + const double pry = ry - py; + const double prz = rz - pz; + const double psx = sx - px; + const double psy = sy - py; + const double psz = sz - pz; + + const double det = determinant(pqx, pqy, pqz, + prx, pry, prz, + psx, psy, psz); + if (det > 0) return POSITIVE; + if (det < 0) return NEGATIVE; + return ZERO; + } + + Orientation + inexact_orientation(const Point &p, const Point &q, + const Point &r, const Point &s, + const Offset& o_p, const Offset& o_q, + const Offset& o_r, const Offset& o_s) const + { + return inexact_orientation(p+o_p, q+o_q, r+o_r, s+o_s); + } + public: Cell_handle @@ -1768,7 +1812,126 @@ inexact_periodic_locate(const Point& p, const Offset& o_p, Cell_handle start, int max_num_cells) const { - return start; + int cumm_off = 0; + Offset off_query = o_p; + if (number_of_vertices() == 0) { + return Cell_handle(); + } + CGAL_triangulation_assertion(number_of_vertices() != 0); + + if (start == Cell_handle()) { + start = cells_begin(); + } + + cumm_off = start->offset(0) | start->offset(1) + | start->offset(2) | start->offset(3); + if (is_1_cover() && cumm_off != 0) { + if (((cumm_off & 4) == 4) && (FT(2)*p.x()<(_domain.xmax()+_domain.xmin()))) + off_query += Offset(1,0,0); + if (((cumm_off & 2) == 2) && (FT(2)*p.y()<(_domain.ymax()+_domain.ymin()))) + off_query += Offset(0,1,0); + if (((cumm_off & 1) == 1) && (FT(2)*p.z()<(_domain.zmax()+_domain.zmin()))) + off_query += Offset(0,0,1); + } + + CGAL_triangulation_postcondition(start!=Cell_handle()); + CGAL_triangulation_assertion(start->neighbor(0)->neighbor( + start->neighbor(0)->index(start))==start); + CGAL_triangulation_assertion(start->neighbor(1)->neighbor( + start->neighbor(1)->index(start))==start); + CGAL_triangulation_assertion(start->neighbor(2)->neighbor( + start->neighbor(2)->index(start))==start); + CGAL_triangulation_assertion(start->neighbor(3)->neighbor( + start->neighbor(3)->index(start))==start); + + // We implement the remembering visibility/stochastic walk. + + // Remembers the previous cell to avoid useless orientation tests. + Cell_handle previous = Cell_handle(); + Cell_handle c = start; + + boost::rand48 rng; + boost::uniform_smallint<> four(0, 3); + boost::variate_generator > die4(rng, four); + + + // Now treat the cell c. +try_next_cell: + // For the remembering stochastic walk, + // we need to start trying with a random index : + int i = die4(); + // For the remembering visibility walk (Delaunay only), we don't : + // int i = 0; + + cumm_off = + c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); + + bool simplicity_criterion = (cumm_off == 0) && (off_query.is_null()); + + // We know that the 4 vertices of c are positively oriented. + // So, in order to test if p is seen outside from one of c's facets, + // we just replace the corresponding point by p in the orientation + // test. We do this using the arrays below. + + Offset off[4]; + const Point* pts[4] = { &(c->vertex(0)->point()), + &(c->vertex(1)->point()), + &(c->vertex(2)->point()), + &(c->vertex(3)->point()) }; + + if (!simplicity_criterion && is_1_cover() ) { + for (int i=0; i<4; i++) { + off[i] = int_to_off(c->offset(i)); + } + } + + if (!is_1_cover()) { + // Just fetch the vertices of c as points with offsets + for (int i=0; i<4; i++) { + pts[i] = &(c->vertex(i)->point()); + off[i] = get_offset(c,i); + } + } + + for (int i=0; i != 4; ++i) { + Cell_handle next = c->neighbor(i); + if (previous == next) { + continue; + } + + // We temporarily put p at i's place in pts. + const Point* backup = pts[i]; + pts[i] = &p; + + if (simplicity_criterion && is_1_cover() ) { + if ( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3]) != NEGATIVE ) { + pts[i] = backup; + continue; + } + } + else { + Offset backup_off; + + backup_off = off[i]; + off[i] = off_query; + + if ( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3], + off[0], off[1], off[2], off[3]) != NEGATIVE ) { + pts[i] = backup; + off[i] = backup_off; + continue; + } + } + + // Test whether we need to adapt the offset of the query point. + // This means, if we get out of the current cover. + off_query = combine_offsets(off_query, get_neighbor_offset(c,i,next)); + previous = c; + c = next; + goto try_next_cell; + } + + return c; } #endif From acbeac0983706e95897e06661d3283f6e25cd53f Mon Sep 17 00:00:00 2001 From: Aymeric PELLE Date: Tue, 11 Mar 2014 18:57:52 +0100 Subject: [PATCH 04/12] In p3T3, inexact_locate() is added. --- .../include/CGAL/Periodic_3_triangulation_3.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index ef3a793a494..080174a27d9 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -891,6 +891,14 @@ public: return generic_periodic_locate(p, o_p, lt, li, lj, start, Should_filter_tag()); } + + Cell_handle + inexact_locate(const Point& p, + Cell_handle start = Cell_handle(), + int max_num_cells = CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS) const + { + return inexact_periodic_locate(p, Offset(), start, max_num_cells); + } #endif // no CGAL_NO_STRUCTURAL_FILTERING protected: From 43c826d66607ebaaad16f89a75c61bf7406ed856 Mon Sep 17 00:00:00 2001 From: Aymeric PELLE Date: Thu, 13 Mar 2014 16:30:16 +0100 Subject: [PATCH 05/12] Add inexact_locate() documentation. --- .../CGAL/Periodic_3_triangulation_3.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h index 3d656afcfa8..3188fd9e076 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h @@ -785,6 +785,21 @@ search. Cell_handle locate(const Point & query, Cell_handle start = Cell_handle()) const; + +/*! +Same as `locate()` but uses inexact predicates. +This function returns a handle on a cell that is a good approximation of the exact +location of `query`, while being faster. Note that it may return a handle on a cell +whose interior does not contain `query`. + +Note that this function is available only if the cartesian coordinates of `query` +are accessible with functions `x()`, `y()` and `z()`.} + +*/ +Cell_handle +inexact_locate(const Point & query, Cell_handle start = Cell_handle()) const; + + /*! The \f$ k\f$-face that contains `query` in its interior is returned, by means of the cell returned together with `lt`, which From 9666fec5376c7b989a8f945fdc6e3f62c25242eb Mon Sep 17 00:00:00 2001 From: Aymeric PELLE Date: Tue, 18 Mar 2014 17:42:25 +0100 Subject: [PATCH 06/12] Small correction in the documentation of inexact_locate(). --- .../CGAL/Periodic_3_triangulation_3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h index 3188fd9e076..79e8063b83b 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h @@ -792,8 +792,8 @@ This function returns a handle on a cell that is a good approximation of the exa location of `query`, while being faster. Note that it may return a handle on a cell whose interior does not contain `query`. -Note that this function is available only if the cartesian coordinates of `query` -are accessible with functions `x()`, `y()` and `z()`.} +Note that this function is available only if the Cartesian coordinates of `query` +are accessible with functions `x()`, `y()` and `z()`. */ Cell_handle From d1572615b55a223f81e5738f7e996bce87d9e7ef Mon Sep 17 00:00:00 2001 From: Aymeric PELLE Date: Thu, 20 Mar 2014 11:50:39 +0100 Subject: [PATCH 07/12] Fix : Cartesian isn't auto-linked to the Cartesian page anymore. Cartesian -> %Cartesian --- .../CGAL/Periodic_3_triangulation_3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h index 79e8063b83b..fbff89e130f 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h @@ -788,13 +788,13 @@ locate(const Point & query, Cell_handle start = Cell_handle()) const; /*! Same as `locate()` but uses inexact predicates. + This function returns a handle on a cell that is a good approximation of the exact location of `query`, while being faster. Note that it may return a handle on a cell whose interior does not contain `query`. -Note that this function is available only if the Cartesian coordinates of `query` +Note that this function is available only if the %Cartesian coordinates of `query` are accessible with functions `x()`, `y()` and `z()`. - */ Cell_handle inexact_locate(const Point & query, Cell_handle start = Cell_handle()) const; From c05c4c56f15189e6e43457461fbebd2dc581ebf9 Mon Sep 17 00:00:00 2001 From: Aymeric PELLE Date: Mon, 7 Apr 2014 10:11:36 +0200 Subject: [PATCH 08/12] Fix bug in inexact_orientation. We use construction_point() instead of doing a fail addition between point and offset. --- .../include/CGAL/Periodic_3_triangulation_3.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index 080174a27d9..431042cf223 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -875,7 +875,10 @@ protected: const Offset& o_p, const Offset& o_q, const Offset& o_r, const Offset& o_s) const { - return inexact_orientation(p+o_p, q+o_q, r+o_r, s+o_s); + return inexact_orientation(construct_point(p, o_p), + construct_point(q, o_q), + construct_point(r, o_r), + construct_point(s, o_s)); } public: From 830cea27e09b2149bf0a7a48fa7af3cbd5f1915c Mon Sep 17 00:00:00 2001 From: Aymeric PELLE Date: Mon, 7 Apr 2014 16:16:53 +0200 Subject: [PATCH 09/12] Add a test for inexact_locate in Periodic_3_triangulation_3. --- .../include/CGAL/_test_cls_periodic_3_triangulation_3.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_triangulation_3.h index 3a506dfcd26..55cd16f9cb7 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_triangulation_3.h @@ -396,6 +396,11 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &, assert(!PT3.are_equal(Facet(ch,1),nb,i)); std::cout<<"Point location"< Date: Tue, 8 Apr 2014 16:21:51 +0200 Subject: [PATCH 10/12] Adds the changes in the file Installation/changes.html. --- Installation/changes.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Installation/changes.html b/Installation/changes.html index 811f0ade56c..ed39e0a5780 100644 --- a/Installation/changes.html +++ b/Installation/changes.html @@ -199,6 +199,12 @@ and src/ directories). +

3D Periodic Triangulations

+
    +
  • Add a method to locate point with inexact predicates. +
  • +
+

3D Alpha Shapes

  • Add member functions in CGAL::Alpha_shape_3 to give From 7259c7643489cfadeedd7f69012775f8fec3cb5b Mon Sep 17 00:00:00 2001 From: Aymeric PELLE Date: Wed, 9 Apr 2014 17:01:49 +0200 Subject: [PATCH 11/12] Fix warning : Some variables weren't unused in inexact_periodic_locate. --- .../include/CGAL/Periodic_3_triangulation_3.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index 431042cf223..01344051675 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -1861,19 +1861,8 @@ inexact_periodic_locate(const Point& p, const Offset& o_p, Cell_handle previous = Cell_handle(); Cell_handle c = start; - boost::rand48 rng; - boost::uniform_smallint<> four(0, 3); - boost::variate_generator > die4(rng, four); - - // Now treat the cell c. try_next_cell: - // For the remembering stochastic walk, - // we need to start trying with a random index : - int i = die4(); - // For the remembering visibility walk (Delaunay only), we don't : - // int i = 0; - cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); From 4910a198f2650d4ffd0cf7f1b687c8a135d6b820 Mon Sep 17 00:00:00 2001 From: Aymeric PELLE Date: Tue, 15 Apr 2014 15:11:07 +0200 Subject: [PATCH 12/12] periodic_inexact_locate stops also if the max num of turns is reached. --- .../include/CGAL/Periodic_3_triangulation_3.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index 01344051675..767a914f698 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -1821,7 +1821,7 @@ typename Periodic_3_triangulation_3::Cell_handle Periodic_3_triangulation_3:: inexact_periodic_locate(const Point& p, const Offset& o_p, Cell_handle start, - int max_num_cells) const + int n_of_turns) const { int cumm_off = 0; Offset off_query = o_p; @@ -1863,6 +1863,7 @@ inexact_periodic_locate(const Point& p, const Offset& o_p, // Now treat the cell c. try_next_cell: + --n_of_turns; cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); @@ -1928,7 +1929,8 @@ try_next_cell: off_query = combine_offsets(off_query, get_neighbor_offset(c,i,next)); previous = c; c = next; - goto try_next_cell; + if (n_of_turns) + goto try_next_cell; } return c;