fix resize bug

This commit is contained in:
Andreas Fabri
2008-11-04 10:08:25 +00:00
parent 91410c39d8
commit ecc6fdcd54
2 changed files with 7 additions and 7 deletions
@@ -114,7 +114,7 @@ public:
*/
Face_handle face (const int i) const
{
CGAL_precondition (i < n_faces);
CGAL_precondition((unsigned int) i < n_faces);
return (rev_map[i]);
}
@@ -170,8 +170,8 @@ public:
n_faces++;
// If necessary, allocate memory for the reverse mapping.
if (rev_map.size() > n_faces)
rev_map.resize (2 * n_faces);
if (rev_map.size() < n_faces)
rev_map.resize(2 * n_faces);
// Update the mapping of the newly created face.
index_map[new_f] = n_faces - 1;
@@ -195,7 +195,7 @@ public:
// Reduce memory consumption in case the number of faces has
// drastically decreased.
if (2*n_faces < rev_map.size() &&
if (2*n_faces+1 < rev_map.size() &&
rev_map.size() / 2 >= MIN_REV_MAP_SIZE)
{
rev_map.resize (rev_map.size() / 2);
@@ -168,7 +168,7 @@ public:
n_vertices++;
// If necessary, allocate memory for the reverse mapping.
if (rev_map.size() > n_vertices)
if (rev_map.size() < n_vertices)
rev_map.resize (2 * n_vertices);
// Update the mapping of the newly created vertex.
@@ -186,7 +186,7 @@ public:
n_vertices++;
// If necessary, allocate memory for the reverse mapping.
if (rev_map.size() > n_vertices)
if (rev_map.size() < n_vertices)
rev_map.resize (2 * n_vertices);
// Update the mapping of the newly created vertex.
@@ -205,7 +205,7 @@ public:
// Reduce memory consumption in case the number of vertices has
// drastically decreased.
if (2*n_vertices < rev_map.size() &&
if (2*n_vertices+1 < rev_map.size() &&
rev_map.size() / 2 >= MIN_REV_MAP_SIZE)
{
rev_map.resize (rev_map.size() / 2);