Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/MRMesh/MRPointCloudTriangulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ bool PointCloudTriangulator::optimizeAll_( ProgressCallback progressCb )
std::optional<Mesh> PointCloudTriangulator::triangulate_( ProgressCallback progressCb )
{
MR_TIMER;
auto sp = subprogress( progressCb, 0.5f, 0.7f );
auto sp = subprogress( progressCb, 0.5f, 0.6f );
// accumulate triplets
phmap::flat_hash_map<VertTriplet, int, VertTripletHasher> map;
int numMap = 0;
Expand Down
7 changes: 3 additions & 4 deletions source/MRMesh/MRPointCloudTriangulationHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ namespace
// this function check that abc acd is allowed to be flipped to abd dbc
// aNorm - normal in point a
// cNorm - normal in point c
// planeDist - distance from c to plane (a,aNorm)
bool flipPossibility( const Vector3f& a, const Vector3f& b, const Vector3f& c, const Vector3f& d,
const Vector3f& aNorm, const Vector3f& cNorm,
float planeDist )
const Vector3f& aNorm, const Vector3f& cNorm )
{
if ( dot( aNorm, cNorm ) < 0.0f )
return true;

auto planeDist = Plane3f::fromDirAndPt( cross( b - a, d - a ), a ).distance( c );
if ( planeDist * planeDist > ( b - d ).lengthSq() )
return true;

Expand Down Expand Up @@ -188,7 +187,7 @@ FanOptimizerQueueElement FanOptimizer::calcQueueElement_(
auto deloneProf = deloneFlipProfit( a, b, c, d ) / normVal;
auto angleProf = trisAngleProfit( a, b, c, d, critAngle );
// ( deloneProf > 0.0f || angleProf > 0.0f ) strict condition to have more faces options if flip is not profitable
res.stable = !( flipPossibility( a, b, c, d, aNorm, cNorm, planeDist ) && ( deloneProf > 0.0f || angleProf > 0.0f ) );
res.stable = !( flipPossibility( a, b, c, d, aNorm, cNorm ) && ( deloneProf > 0.0f || angleProf > 0.0f ) );
if ( deloneProf > 0.0f )
res.weight += deloneProf;
if ( angleProf > 0.0f )
Expand Down