mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-13 02:00:35 +05:00
0022177: [CEA 799] RemoveExtraEdges produces non valid faces
This commit is contained in:
parent
bf782252cf
commit
5c1fd84469
@ -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);
|
||||
}
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <IntSurf_Quadric.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
@ -52,34 +53,23 @@
|
||||
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:
|
||||
@ -88,12 +78,14 @@
|
||||
}
|
||||
//
|
||||
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;
|
||||
}
|
||||
}
|
||||
//
|
||||
@ -140,53 +132,6 @@
|
||||
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 :
|
||||
//=======================================================================
|
||||
|
@ -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) ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user