Remove useless hashtable over doubles

(wtf was I thinking?)
This commit is contained in:
Théophile Bastian 2018-01-27 16:39:08 +01:00
parent a1347434e7
commit e63aa18c58
3 changed files with 0 additions and 15 deletions

View file

@ -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;
} }

View file

@ -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;
}; };

View file

@ -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;