gp_Pnt xyz1 = getPoint( nn._neighborNodes[0] );
gp_Pnt xyz2 = getPoint( nn._neighborNodes[1] );
-// maxDist2 : le quart du carré de la distance entre les deux voisins du noued à bouger
+ // maxDist2 : le quart du carré de la distance entre les deux voisins du noued à bouger
double maxDist2 = xyz1.SquareDistance( xyz2 ) / 4.;
if ( _projectors[ 0 ].project( xyz, maxDist2, newXyz,
nn._params, nn._nearParams ))
for ( iP = 0; iP < projectors.size(); ++iP )
{
projectors[ iProjector ].prepareForProjection();
+ projectors[ iProjector ].tryWithoutPrevSolution( true );
if (( ok = projectors[ iProjector ].isOnShape( xyz1, tol2, nn._params, nn._nearParams )) &&
( ok = projectors[ iProjector ].isOnShape( xyz2, tol2, nn._params, nn._params )))
}
break;
}
+
+ if ( !_realProjector )
+ delete classifier;
}
}
_realProjector->_dist = 1e100;
projection = _realProjector->project( point, newSolution, prevSolution );
- return ( _realProjector->_dist * _realProjector->_dist < maxDist2 );
+ bool ok = ( _realProjector->_dist * _realProjector->_dist < maxDist2 );
+ if ( !ok && _tryWOPrevSolution && prevSolution )
+ {
+ projection = _realProjector->project( point, newSolution );
+ ok = ( _realProjector->_dist * _realProjector->_dist < maxDist2 );
+ }
+ return ok;
}
//================================================================================
if ( _bndBox.IsOut( point ) || !_realProjector )
return false;
- return _realProjector->projectAndClassify( point, maxDist2, projection,
- newSolution, prevSolution );
+ bool ok = _realProjector->projectAndClassify( point, maxDist2, projection,
+ newSolution, prevSolution );
+ if ( !ok && _tryWOPrevSolution && prevSolution )
+ ok = _realProjector->projectAndClassify( point, maxDist2, projection, newSolution );
+
+ return ok;
}
//================================================================================
// return true if projection is not needed
bool isPlanarBoundary() const;
+
+ // switch a mode of usage of prevSolution.
+ // If projection fails, to try to project without usage of prevSolution.
+ // By default this mode is off
+ void tryWithoutPrevSolution( bool toTry ) { _tryWOPrevSolution = toTry; }
+
// project a point to the boundary shape
bool project( const gp_Pnt& point,
const double maxDist2,
FT_RealProjector* _realProjector;
Bnd_Box _bndBox;
TopoDS_Shape _shape;
+ bool _tryWOPrevSolution;
};
#endif