Salome HOME
0022177: [CEA 799] RemoveExtraEdges produces non valid faces
authorskv <skv@opencascade.com>
Tue, 23 Jul 2013 12:27:25 +0000 (12:27 +0000)
committerskv <skv@opencascade.com>
Tue, 23 Jul 2013 12:27:25 +0000 (12:27 +0000)
src/GEOMAlgo/GEOMAlgo_ClsfBox.cxx
src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx
src/GEOMAlgo/GEOMAlgo_SurfaceTools.hxx

index 202c0d403a5770be082e0c68cce991360deb18c7..47b127de50844f80aa738644583f928014a2524a 100644 (file)
@@ -40,7 +40,7 @@
 #include <gp_Pnt.hxx>
 #include <gp_Dir.hxx>
 #include <gp_Pln.hxx>
-#include <gp_Ax1.hxx>
+#include <gp_Ax3.hxx>
 #include <Geom_Plane.hxx>
 
 IMPLEMENT_STANDARD_HANDLE(GEOMAlgo_ClsfBox, GEOMAlgo_Clsf)
@@ -128,17 +128,22 @@ IMPLEMENT_STANDARD_RTTIEXT(GEOMAlgo_ClsfBox, GEOMAlgo_Clsf)
     }
     //
     if(aOr==TopAbs_REVERSED) {
-      gp_Ax1 aAx1;
+      gp_Ax3 aPos;
       gp_Pln aPln;
       gp_Pnt aP;
       gp_Dir aD;
       Handle(Geom_Plane) aSR;
       //
       aPln=myGAS[i-1].Plane();
-      aAx1=aPln.Axis();
-      aP=aAx1.Location();
-      aD=aAx1.Direction();
-      aD.Reverse();
+      aPos=aPln.Position();
+      aP=aPos.Location();
+      aD=aPos.Direction();
+
+      // Is aPos is not direct, aD is already a reversed direction.
+      if (aPos.Direct()) {
+        aD.Reverse();
+      }
+
       aSR=new Geom_Plane(aP, aD);
       myGAS[i-1].Load(aSR);
     }
index f8ade1562794cdbd613229e8dfc189089a13f3cc..e50fc4c7c525742b4d2174e0064168b0f62c6c3c 100644 (file)
@@ -41,6 +41,7 @@
 
 #include <GeomAbs_SurfaceType.hxx>
 #include <GeomAdaptor_Surface.hxx>
+#include <IntSurf_Quadric.hxx>
 
 
 //=======================================================================
                                                   const Standard_Real aTol,
                                                   TopAbs_State& aState)
 {
-  Standard_Integer iErr;
-  Standard_Real aDp, aR;
-  GeomAbs_SurfaceType aType;
-  gp_Sphere aSph;
-  gp_Cylinder aCyl;
-  gp_Pln aPln;
+  Standard_Integer    iErr  = 0;
+  GeomAbs_SurfaceType aType = aGAS.GetType();
+  IntSurf_Quadric     aQuad;
   //
-  iErr=0;
-  aState=TopAbs_UNKNOWN;
+  aState = TopAbs_UNKNOWN;
   //
-  aType=aGAS.GetType();
   switch (aType) {
   case GeomAbs_Plane:
-    aPln=aGAS.Plane();
-    aR=0.;
-    aDp=GEOMAlgo_SurfaceTools::Distance(aP, aPln);
+    aQuad.SetValue(aGAS.Plane());
     break;
 
   case GeomAbs_Cylinder:
-    aCyl=aGAS.Cylinder();
-    aR=aCyl.Radius();
-    aDp=GEOMAlgo_SurfaceTools::Distance(aP, aCyl);
+    aQuad.SetValue(aGAS.Cylinder());
     break;
 
   case GeomAbs_Sphere:
-    aSph=aGAS.Sphere();
-    aR=aSph.Radius();
-    aDp=GEOMAlgo_SurfaceTools::Distance(aP, aSph);
+    aQuad.SetValue(aGAS.Sphere());
     break;
 
   default:
   }
   //
   if (!iErr) {
-    aState=TopAbs_ON;
-    if (aDp>aR+aTol) {
-      aState=TopAbs_OUT;
-    }
-    else if (aDp<aR-aTol) {
-      aState=TopAbs_IN;
+    const Standard_Real aDp = aQuad.Distance(aP);
+    //
+    aState = TopAbs_ON;
+    //
+    if (aDp > aTol) {
+      aState = TopAbs_OUT;
+    } else if (aDp < -aTol) {
+      aState = TopAbs_IN;
     }
   }
   //
   return aRSt;
 }
 //=======================================================================
-//function : Distance
-//purpose  :
-//=======================================================================
-Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP,
-                                              const gp_Sphere& aSph)
-{
-  Standard_Real aD;
-  //
-  const gp_Pnt& aLoc=aSph.Location();
-  aD=aLoc.Distance(aP);
-  //
-  return aD;
-}
-//=======================================================================
-//function : Distance
-//purpose  :
-//=======================================================================
-Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP,
-                                              const gp_Cylinder& aCyl)
-{
-  Standard_Real aD;
-  //
-  const gp_Ax1& aAxis=aCyl.Axis();
-  gp_Lin aLin(aAxis);
-  aD=aLin.Distance(aP);
-  //
-  return aD;
-}
-//=======================================================================
-//function : Distance
-//purpose  :
-//=======================================================================
-Standard_Real GEOMAlgo_SurfaceTools::Distance(const gp_Pnt& aP,
-                                              const gp_Pln& aPL)
-{
-  Standard_Real aD;
-  //
-  const gp_Ax3& aPos=aPL.Position();
-  const gp_Pnt& aLoc=aPos.Location ();
-  const gp_Dir& aDir=aPos.Direction();
-  //
-  aD= (aDir.X() * (aP.X() - aLoc.X()) +
-       aDir.Y() * (aP.Y() - aLoc.Y()) +
-       aDir.Z() * (aP.Z() - aLoc.Z()));
-  return aD;
-}
-//=======================================================================
 //function : IsCoaxial
 //purpose  :
 //=======================================================================
index d8b1e5aef3a52ba7d454a558f61b668be60c6910..f1c1305a648d6c9c5c511ab2a2ebacdffc104352 100644 (file)
@@ -75,18 +75,6 @@ class GEOMAlgo_SurfaceTools
                                       const Standard_Real aTol,
                                       TopAbs_State& aSt) ;
 
-  Standard_EXPORT
-    static  Standard_Real Distance(const gp_Pnt& aP,
-                                   const gp_Pln& aPln) ;
-
-  Standard_EXPORT
-    static  Standard_Real Distance(const gp_Pnt& aP,
-                                   const gp_Cylinder& aCyl) ;
-
-  Standard_EXPORT
-    static  Standard_Real Distance(const gp_Pnt& aP,
-                                   const gp_Sphere& aSph) ;
-
   Standard_EXPORT
     static  TopAbs_State ReverseState(const TopAbs_State aSt) ;