mirror of https://github.com/CGAL/cgal
Fix yet another bug of Mesh_2: if a vertex of the CDT has all its incident
edges in a cluster of constrained edges, then the construction of the cluster was buggy.
This commit is contained in:
parent
e48a2c8bcd
commit
d8e2cfaecd
|
|
@ -1,4 +1,5 @@
|
||||||
// Copyright (c) 2004-2005 INRIA Sophia-Antipolis (France).
|
// Copyright (c) 2004-2005 INRIA Sophia-Antipolis (France).
|
||||||
|
// Copyright (c) 2010 GeometryFactory Sarl (France)
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||||
|
|
@ -15,7 +16,7 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Author(s) : Laurent RINEAU
|
// Author(s) : Laurent Rineau
|
||||||
|
|
||||||
#ifndef CGAL_MESH_2_CLUSTERS_H
|
#ifndef CGAL_MESH_2_CLUSTERS_H
|
||||||
#define CGAL_MESH_2_CLUSTERS_H
|
#define CGAL_MESH_2_CLUSTERS_H
|
||||||
|
|
@ -191,7 +192,7 @@ private:
|
||||||
* to the clusters of the vertex \c v.
|
* to the clusters of the vertex \c v.
|
||||||
*/
|
*/
|
||||||
void construct_cluster(const Vertex_handle v,
|
void construct_cluster(const Vertex_handle v,
|
||||||
Constrained_edge_circulator begin,
|
const Constrained_edge_circulator& begin,
|
||||||
const Constrained_edge_circulator& end,
|
const Constrained_edge_circulator& end,
|
||||||
Cluster c = Cluster());
|
Cluster c = Cluster());
|
||||||
|
|
||||||
|
|
@ -448,7 +449,7 @@ create_clusters_of_vertex(const Vertex_handle v)
|
||||||
template <typename Tr>
|
template <typename Tr>
|
||||||
void Clusters<Tr>::
|
void Clusters<Tr>::
|
||||||
construct_cluster(Vertex_handle v,
|
construct_cluster(Vertex_handle v,
|
||||||
Constrained_edge_circulator begin,
|
const Constrained_edge_circulator& begin,
|
||||||
const Constrained_edge_circulator& end,
|
const Constrained_edge_circulator& end,
|
||||||
Cluster c)
|
Cluster c)
|
||||||
{
|
{
|
||||||
|
|
@ -468,11 +469,8 @@ construct_cluster(Vertex_handle v,
|
||||||
c.smallest_angle.second = target(second);
|
c.smallest_angle.second = target(second);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool all_edges_in_cluster=false; // tell if all incident edges are
|
const bool all_edges_in_cluster = (begin == end); // tell if all incident edges
|
||||||
// in the cluster
|
// are in the cluster
|
||||||
if(begin==end)
|
|
||||||
all_edges_in_cluster=true;
|
|
||||||
|
|
||||||
const Point& vp = v->point();
|
const Point& vp = v->point();
|
||||||
|
|
||||||
FT greatest_cosine =
|
FT greatest_cosine =
|
||||||
|
|
@ -480,31 +478,42 @@ construct_cluster(Vertex_handle v,
|
||||||
v->point(),
|
v->point(),
|
||||||
c.smallest_angle.second->point());
|
c.smallest_angle.second->point());
|
||||||
|
|
||||||
Constrained_edge_circulator next(begin);
|
bool one_full_loop_is_needed = all_edges_in_cluster;
|
||||||
++next;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
c.vertices[target(begin)] = false;
|
|
||||||
Squared_length l = squared_distance(vp,
|
|
||||||
target(begin)->point());
|
|
||||||
c.minimum_squared_length =
|
|
||||||
(std::min)(l,c.minimum_squared_length);
|
|
||||||
|
|
||||||
if(all_edges_in_cluster || begin!=end)
|
bool stop = false;
|
||||||
{
|
Constrained_edge_circulator circ(begin);
|
||||||
FT cosine =
|
Constrained_edge_circulator next(begin);
|
||||||
squared_cosine_of_angle_times_4(target(begin)->point(),
|
while(!stop)
|
||||||
v->point(),
|
{
|
||||||
target(next)->point());
|
c.vertices[target(circ)] = false;
|
||||||
if(cosine>greatest_cosine)
|
Squared_length l = squared_distance(vp,
|
||||||
{
|
target(circ)->point());
|
||||||
greatest_cosine = cosine;
|
c.minimum_squared_length =
|
||||||
c.smallest_angle.first = target(begin);
|
(std::min)(l,c.minimum_squared_length);
|
||||||
c.smallest_angle.second = target(next);
|
|
||||||
}
|
if(circ!=end || one_full_loop_is_needed)
|
||||||
}
|
{
|
||||||
|
FT cosine =
|
||||||
|
squared_cosine_of_angle_times_4(target(circ)->point(),
|
||||||
|
v->point(),
|
||||||
|
target(next)->point());
|
||||||
|
if(cosine>greatest_cosine)
|
||||||
|
{
|
||||||
|
greatest_cosine = cosine;
|
||||||
|
c.smallest_angle.first = target(circ);
|
||||||
|
c.smallest_angle.second = target(next);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while(next++,begin++!=end);
|
|
||||||
|
if(one_full_loop_is_needed) {
|
||||||
|
one_full_loop_is_needed = false;
|
||||||
|
} else {
|
||||||
|
stop = (circ == end);
|
||||||
|
}
|
||||||
|
++circ;
|
||||||
|
++next;
|
||||||
|
}
|
||||||
|
|
||||||
typedef typename Cluster_map::value_type Value_key_pair;
|
typedef typename Cluster_map::value_type Value_key_pair;
|
||||||
cluster_map.insert(Value_key_pair(v,c));
|
cluster_map.insert(Value_key_pair(v,c));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue