From: pkv Date: Mon, 1 Oct 2012 08:09:47 +0000 (+0400) Subject: 0023125: Wrong results done by classifier algorithm for a point and a solid. X-Git-Tag: V6_5_4_beta1~22 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=88cc4cb8290986deea46effc952f394dbb280442 0023125: Wrong results done by classifier algorithm for a point and a solid. class :BRepClass3d_SolidExplorer; - method: Standard_Integer BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P, gp_Lin& L, Standard_Real& _Par) The object of the type Extrema_ExtPS is created using real parametric ranges (U,V) of the surface. --- diff --git a/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx b/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx index e37009d66c..b2e4cca22a 100755 --- a/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx +++ b/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx @@ -338,7 +338,6 @@ Standard_Boolean BRepClass3d_SolidExplorer::PointInTheFace //function : LimitInfiniteUV //purpose : Limit infinite parameters //======================================================================= - static void LimitInfiniteUV (Standard_Real& U1, Standard_Real& V1, Standard_Real& U2, @@ -355,14 +354,15 @@ static void LimitInfiniteUV (Standard_Real& U1, if (infU2) U2 = 1e10; if (infV2) V2 = 1e10; } -// Modified by skv - Tue Sep 16 13:50:38 2003 OCC578 Begin -//OCC454(apo)-> -// static Standard_Boolean IsInfiniteUV (Standard_Real& U1, Standard_Real& V1, Standard_Real& U2, Standard_Real& V2) { -// return (Precision::IsNegativeInfinite(U1) || Precision::IsNegativeInfinite(V1) || -// Precision::IsNegativeInfinite(U2) || Precision::IsNegativeInfinite(V2)); -// } -static Standard_Integer IsInfiniteUV (Standard_Real& U1, Standard_Real& V1, - Standard_Real& U2, Standard_Real& V2) { +//======================================================================= +//function : IsInfiniteUV +//purpose : +//======================================================================= +static Standard_Integer IsInfiniteUV (Standard_Real& U1, + Standard_Real& V1, + Standard_Real& U2, + Standard_Real& V2) +{ Standard_Integer aVal = 0; if (Precision::IsInfinite(U1)) @@ -391,27 +391,20 @@ static Standard_Integer IsInfiniteUV (Standard_Real& U1, Standard_Real& V1, // The Second Call provide a line to the second face // and so on. //======================================================================= -//modified by NIZNHY-PKV Thu Nov 14 14:34:05 2002 f -//void BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P, -// gp_Lin& L, -// Standard_Real& _Par) - Standard_Integer BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P, - gp_Lin& L, - Standard_Real& _Par) -//modified by NIZNHY-PKV Thu Nov 14 14:34:10 2002 t +Standard_Integer BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P, + gp_Lin& L, + Standard_Real& _Par) { const Standard_Real TolU = Precision::PConfusion(); const Standard_Real TolV = TolU; TopoDS_Face face; TopExp_Explorer faceexplorer; - //TopExp_Explorer edgeexplorer; gp_Pnt APoint; gp_Vec aVecD1U, aVecD1V; Standard_Real maxscal=0; Standard_Boolean ptfound=Standard_False; Standard_Real Par; - //Standard_Integer i=1; Standard_Real _u,_v; Standard_Integer IndexPoint=0; Standard_Integer NbPointsOK=0; @@ -440,42 +433,44 @@ static Standard_Integer IsInfiniteUV (Standard_Real& U1, Standard_Real& V1, // //avoid process faces from uncorrected shells if( Abs (U2 - U1) < 1.e-12 || Abs(V2 - V1) < 1.e-12) { - //modified by NIZNHY-PKV Thu Nov 14 15:03:18 2002 f - //gp_Vec avoidV(gp_Pnt(0.,0.,0.),gp_Pnt(0.,0.,1.)); - //gp_Lin avoidL(gp_Pnt(0.,0.,0.),avoidV); - //_Par = RealLast(); - //L = avoidL; return 2; - //return ; - //modified by NIZNHY-PKV Thu Nov 14 12:25:33 2002 t } // Standard_Real svmyparam=myParamOnEdge; // - // Modified by skv - Tue Sep 16 13:55:27 2003 OCC578 Begin // Check if the point is on the face or the face is infinite. Standard_Integer anInfFlag = IsInfiniteUV(U1,V1,U2,V2); -// if(IsInfiniteUV(U1,V1,U2,V2)){//OCC454(apo)-> GeomAdaptor_Surface GA(BRep_Tool::Surface(face)); - Extrema_ExtPS Ext(P,GA,TolU,TolV); + Extrema_ExtPS Ext(P, GA, TolU, TolV); + // if (Ext.IsDone() && Ext.NbExt() > 0) { - // evaluate the lower distance and its index; - Standard_Real Dist2, Dist2Min = Ext.SquareDistance(1); - Standard_Integer iNear = 1, i = 2, iEnd = Ext.NbExt(); + Standard_Integer i, iNear, iEnd; + Standard_Real aUx, aVx, Dist2, Dist2Min; + Extrema_POnSurf aPx; + // + iNear = 1; + Dist2Min = Ext.SquareDistance(1); + iEnd = Ext.NbExt(); for (i = 2; i <= iEnd; i++) { - Dist2 = Ext.SquareDistance(i); - if (Dist2 < Dist2Min) { - Dist2Min = Dist2; iNear = i; + aPx=Ext.Point(i); + aPx.Parameter(aUx, aVx); + if (aUx>=U1 && aUx<=U2 && aVx>=V1 && aVx<=V2) { + Dist2 = Ext.SquareDistance(i); + if (Dist2 < Dist2Min) { + Dist2Min = Dist2; + iNear = i; + } } } - //modified by NIZNHY-PKV Thu Nov 14 12:31:01 2002 f + // Standard_Real aDist2Tresh=1.e-24; - + // if (Dist2Min0.2) { - //modified by NIZNHY-PKV Thu Nov 14 12:25:28 2002 f - //return ; return 0; - //modified by NIZNHY-PKV Thu Nov 14 12:25:33 2002 t } @@ -568,11 +554,7 @@ static Standard_Integer IsInfiniteUV (Standard_Real& U1, Standard_Real& V1, Par= 1.0; _Par=Par; L = gp_Lin(P,V); - //modified by NIZNHY-PKV Thu Nov 14 12:25:28 2002 f - //return ; return 0; - //modified by NIZNHY-PKV Thu Nov 14 12:25:33 2002 t - //-- cout<<" FindAPoint **** Pas OK "<