Fix for normal averaging and hidden parameter for max normal Z angle.

This commit is contained in:
tamasmeszaros 2019-01-02 15:48:38 +01:00
parent a7d8146198
commit 760b1cd9bc
3 changed files with 15 additions and 2 deletions

View file

@ -188,7 +188,15 @@ PointSet normals(const PointSet& points, const EigenMesh3D& emesh,
neighnorms.emplace_back(U.cross(V).normalized());
}
// Throw out duplicates. They would case trouble with summing.
// Throw out duplicates. They would cause trouble with summing. We will
// use std::unique which works on sorted ranges. We will sort by the
// coefficient-wise sum of the normals. It should force the same
// elements to be consecutive.
std::sort(neighnorms.begin(), neighnorms.end(),
[](const Vec3d& v1, const Vec3d& v2){
return v1.sum() < v2.sum();
});
auto lend = std::unique(neighnorms.begin(), neighnorms.end(),
[](const Vec3d& n1, const Vec3d& n2) {
// Compare normals for equivalence. This is controvers stuff.