Commit e1a72035 authored by Matthias Möller's avatar Matthias Möller

improve performance for small vectors/faces

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1269 fdac6126-5c0c-442c-9429-916003d36597
parent d8d26b7c
......@@ -106,25 +106,15 @@ void trimString( std::string& _string) {
}
//-----------------------------------------------------------------------------
template<typename Handle>
class HasSeen : public std::unary_function <Handle, bool>
{
public:
HasSeen () : seen_ () { }
bool operator ()(const Handle& i) const
{
return (!seen_.insert(i.idx()).second);
}
private:
mutable std::set<int> seen_;
};
// remove duplicated indices from one face
void remove_duplicated_vertices(BaseImporter::VHandles& _indices)
{
_indices.erase(std::remove_if(_indices.begin(),_indices.end(),HasSeen<BaseImporter::VHandles::value_type>()),_indices.end());
BaseImporter::VHandles::iterator endIter = _indices.end();
for (BaseImporter::VHandles::iterator iter = _indices.begin(); iter != endIter; ++iter)
endIter = std::remove(iter+1, endIter, *(iter));
_indices.erase(endIter,_indices.end());
}
//-----------------------------------------------------------------------------
......
......@@ -54,9 +54,9 @@ TEST_F(OpenMeshReadWriteOBJ, LoadDegeneratedOBJ) {
mesh_.clear();
bool ok = OpenMesh::IO::read_mesh(mesh_, "cube-minimal.obj");
bool ok = OpenMesh::IO::read_mesh(mesh_, "cube-minimal-degenerated.obj");
EXPECT_TRUE(ok) << "Unable to load cube-minimal.obj";
EXPECT_TRUE(ok) << "Unable to load cube-minimal-degenerated.obj";
EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment