Readability changes

This commit is contained in:
Mael Rouxel-Labbé 2018-01-15 14:25:45 +01:00
parent ae8b5bfaa4
commit dc14d129a4
2 changed files with 27 additions and 29 deletions

View File

@ -63,7 +63,7 @@ regular_neighbor_coordinates_vertex_2(const Rt& rt,
// (=^ inside convex hull of neighbors) // (=^ inside convex hull of neighbors)
//out: the result of the coordinate computation //out: the result of the coordinate computation
//vor_vertices: the vertices of the power cell of p (to avoid recomputation) //vor_vertices: the vertices of the power cell of p (to avoid recomputation)
CGAL_precondition(rt.dimension()==2); CGAL_precondition(rt.dimension() == 2);
typedef typename Rt::Geom_traits Traits; typedef typename Rt::Geom_traits Traits;
typedef typename Traits::FT Coord_type; typedef typename Traits::FT Coord_type;
@ -88,13 +88,14 @@ regular_neighbor_coordinates_vertex_2(const Rt& rt,
return make_triple(out, Coord_type(1), true); return make_triple(out, Coord_type(1), true);
} }
std::vector<Bare_point> vor(3); std::vector<Bare_point> vor(3);
Coord_type area_sum(0); Coord_type area_sum(0);
//determine the last vertex of the hole: //determine the last vertex of the hole:
EdgeIterator hit = hole_end; EdgeIterator hit = hole_end;
--hit; --hit;
//to start: prev is the "last" vertex of the hole
// to start: prev is the "last" vertex of the hole
// later: prev is the last vertex processed (previously) // later: prev is the last vertex processed (previously)
Vertex_handle prev = hit->first->vertex(rt.cw(hit->second)); Vertex_handle prev = hit->first->vertex(rt.cw(hit->second));
hit = hole_begin; hit = hole_begin;
@ -103,17 +104,17 @@ regular_neighbor_coordinates_vertex_2(const Rt& rt,
Coord_type area(0); Coord_type area(0);
Vertex_handle current = hit->first->vertex(rt.cw(hit->second)); Vertex_handle current = hit->first->vertex(rt.cw(hit->second));
//a first Voronoi vertex of the cell of p: // a first Voronoi vertex of the cell of p:
vor[0] = rt.geom_traits().construct_weighted_circumcenter_2_object() vor[0] = rt.geom_traits().construct_weighted_circumcenter_2_object()(
(current->point(), current->point(), hit->first->vertex(rt.ccw(hit->second))->point(), p);
hit->first->vertex(rt.ccw(hit->second))->point(), p);
*vor_vertices++= vor[0]; *vor_vertices++= vor[0];
//triangulation of the Voronoi subcell: // triangulation of the Voronoi subcell:
//a second vertex as base // a second vertex as base
Face_circulator fc = rt.incident_faces(current, hit->first); Face_circulator fc = rt.incident_faces(current, hit->first);
++fc; ++fc;
vor[1] = rt.dual(fc); vor[1] = rt.dual(fc);
// iteration over all other "old" Voronoi vertices // iteration over all other "old" Voronoi vertices
while(!fc->has_vertex(prev)) while(!fc->has_vertex(prev))
{ {
@ -125,26 +126,24 @@ regular_neighbor_coordinates_vertex_2(const Rt& rt,
} }
//the second Voronoi vertex of the cell of p: //the second Voronoi vertex of the cell of p:
vor[2] = vor[2] = rt.geom_traits().construct_weighted_circumcenter_2_object()(
rt.geom_traits().construct_weighted_circumcenter_2_object() prev->point(),current->point(), p);
(prev->point(),current->point(),p); *vor_vertices++ = vor[2];
*vor_vertices++= vor[2];
area += polygon_area_2(vor.begin(), vor.end(), rt.geom_traits()); area += polygon_area_2(vor.begin(), vor.end(), rt.geom_traits());
*out++= std::make_pair(current,area); *out++= std::make_pair(current, area);
area_sum += area; area_sum += area;
//update prev and hit: //update prev and hit:
prev= current; prev = current;
++hit; ++hit;
} }
//get coordinate for hidden vertices // get coordinate for hidden vertices <=> the area of their Voronoi cell.
// <=> the area of their Voronoi cell. // decomposition of the cell into triangles
//decomposition of the cell into triangles // vor1: dual of first triangle
// vor1: dual of first triangle // vor2, vor 3: duals of two consecutive triangles
// vor2, vor 3: duals of two consecutive triangles
Face_circulator fc, fc_begin; Face_circulator fc, fc_begin;
for(; hidden_vertices_begin != hidden_vertices_end; ++hidden_vertices_begin) for(; hidden_vertices_begin != hidden_vertices_end; ++hidden_vertices_begin)
{ {
@ -164,7 +163,7 @@ regular_neighbor_coordinates_vertex_2(const Rt& rt,
++fc; ++fc;
} }
*out++= std::make_pair((*hidden_vertices_begin),area); *out++ = std::make_pair((*hidden_vertices_begin), area);
area_sum += area; area_sum += area;
} }
@ -215,26 +214,24 @@ regular_neighbor_coordinates_vertex_2(const Rt& rt,
int li; int li;
Face_handle fh = rt.locate(p, lt, li, start); Face_handle fh = rt.locate(p, lt, li, start);
// the point must lie inside the convex hull otherwisereturn false: // the point must lie inside the convex hull, otherwise return false:
if(lt == Rt::OUTSIDE_AFFINE_HULL || lt == Rt::OUTSIDE_CONVEX_HULL if(lt == Rt::OUTSIDE_AFFINE_HULL || lt == Rt::OUTSIDE_CONVEX_HULL
|| (lt == Rt::EDGE || (lt == Rt::EDGE && (rt.is_infinite(fh) || rt.is_infinite(fh->neighbor(li)))))
&& (rt.is_infinite(fh) || rt.is_infinite(fh->neighbor(li)))))
return make_triple(out, Coord_type(1), false); return make_triple(out, Coord_type(1), false);
if (lt == Rt::VERTEX) if(lt == Rt::VERTEX)
{ {
//the point must be in conflict: //the point must be in conflict:
CGAL_precondition(rt.power_test(fh->vertex(li)->point(), p) != ON_NEGATIVE_SIDE); CGAL_precondition(rt.power_test(fh->vertex(li)->point(), p) != ON_NEGATIVE_SIDE);
if (rt.power_test(fh->vertex(li)->point(), p) ==ON_ORIENTED_BOUNDARY) if (rt.power_test(fh->vertex(li)->point(), p) == ON_ORIENTED_BOUNDARY)
{ {
*out++= std::make_pair(fh->vertex(li),Coord_type(1)); *out++ = std::make_pair(fh->vertex(li), Coord_type(1));
return make_triple(out, Coord_type(1), true); return make_triple(out, Coord_type(1), true);
} }
} }
std::list<Edge> hole; std::list<Edge> hole;
std::list<Vertex_handle> hidden_vertices; std::list<Vertex_handle> hidden_vertices;
rt.get_boundary_of_conflicts_and_hidden_vertices(p, rt.get_boundary_of_conflicts_and_hidden_vertices(p,
std::back_inserter(hole), std::back_inserter(hole),
std::back_inserter(hidden_vertices), std::back_inserter(hidden_vertices),

View File

@ -308,7 +308,8 @@ surface_neighbor_coordinates_3(const Dt& dt,
dt.vertices_on_conflict_zone_boundary(p, c, std::back_inserter(conflict_vertices)); dt.vertices_on_conflict_zone_boundary(p, c, std::back_inserter(conflict_vertices));
for (typename std::list< Vertex_handle >::iterator it = conflict_vertices.begin(); for (typename std::list< Vertex_handle >::iterator it = conflict_vertices.begin();
it != conflict_vertices.end();){ it != conflict_vertices.end();)
{
if(dt.is_infinite(*it)){ if(dt.is_infinite(*it)){
typename std::list< Vertex_handle >::iterator itp = it; typename std::list< Vertex_handle >::iterator itp = it;
it++; it++;