+ gp_XY uv(U,V);
+ if ( findUVByHalfDivision( thePoint, uv, tface, theParams))
+ return;
+
+ int nbGetWorstLimit = 20;
+ if ( findUVAround( thePoint, uv, tface, theParams, nbGetWorstLimit ))
+ return;
+
+ double dist2, prevSolDist = distance();
+ gp_XYZ sol = theParams;
+ for ( double delta = 1./10; delta > 0.001; delta /= 2.5, nbGetWorstLimit *= 2 )
+ {
+ for ( double y = delta; y < 1.; y += delta )
+ {
+ sol.SetCoord( tface.GetVInd(), y );
+ for ( double x = delta; x < 1.; x += delta )
+ {
+ sol.SetCoord( tface.GetUInd(), x );
+ dist2 = thePoint.SquareDistance( tface.Point( sol ));
+ if ( dist2 < prevSolDist * prevSolDist )
+ {
+ if ( findUVAround( thePoint, uv, tface, theParams, nbGetWorstLimit ))
+ return;
+ if ( distance() < 1000 * myTolerance )
+ return;
+ prevSolDist = distance();
+ }
+ }
+ }
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Finds parameters corresponding to a given UV of a given face using half-division
+ * \param [in] theUV - the UV to locate
+ * \param [in] tface - the face
+ * \param [in,out] theParams - the starting parameters to improve
+ * \return bool - \c true if found solution is within myTolerance
+ */
+//================================================================================
+
+bool SMESH_Block::findUVByHalfDivision( const gp_Pnt& thePoint,
+ const gp_XY& theUV,
+ const SMESH_Block::TFace& tface,
+ gp_XYZ& theParams)
+{