From 3417d58928e42271f64ea11a625e65ed063587b7 Mon Sep 17 00:00:00 2001 From: Lene Preuss Date: Fri, 28 Mar 2014 00:28:34 +0100 Subject: [PATCH] fixed test for equality in FacePolygon. Committing the code clumsy as it is. (#30) --- src/Displayable/Object/FacePolygon.impl.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Displayable/Object/FacePolygon.impl.h b/src/Displayable/Object/FacePolygon.impl.h index fab17233..59dced21 100644 --- a/src/Displayable/Object/FacePolygon.impl.h +++ b/src/Displayable/Object/FacePolygon.impl.h @@ -70,9 +70,19 @@ FacePolygon::operator==(const FacePolygon &other) cons return false; } print(); std::cerr << " == "; other.print(); std::cerr << "?\n"; + unsigned associated_index[N_vertex]; for (unsigned i = 0; i < N_vertex; ++i) { - std::cerr << *_vertices[_indices[i]] << " == " << *other._vertices[other._indices[i]] << "?\n"; - if (_vertices[_indices[i]] != other._vertices[other._indices[i]]) return false; + for (unsigned j = 0; j < N_vertex; ++j) { + if (other._indices[j] == _indices[i]) { + associated_index[i] = j; + break; + } + } + } + for (unsigned i = 0; i < N_vertex; ++i) { + std::cerr << i << ": " << *_vertices[i] << " == " + << associated_index[i] << ": " << *other._vertices[associated_index[i]] << "?\n"; + if (*_vertices[i] != *other._vertices[associated_index[i]]) return false; } return true; }