@@ -111,7 +111,7 @@ void getOptimalSteps( std::vector<unsigned>& optimalSteps, unsigned start, unsig
111
111
112
112
// finds best candidate among all given steps
113
113
void getTriangulationWeights ( const MeshTopology& topology, const NewEdgesMap& map, const EdgePath& loop,
114
- const FillHoleMetric& metrics,
114
+ const FillHoleMetric& metrics, bool smoothBd,
115
115
const std::vector<unsigned >& optimalStepsCache, WeightedConn& processedConn )
116
116
{
117
117
for ( unsigned s = 0 ; s < optimalStepsCache.size (); ++s )
@@ -139,7 +139,7 @@ void getTriangulationWeights( const MeshTopology& topology, const NewEdgesMap& m
139
139
VertId leftVert;
140
140
if ( abConn.hasPrev () )
141
141
leftVert = topology.org ( loop[abConn.prevA ] );
142
- else if ( topology.right ( loop[processedConn.a ] ) )
142
+ else if ( smoothBd && topology.right ( loop[processedConn.a ] ) )
143
143
leftVert = topology.dest ( topology.prev ( loop[processedConn.a ] ) );
144
144
145
145
if ( leftVert )
@@ -151,7 +151,7 @@ void getTriangulationWeights( const MeshTopology& topology, const NewEdgesMap& m
151
151
VertId rightVert;
152
152
if ( bcConn.hasPrev () )
153
153
rightVert = topology.org ( loop[bcConn.prevA ] );
154
- else if ( topology.right ( loop[v] ) )
154
+ else if ( smoothBd && topology.right ( loop[v] ) )
155
155
rightVert = topology.dest ( topology.prev ( loop[v] ) );
156
156
157
157
if ( rightVert )
@@ -179,7 +179,7 @@ using MapPatch = std::vector<MapPatchElement>;
179
179
180
180
// this function go backward by given triangulation and tries to fix multiple edges
181
181
// return false if triangulation has multiple edges that cannot be fixed
182
- bool removeMultipleEdgesFromTriangulation ( const MeshTopology& topology, const NewEdgesMap& map, const EdgePath& loop, const FillHoleMetric& metricRef,
182
+ bool removeMultipleEdgesFromTriangulation ( const MeshTopology& topology, const NewEdgesMap& map, const EdgePath& loop, const FillHoleMetric& metricRef, bool smoothBd ,
183
183
WeightedConn start, int maxPolygonSubdivisions, MapPatch& mapPatch )
184
184
{
185
185
MR_TIMER;
@@ -232,7 +232,7 @@ bool removeMultipleEdgesFromTriangulation( const MeshTopology& topology, const N
232
232
if ( optimalStepsCache.empty () )
233
233
return false ;
234
234
WeightedConn newPrev{ start.a ,start.b ,DBL_MAX,0 };
235
- getTriangulationWeights ( topology, map, loop, metricRef, optimalStepsCache, newPrev ); // find better among steps
235
+ getTriangulationWeights ( topology, map, loop, metricRef, smoothBd, optimalStepsCache, newPrev ); // find better among steps
236
236
if ( !newPrev.hasPrev () || !map[start.a ][newPrev.prevA ].hasPrev () || !map[start.prevA ][newPrev.b ].hasPrev () )
237
237
return false ;
238
238
start.prevA = newPrev.prevA ;
@@ -659,7 +659,7 @@ HoleFillPlan HoleFillPlanner::run( const Mesh& mesh, EdgeId a0, const FillHolePa
659
659
sameEdgeExists ( mesh.topology , aCur, cCur ) )
660
660
return ;
661
661
getOptimalSteps ( optimalSteps, ( i + 1 ) % loopEdgesCounter, steps, loopEdgesCounter, params.maxPolygonSubdivisions );
662
- getTriangulationWeights ( mesh.topology , newEdgesMap_, edgeMap_, metrics, optimalSteps, current ); // find better among steps
662
+ getTriangulationWeights ( mesh.topology , newEdgesMap_, edgeMap_, metrics, params. smoothBd , optimalSteps, current ); // find better among steps
663
663
};
664
664
if ( parallelProcessing )
665
665
{
@@ -689,13 +689,13 @@ HoleFillPlan HoleFillPlanner::run( const Mesh& mesh, EdgeId a0, const FillHolePa
689
689
VertId leftVert;
690
690
if ( newEdgesMap_[i][cIndex].hasPrev () )
691
691
leftVert = mesh.topology .org ( edgeMap_[newEdgesMap_[i][cIndex].prevA ] );
692
- else if ( mesh.topology .right ( edgeMap_[i] ) )
692
+ else if ( params. smoothBd && mesh.topology .right ( edgeMap_[i] ) )
693
693
leftVert = mesh.topology .dest ( mesh.topology .prev ( edgeMap_[i] ) );
694
694
695
695
VertId rightVert;
696
696
if ( newEdgesMap_[cIndex][i].hasPrev () )
697
697
rightVert = mesh.topology .org ( edgeMap_[newEdgesMap_[cIndex][i].prevA ] );
698
- else if ( mesh.topology .right ( edgeMap_[cIndex] ) )
698
+ else if ( params. smoothBd && mesh.topology .right ( edgeMap_[cIndex] ) )
699
699
rightVert = mesh.topology .dest ( mesh.topology .prev ( edgeMap_[cIndex] ) );
700
700
701
701
if ( leftVert && rightVert )
@@ -706,7 +706,7 @@ HoleFillPlan HoleFillPlanner::run( const Mesh& mesh, EdgeId a0, const FillHolePa
706
706
}
707
707
if ( weight < finConn.weight &&
708
708
( params.multipleEdgesResolveMode != FillHoleParams::MultipleEdgesResolveMode::Strong || // try to fix multiple if needed
709
- removeMultipleEdgesFromTriangulation ( mesh.topology , newEdgesMap_, edgeMap_, metrics, newEdgesMap_[cIndex][i], params.maxPolygonSubdivisions , cachedMapPatch_ ) ) )
709
+ removeMultipleEdgesFromTriangulation ( mesh.topology , newEdgesMap_, edgeMap_, metrics, params. smoothBd , newEdgesMap_[cIndex][i], params.maxPolygonSubdivisions , cachedMapPatch_ ) ) )
710
710
{
711
711
savedMapPatch_ = cachedMapPatch_;
712
712
finConn = newEdgesMap_[cIndex][i];
0 commit comments