Remove useless hashtable over doubles
(wtf was I thinking?)
This commit is contained in:
parent
a1347434e7
commit
e63aa18c58
3 changed files with 0 additions and 15 deletions
5
Mesh.cpp
5
Mesh.cpp
|
@ -5,12 +5,7 @@ Mesh::Mesh()
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Mesh::add_vertice(const Point& pt) {
|
size_t Mesh::add_vertice(const Point& pt) {
|
||||||
// Does the vertice already exists?
|
|
||||||
if (rev_vertices.find(pt) != rev_vertices.end())
|
|
||||||
return rev_vertices.find(pt)->second;
|
|
||||||
|
|
||||||
vertices.push_back(pt);
|
vertices.push_back(pt);
|
||||||
rev_vertices.insert(std::make_pair(pt, vertices.size() - 1));
|
|
||||||
return vertices.size() - 1;
|
return vertices.size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
Mesh.hpp
1
Mesh.hpp
|
@ -26,6 +26,5 @@ class Mesh {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Point> vertices;
|
std::vector<Point> vertices;
|
||||||
std::unordered_map<Point, size_t> rev_vertices;
|
|
||||||
std::vector<Face> faces;
|
std::vector<Face> faces;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,15 +22,6 @@ struct Face {
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
template<> struct hash<Point> { typedef Point argument_type;
|
|
||||||
typedef std::size_t result_type;
|
|
||||||
result_type operator()(const argument_type& pt) const noexcept {
|
|
||||||
return (hash<double>()(pt.x) << 2)
|
|
||||||
^ (hash<double>()(pt.y) << 1)
|
|
||||||
^ hash<double>()(pt.z);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<> struct hash<Face>
|
template<> struct hash<Face>
|
||||||
{
|
{
|
||||||
typedef Face argument_type;
|
typedef Face argument_type;
|
||||||
|
|
Loading…
Reference in a new issue