diff --git a/Convex_hull_2/include/CGAL/convex_hull_traits_2.h b/Convex_hull_2/include/CGAL/convex_hull_traits_2.h index 125188a2517..699d9583ad5 100644 --- a/Convex_hull_2/include/CGAL/convex_hull_traits_2.h +++ b/Convex_hull_2/include/CGAL/convex_hull_traits_2.h @@ -27,7 +27,6 @@ #include - #include #include #include diff --git a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h index 404b1dd30c3..9eb74144142 100644 --- a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h @@ -650,7 +650,6 @@ Labeled_mesh_domain_3::Construct_initial_points::operator()( typedef Random_points_on_sphere_3 Random_points_on_sphere_3; typedef Random_points_in_sphere_3 Random_points_in_sphere_3; - const FT squared_radius = BGT().compute_squared_radius_3_object()( r_domain_.bounding_sphere(r_domain_.bbox_)); diff --git a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h index dcf78307d39..2e6a2da4124 100644 --- a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h @@ -960,7 +960,7 @@ public: private: // ----------------------------------- - // Usefull Functors + // Useful Functors // ----------------------------------- /** * @class Get_all_facets @@ -1089,7 +1089,7 @@ private: /** * @class Update_c3t3 * - * A functor which updates c3t3 w.r.t the domain. + * A functor which updates c3t3 w.r.t. the domain. */ class Update_c3t3 { diff --git a/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h b/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h index 89d3132cc9c..3cb078828d0 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h +++ b/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h @@ -27,7 +27,6 @@ #include - #include #include @@ -45,34 +44,32 @@ template > class Lloyd_move { - typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits Gt; - - typedef typename Tr::Cell_handle Cell_handle; - typedef typename Tr::Vertex_handle Vertex_handle; - typedef typename Tr::Edge Edge; - typedef typename Tr::Facet Facet; - typedef typename Tr::Weighted_point Weighted_point; - typedef typename Tr::Bare_point Bare_point; - - typedef typename std::vector Cell_vector; - typedef typename std::vector Vertex_vector; - typedef typename std::vector Facet_vector; - - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; - typedef typename Gt::Tetrahedron_3 Tetrahedron_3; - typedef typename Gt::Plane_3 Plane_3; - typedef typename Gt::Point_2 Point_2; - - typedef typename Gt::Aff_transformation_3 Aff_transformation_3; - + typedef typename C3T3::Triangulation Tr; + typedef typename Tr::Geom_traits Gt; + + typedef typename Tr::Vertex_handle Vertex_handle; + typedef typename Tr::Edge Edge; + typedef typename Tr::Facet Facet; + typedef typename Tr::Cell_handle Cell_handle; + + typedef typename Tr::Bare_point Bare_point; + + typedef typename std::vector Facet_vector; + typedef typename std::vector Cell_vector; + + typedef typename Gt::FT FT; + typedef typename Gt::Point_2 Point_2; + typedef typename Gt::Vector_3 Vector_3; + typedef typename Gt::Tetrahedron_3 Tetrahedron_3; + typedef typename Gt::Plane_3 Plane_3; + typedef typename Gt::Aff_transformation_3 Aff_transformation_3; + public: - typedef SizingField Sizing_field; + typedef SizingField Sizing_field; /** - * @brief Return move to apply on \c v according to Lloyd optimization - * function + * @brief Return the move to apply on \c v according to Lloyd optimization + * function. */ Vector_3 operator()(const Vertex_handle& v, const Cell_vector& incident_cells, @@ -112,7 +109,7 @@ public: private: /** - * Project_on_plane defines operator() to project point object on plane. + * Project_on_plane defines `operator()` to project a point object on the plane `plane`. */ struct Project_on_plane { @@ -130,7 +127,7 @@ private: }; /** - * To_2d defines operator() to transform Bare_point into Point_2 + * `To_2d` defines `operator()` to transform from `Bare_point` to `Point_2`. */ struct To_2d { @@ -142,24 +139,24 @@ private: private: const Aff_transformation_3& to_2d_; }; - + /** - * To_3d defines operator() to transform Point_2 into Bare_point + * `To_3d` defines `operator()` to transform from `Point_2` to `Bare_point`. */ struct To_3d { To_3d(const Aff_transformation_3& to_3d) : to_3d_(to_3d) {} - + Bare_point operator()(const Point_2& p) const { return to_3d_.transform((Bare_point(p.x(),p.y(),0))); } - + private: const Aff_transformation_3& to_3d_; }; - - + + /** - * Return move for inside vertex \c v + * Return the move for the inside vertex \c v. */ Vector_3 lloyd_move_inside_domain(const Vertex_handle& v, const Cell_vector& incident_cells, @@ -202,7 +199,7 @@ private: } /** - * Return move for on boundary vertex \c v + * Return the move for the on-boundary vertex \c v. */ Vector_3 lloyd_move_on_boundary(const Vertex_handle& v, const C3T3& c3t3, @@ -221,7 +218,7 @@ private: return CGAL::NULL_VECTOR; break; } - case 2: // centroid + case 2: // segment centroid { const Bare_point& a = points.front(); const Bare_point& b = points.back(); @@ -245,8 +242,8 @@ private: } /** - * Returns a vector containing surface delaunay ball center of surface - * facets incident to vertex \c v + * Returns a vector containing the surface delaunay ball centers of the surface + * facets that are incident to vertex \c v. */ std::vector extract_lloyd_boundary_points(const Vertex_handle& v, const C3T3& c3t3) const @@ -254,10 +251,10 @@ private: Facet_vector incident_facets; incident_facets.reserve(64); c3t3.triangulation().finite_incident_facets(v,std::back_inserter(incident_facets)); - + std::vector points; points.reserve(64); - + // Get c3t3's facets incident to v, and add their surface delaunay ball // center to output for ( typename Facet_vector::iterator fit = incident_facets.begin() ; @@ -269,12 +266,12 @@ private: points.push_back(fit->first->get_facet_surface_center(fit->second)); } - + return points; } /** - * Return move from \c v to centroid of segment [a,b] + * Return the move from \c v to the centroid of the segment [a,b]. */ Vector_3 centroid_segment_move(const Vertex_handle& v, const Bare_point& a, @@ -282,22 +279,22 @@ private: const C3T3& c3t3, const Sizing_field& sizing_field) const { + typename Gt::Construct_point_3 cp = + c3t3.triangulation().geom_traits().construct_point_3_object(); typename Gt::Construct_vector_3 vector = c3t3.triangulation().geom_traits().construct_vector_3_object(); - typename Gt::Construct_point_3 wp2p = - c3t3.triangulation().geom_traits().construct_point_3_object(); - const Bare_point& p = wp2p(v->point()); + const Bare_point& p = cp(v->point()); FT da = density_1d(a,v,sizing_field); FT db = density_1d(b,v,sizing_field); - CGAL_assertion( !is_zero(da+db) ); + CGAL_assertion( !is_zero(da+db) ); return ( (vector(p,a)*da + vector(p,b)*db) / (da+db) ); } /** - * Return move from \c v to centroid of triangle [a,b,c] + * Return the move from \c v to the centroid of triangle [a,b,c]. */ Vector_3 centroid_triangle_move(const Vertex_handle& v, const Bare_point& a, @@ -308,11 +305,11 @@ private: { typename Gt::Construct_vector_3 vector = c3t3.triangulation().geom_traits().construct_vector_3_object(); - typename Gt::Construct_point_3 wp2p = + typename Gt::Construct_point_3 cp = c3t3.triangulation().geom_traits().construct_point_3_object(); - const Bare_point& p = wp2p(v->point()); - + const Bare_point& p = cp(v->point()); + FT da = density_2d(a,v,sizing_field); FT db = density_2d(b,v,sizing_field); FT dc = density_2d(c,v,sizing_field); @@ -322,9 +319,9 @@ private: } /** - * compute approximate centroid of intersection between 3D voronoi cell and - * boundary. The input is the set of intersection points between Voronoi - * edges and the boundary. + * Compute the approximate centroid of the intersection between the 3D voronoi + * cell and the boundary. The input is the set of intersection points between + * Voronoi edges and the boundary. */ template Vector_3 centroid_general_move(const Vertex_handle& v, @@ -334,7 +331,7 @@ private: const Sizing_field& sizing_field) const { CGAL_assertion(std::distance(first,last) > 3); - + // Fit plane using point-based PCA: compute least square fitting plane Plane_3 plane; Bare_point point; @@ -345,16 +342,16 @@ private: // Project all points to the plane std::transform(first, last, first, Project_on_plane(plane, c3t3)); CGAL_assertion(std::distance(first,last) > 3); - + // Get 2D-3D transformations Aff_transformation_3 to_3d = compute_to_3d_transform(plane, *first, c3t3); Aff_transformation_3 to_2d = to_3d.inverse(); - + // Transform to 2D std::vector points_2d; points_2d.reserve(std::distance(first,last)); std::transform(first, last, std::back_inserter(points_2d), To_2d(to_2d)); - + // Compute 2D convex hull CGAL_assertion(points_2d.size() > 3); std::vector ch_2d; @@ -362,21 +359,21 @@ private: // as it triggers filter failures unnecessarily CGAL::ch_graham_andrew(points_2d.begin(),points_2d.end(), std::back_inserter(ch_2d)); - - // Lift back convex hull to 3D + + // Lift back convex hull to 3D std::vector polygon_3d; polygon_3d.reserve(ch_2d.size()); std::transform(ch_2d.begin(), ch_2d.end(), std::back_inserter(polygon_3d), To_3d(to_3d)); - + // Compute centroid using quadrature sizing return centroid_3d_polygon_move(v, polygon_3d.begin(), polygon_3d.end(), c3t3, sizing_field); } - + /** - * Return move from \c v to centroid of polygon[first,last] - * Polygon has to be convex + * Return the move from \c v to the centroid of polygon[first,last]. + * The polygon has to be convex. */ template Vector_3 centroid_3d_polygon_move(const Vertex_handle& v, @@ -386,7 +383,7 @@ private: const Sizing_field& sizing_field) const { CGAL_precondition(std::distance(first,last) >= 3); - + typename Gt::Construct_vector_3 vector = c3t3.triangulation().geom_traits().construct_vector_3_object(); typename Gt::Construct_centroid_3 centroid = @@ -398,7 +395,7 @@ private: // Vertex current position const Bare_point& vertex_position = cp(v->point()); - + // Use as reference point to triangulate const Bare_point& a = *first++; const Bare_point* b = &(*first++); @@ -435,7 +432,7 @@ private: } /** - * Returns the transformation from reference_point to plane + * Return the transformation from `reference_point` to `plane`. */ Aff_transformation_3 compute_to_3d_transform(const Plane_3& plane, const Bare_point& reference_point, @@ -461,7 +458,7 @@ private: } /** - * returns density_1d + * Return density_1d */ template FT density_1d(const Bare_point& p, @@ -476,7 +473,7 @@ private: } /** - * returns density_2d + * Return density_2d */ template FT density_2d(const Bare_point& p, @@ -491,7 +488,7 @@ private: } /** - * returns density_3d + * Return density_3d */ template FT density_3d(const Bare_point& p, @@ -506,8 +503,8 @@ private: } /** - * Turns around edge \c edge and add values computed from tets made by - * v->point() and circumcenters of the cells incident to \c edge + * Turn around the edge \c edge and add the values computed from tets made by + * v->point() and the circumcenters of cells incident to \c edge. * * Note that this function abundantly uses dual() calls and using a cell base * which stores the circumcenter thus improves its efficiency. @@ -526,7 +523,7 @@ private: typename Gt::Compute_volume_3 volume = tr.geom_traits().compute_volume_3_object(); typename Gt::Construct_centroid_3 centroid = tr.geom_traits().construct_centroid_3_object(); typename Gt::Construct_vector_3 vector = tr.geom_traits().construct_vector_3_object(); - typename Gt::Construct_point_3 wp2p = tr.geom_traits().construct_point_3_object(); + typename Gt::Construct_point_3 cp = tr.geom_traits().construct_point_3_object(); // typename Gt::Construct_tetrahedron_3 tetrahedron = @@ -540,22 +537,22 @@ private: Cell_circulator done = current_cell; // a & b are fixed points - const Bare_point& a = wp2p(v->point()); + const Bare_point& a = cp(v->point()); // const Bare_point b = tr.dual(current_cell); - const Bare_point a_b = wp2p(tr.point(current_cell, current_cell->index(v))); + const Bare_point a_b = cp(tr.point(current_cell, current_cell->index(v))); Vector_3 ba = Vector_3(a_b, b); - current_cell++; + ++current_cell; // CGAL_assertion(current_cell != done); // c & d are moving points // Bare_point c = tr.dual(current_cell); - Bare_point a_c = wp2p(tr.point(current_cell, current_cell->index(v))); + Bare_point a_c = cp(tr.point(current_cell, current_cell->index(v))); Vector_3 ca = Vector_3(a_c, c); - current_cell++; + ++current_cell; // CGAL_assertion(current_cell != done); @@ -564,9 +561,9 @@ private: { // const Bare_point d = tr.dual(current_cell); - const Bare_point a_d = wp2p(tr.point(current_cell, current_cell->index(v))); + const Bare_point a_d = cp(tr.point(current_cell, current_cell->index(v))); Vector_3 da = Vector_3(a_d, d); - current_cell++; + ++current_cell; Tetrahedron_3 tet = tetrahedron(a, translate(a, ba), translate(a, ca), translate(a, da)); @@ -575,10 +572,10 @@ private: // Compute mass FT density = density_3d(tet_centroid, current_cell, sizing_field); - FT abs_volume = CGAL::abs(volume(a,b,c,d)); + FT abs_volume = CGAL::abs(volume(tet)); FT mass = abs_volume * density; - move = move + mass * vector(a,tet_centroid); + move = move + mass * vector(a, tet_centroid); sum_masses += mass; c = d; diff --git a/Mesh_3/include/CGAL/Mesh_3/Odt_move.h b/Mesh_3/include/CGAL/Mesh_3/Odt_move.h index b6e19a0f0f0..ac724d5c9e3 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Odt_move.h +++ b/Mesh_3/include/CGAL/Mesh_3/Odt_move.h @@ -27,7 +27,6 @@ #include - #include #include @@ -36,32 +35,29 @@ namespace CGAL { - namespace Mesh_3 { - template > class Odt_move { - typedef typename C3T3::Triangulation Tr; - typedef typename Tr::Geom_traits Gt; - - typedef typename Tr::Cell_handle Cell_handle; - typedef typename Tr::Vertex_handle Vertex_handle; - typedef typename Tr::Facet Facet; - typedef typename Tr::Weighted_point Weighted_point; - typedef typename Tr::Bare_point Bare_point; - - typedef typename std::vector Cell_vector; - typedef typename std::vector Vertex_vector; - typedef typename std::vector Facet_vector; - - typedef typename Gt::FT FT; - typedef typename Gt::Vector_3 Vector_3; + typedef typename C3T3::Triangulation Tr; + typedef typename Tr::Geom_traits Gt; + + typedef typename Tr::Vertex_handle Vertex_handle; + typedef typename Tr::Facet Facet; + typedef typename Tr::Cell_handle Cell_handle; + + typedef typename Tr::Bare_point Bare_point; + + typedef typename std::vector Facet_vector; + typedef typename std::vector Cell_vector; + + typedef typename Gt::FT FT; + typedef typename Gt::Vector_3 Vector_3; public: - typedef SizingField Sizing_field; + typedef SizingField Sizing_field; Vector_3 operator()(const Vertex_handle& v, const Cell_vector& incident_cells, diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h index e74e81fbc3d..b7cc63be37d 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h @@ -1606,8 +1606,8 @@ compute_facet_properties(const Facet& facet, // Trick to have canonical vector : thus, we compute always the same // intersection Segment_3 segment = ( compare_xyz(p1, p2)== CGAL::SMALLER ) - ? construct_segment(p1, p2) - : construct_segment(p2, p1); + ? construct_segment(p1, p2) + : construct_segment(p2, p1); // If facet is on surface, compute intersection point and return true #ifndef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3 diff --git a/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h b/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h index 3fc8cd4982c..a871bbca59d 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h @@ -182,7 +182,7 @@ no_topological_change(const Tr& tr, if(c->is_facet_visited(j)) continue; - // Set facet and it's mirror's one visited + // Set facet and its mirrored version as visited Cell_handle cj = c->neighbor(j); int mj = tr.mirror_index(c, j); c->set_facet_visited(j); @@ -349,8 +349,8 @@ inside_protecting_balls(const Tr& tr, } -/// This function well_oriented is called by no_topological_change after a -/// v->set_point(p) +/// This function well_oriented is called by no_topological_change after the +/// position of the vertex has been (tentatively) modified. template bool Triangulation_helpers:: diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h index 7e5066587a9..825a2013e1a 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h @@ -57,48 +57,51 @@ class Periodic_3_regular_triangulation_3_mesher_3 : public Periodic_3_regular_triangulation_3 { public: - typedef Sequential_tag Concurrency_tag; - typedef void Lock_data_structure; + typedef Sequential_tag Concurrency_tag; + typedef void Lock_data_structure; void *get_lock_data_structure() const { return 0; } void set_lock_data_structure(void *) const { } - typedef Periodic_3_regular_triangulation_3 Base; + typedef Periodic_3_regular_triangulation_3 Base; - typedef Gt Geom_traits; - typedef Tds Triangulation_data_structure; + typedef Gt Geom_traits; + typedef Tds Triangulation_data_structure; - typedef typename Base::Cell_iterator Finite_cells_iterator; - typedef typename Base::Facet_iterator Finite_facets_iterator; - typedef typename Base::Edge_iterator Finite_edges_iterator; - typedef typename Base::Vertex_iterator Finite_vertices_iterator; + typedef typename Base::Cell_iterator Finite_cells_iterator; + typedef typename Base::Facet_iterator Finite_facets_iterator; + typedef typename Base::Edge_iterator Finite_edges_iterator; + typedef typename Base::Vertex_iterator Finite_vertices_iterator; - typedef typename Base::Vertex_handle Vertex_handle; - typedef typename Base::Cell_handle Cell_handle; - typedef typename Base::Facet Facet; - typedef typename Base::Edge Edge; + typedef typename Base::Vertex_handle Vertex_handle; + typedef typename Base::Edge Edge; + typedef typename Base::Facet Facet; + typedef typename Base::Cell_handle Cell_handle; - typedef typename Base::FT FT; + typedef typename Base::FT FT; - typedef typename Base::Bare_point Bare_point; - typedef typename Base::Weighted_point Weighted_point; - typedef typename Base::Periodic_bare_point Periodic_bare_point; - typedef typename Base::Periodic_weighted_point Periodic_weighted_point; + typedef typename Base::Bare_point Bare_point; + typedef typename Base::Weighted_point Weighted_point; + typedef typename Base::Periodic_bare_point Periodic_bare_point; + typedef typename Base::Periodic_weighted_point Periodic_weighted_point; - typedef typename Base::Locate_type Locate_type; + typedef typename Base::Locate_type Locate_type; - typedef typename Base::Segment Segment; - typedef typename Base::Periodic_segment Periodic_segment; + typedef typename Base::Segment Segment; + typedef typename Base::Periodic_segment Periodic_segment; - typedef typename Base::Tetrahedron Tetrahedron; - typedef typename Base::Periodic_tetrahedron Periodic_tetrahedron; + typedef typename Base::Triangle Triangle; + typedef typename Base::Periodic_triangle Periodic_triangle; + typedef typename Base::Tetrahedron Tetrahedron; + typedef typename Base::Periodic_tetrahedron Periodic_tetrahedron; - typedef typename Base::Offset Offset; - typedef typename Base::Iso_cuboid Iso_cuboid; - typedef typename Base::Conflict_tester Conflict_tester; - typedef typename Base::Covering_sheets Covering_sheets; + typedef typename Base::Offset Offset; + typedef typename Base::Iso_cuboid Iso_cuboid; + typedef typename Base::Conflict_tester Conflict_tester; + typedef typename Base::Covering_sheets Covering_sheets; - typedef typename Gt::Ray_3 Ray; + typedef typename Gt::Vector_3 Vector_3; + typedef typename Gt::Ray_3 Ray; using Base::construct_point; using Base::construct_weighted_point; diff --git a/Periodic_3_mesh_3/include/CGAL/make_periodic_3_mesh_3.h b/Periodic_3_mesh_3/include/CGAL/make_periodic_3_mesh_3.h index 0e87511c494..e047114e38f 100644 --- a/Periodic_3_mesh_3/include/CGAL/make_periodic_3_mesh_3.h +++ b/Periodic_3_mesh_3/include/CGAL/make_periodic_3_mesh_3.h @@ -229,7 +229,7 @@ void init_domain(C3T3& c3t3, MD& oracle) typename Tr::Geom_traits::Construct_point_3 wp2p = tr.geom_traits().construct_point_3_object(); - // At this point, the triangulation contains the dummy point. + // At this point, the triangulation contains the dummy points. // Mark them all as corners so they are kept throughout the refinement. // [ Does that really matter ? @fixme ] diff --git a/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h b/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h index 19eff21bc27..1cf83fbebf0 100644 --- a/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h +++ b/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h @@ -154,8 +154,6 @@ void refine_periodic_3_mesh_3_impl(C3T3& c3t3, // Perturbation if ( perturb ) { - std::cout << "perturb" << std::endl; - double perturb_time_limit = refine_time; if ( perturb.is_time_limit_set() ) @@ -169,7 +167,6 @@ void refine_periodic_3_mesh_3_impl(C3T3& c3t3, dump_c3t3(c3t3, mesh_options.dump_after_perturb_prefix); } -#if 1 // regular stuff is not yet supported by periodic triangulations // Exudation if ( exude ) { @@ -184,7 +181,6 @@ void refine_periodic_3_mesh_3_impl(C3T3& c3t3, dump_c3t3(c3t3, mesh_options.dump_after_perturb_prefix); } -#endif } } // end namespace CGAL diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h index 864b4b250e2..2e6a69c10fe 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h @@ -62,16 +62,16 @@ template < class Gt, class Periodic_3_regular_triangulation_3 : public Periodic_3_triangulation_3 { - typedef Periodic_3_regular_triangulation_3 Self; + typedef Periodic_3_regular_triangulation_3 Self; public: - typedef Periodic_3_triangulation_3 Tr_Base; + typedef Periodic_3_triangulation_3 Tr_Base; - typedef Gt Geometric_traits; - typedef Geometric_traits Geom_traits; - typedef Tds Triangulation_data_structure; + typedef Gt Geometric_traits; + typedef Geometric_traits Geom_traits; + typedef Tds Triangulation_data_structure; - typedef typename Gt::FT FT; + typedef typename Gt::FT FT; typedef typename Tr_Base::Periodic_segment_3 Periodic_segment_3; typedef typename Tr_Base::Periodic_triangle_3 Periodic_triangle_3; @@ -158,6 +158,7 @@ public: using Tr_Base::facets_end; using Tr_Base::cells_begin; using Tr_Base::cells_end; + using Tr_Base::construct_point; using Tr_Base::construct_periodic_point; #endif @@ -801,6 +802,13 @@ public: Vertex_handle nearest_power_vertex(const Bare_point& p, Cell_handle start) const { + CGAL_triangulation_precondition(p.x() < domain().xmax()); + CGAL_triangulation_precondition(p.y() < domain().ymax()); + CGAL_triangulation_precondition(p.z() < domain().zmax()); + CGAL_triangulation_precondition(p.x() >= domain().xmin()); + CGAL_triangulation_precondition(p.y() >= domain().ymin()); + CGAL_triangulation_precondition(p.z() >= domain().zmin()); + if(number_of_vertices() == 0) return Vertex_handle(); @@ -809,9 +817,11 @@ public: typename Gt::Construct_weighted_point_3 p2wp = geom_traits().construct_weighted_point_3_object(); + Cell_handle c = locate(p2wp(p), lt, li, lj, start); if(lt == Tr_Base::VERTEX) return c->vertex(li); + const Conflict_tester tester(p2wp(p), this); Offset o = combine_offsets(Offset(), get_location_offset(tester, c)); 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 273dc03a9e6..ff1e02a2de9 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 @@ -415,9 +415,9 @@ public: // Offset converters int off_to_int(const Offset& off) const { - CGAL_triangulation_assertion( off.x()==0 || off.x() ==1 ); - CGAL_triangulation_assertion( off.y()==0 || off.y() ==1 ); - CGAL_triangulation_assertion( off.z()==0 || off.z() ==1 ); + CGAL_triangulation_assertion( off.x() == 0 || off.x() == 1 ); + CGAL_triangulation_assertion( off.y() == 0 || off.y() == 1 ); + CGAL_triangulation_assertion( off.z() == 0 || off.z() == 1 ); int i = ((off.x()&1)<<2) + ((off.y()&1)<<1) + ((off.z()&1)); return i; } @@ -754,10 +754,9 @@ public: return cp(pp.first, pp.second); } - // The following functions return the "real" position in space (unrestrained + // The following functions return the "real" position in space (unconstrained // to the original periodic domain) of the vertices v and c->vertex(idx), // respectively - template Point point(Vertex_handle v, ConstructPoint cp) const { return point(periodic_point(v), cp); @@ -2165,6 +2164,13 @@ exact_periodic_locate (const Point& p, const Offset& o_p, Offset& lo, Locate_type& lt, int& li, int& lj, Cell_handle start) const { + CGAL_triangulation_precondition(p.x() < domain().xmax()); + CGAL_triangulation_precondition(p.y() < domain().ymax()); + CGAL_triangulation_precondition(p.z() < domain().zmax()); + CGAL_triangulation_precondition(p.x() >= domain().xmin()); + CGAL_triangulation_precondition(p.y() >= domain().ymin()); + CGAL_triangulation_precondition(p.z() >= domain().zmin()); + int cumm_off = 0; Offset off_query = o_p; if(number_of_vertices() == 0) { @@ -2342,6 +2348,13 @@ inexact_periodic_locate(const Point& p, const Offset& o_p, Cell_handle start, int n_of_turns) const { + CGAL_triangulation_precondition(p.x() < domain().xmax()); + CGAL_triangulation_precondition(p.y() < domain().ymax()); + CGAL_triangulation_precondition(p.z() < domain().zmax()); + CGAL_triangulation_precondition(p.x() >= domain().xmin()); + CGAL_triangulation_precondition(p.y() >= domain().ymin()); + CGAL_triangulation_precondition(p.z() >= domain().zmin()); + int cumm_off = 0; Offset off_query = o_p; if(number_of_vertices() == 0) { @@ -4036,7 +4049,9 @@ inline void Periodic_3_triangulation_3::get_vertex( off = combine_offsets(Offset(),int_to_off(ch->offset(i))); vh = ch->vertex(i); - if(is_1_cover()) return; + if(is_1_cover()) + return; + Vertex_handle vh_i = vh; get_vertex(vh_i, vh, off); return;