Back to index

salome-geom  6.5.0
Static Public Member Functions
GEOMAlgo_BuilderTools Class Reference

#include <GEOMAlgo_BuilderTools.hxx>

List of all members.

Static Public Member Functions

static Standard_EXPORT
Standard_Boolean 
IsHole (const TopoDS_Shape &aW, const TopoDS_Shape &aF)
static Standard_EXPORT
Standard_Boolean 
IsHole (const TopoDS_Shape &aShell)

Detailed Description

Definition at line 38 of file GEOMAlgo_BuilderTools.hxx.


Member Function Documentation

Standard_Boolean GEOMAlgo_BuilderTools::IsHole ( const TopoDS_Shape &  aW,
const TopoDS_Shape &  aF 
) [static]

Definition at line 78 of file GEOMAlgo_BuilderTools.cxx.

{
  Standard_Boolean bIsHole;
  Standard_Integer i, aNbS;
  Standard_Real aT1, aT2, aS;
  Standard_Real aU1, aU2, aU, dU;
  Standard_Real aX1, aY1, aX0, aY0;
  TopAbs_Orientation aOr;

  gp_Pnt2d aP2D0, aP2D1;
  Handle(Geom2d_Curve) aC2D;
  TopoDS_Face aF, aFF;
  TopoDS_Iterator aItW;
  //
  bIsHole=Standard_False;
  //
  aF=TopoDS::Face(aFace);
  aFF=aF;
  aFF.Orientation(TopAbs_FORWARD);
  //
  aS=0.;
  aItW.Initialize(aW);
  for (; aItW.More(); aItW.Next()) {
    const TopoDS_Edge& aE=TopoDS::Edge(aItW.Value());
    aOr=aE.Orientation();
    if (!(aOr==TopAbs_FORWARD ||
          aOr==TopAbs_REVERSED)) {
      continue;
    }
    //
    aC2D=BRep_Tool::CurveOnSurface(aE, aFF, aT1, aT2);
    if (aC2D.IsNull()) {
      break; //xx
    }
    //
    BRepAdaptor_Curve2d aBAC2D(aE, aFF);
    aNbS=Geom2dInt_Geom2dCurveTool::NbSamples(aBAC2D);
    if (aNbS>2) {
      aNbS*=4;
    }
    //
    dU=(aT2-aT1)/(Standard_Real)(aNbS-1);
    aU =aT1;
    aU1=aT1;
    aU2=aT2;
    if (aOr==TopAbs_REVERSED) {
      aU =aT2;
      aU1=aT2;
      aU2=aT1;
      dU=-dU;
    }
    //
    aC2D->D0(aU, aP2D0);
    for(i=2; i<=aNbS; i++) {
      aU=aU1+(i-1)*dU;
      aC2D->D0(aU, aP2D1);
      aP2D0.Coord(aX0, aY0);
      aP2D1.Coord(aX1, aY1);
      //
      aS=aS+(aY0+aY1)*(aX1-aX0);
      //
      aP2D0=aP2D1;
    }
  }//for (; aItW.More(); aItW.Next()) {
  bIsHole=(aS>0.);
  return bIsHole;
}

Here is the call graph for this function:

Standard_Boolean GEOMAlgo_BuilderTools::IsHole ( const TopoDS_Shape &  aShell) [static]

Definition at line 150 of file GEOMAlgo_BuilderTools.cxx.

{
  Standard_Boolean bIsHole;
  Standard_Integer iRet;
  Standard_Real aAi, aA, aV, aVi;
  TopExp_Explorer aExp;
  //
  aA=0.;
  aV=0.;
  aExp.Init(aShell, TopAbs_FACE);
  for (; aExp.More(); aExp.Next()) {
    const TopoDS_Face& aF=TopoDS::Face(aExp.Current());
    iRet=ComputeProps(aF, aAi, aVi);
    if (!iRet) {
      aA+=aAi;
      aV+=aVi;
    }
  }
  //
  bIsHole=aV<0.;
  return bIsHole;
}

Here is the call graph for this function:


The documentation for this class was generated from the following files: