Back to index

salome-geom  6.5.0
Static Public Member Functions
NMTTools_Tools Class Reference

#include <NMTTools_Tools.hxx>

List of all members.

Static Public Member Functions

static Standard_EXPORT void MakeNewVertex (const TopTools_ListOfShape &aLV, TopoDS_Vertex &aNewVertex)
static Standard_EXPORT void FindChains (const BOPTools_CArray1OfVVInterference &aVVs, BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger &aMCX)
static Standard_EXPORT void FindChains (const BOPTools_CArray1OfSSInterference &aVVs, BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger &aMCX)
static Standard_EXPORT void FindChains (const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger &aMCV, BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger &aMCX)
static Standard_EXPORT
Standard_Boolean 
IsSplitInOnFace (const TopoDS_Edge &aE, const TopoDS_Face &aF, const Handle(IntTools_Context)&aCtx)
static Standard_EXPORT
Standard_Boolean 
AreFacesSameDomain (const TopoDS_Face &aF1, const TopoDS_Face &aF2, const Handle(IntTools_Context)&aCtx)
static Standard_EXPORT void FindChains (const NMTTools_ListOfCoupleOfShape &aLCS, NMTTools_IndexedDataMapOfShapeIndexedMapOfShape &aM)
static Standard_EXPORT void FindChains (const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape &aM1, NMTTools_IndexedDataMapOfShapeIndexedMapOfShape &aM2)
static Standard_EXPORT void MakePCurve (const TopoDS_Edge &aE, const TopoDS_Face &aF, const Handle(Geom2d_Curve)&aC2D)
static Standard_EXPORT void UpdateEdge (const TopoDS_Edge &aE, const Standard_Real aTol)

Detailed Description

Definition at line 53 of file NMTTools_Tools.hxx.


Member Function Documentation

Standard_Boolean NMTTools_Tools::AreFacesSameDomain ( const TopoDS_Face &  aF1,
const TopoDS_Face &  aF2,
const Handle(IntTools_Context)&  aCtx 
) [static]

Definition at line 442 of file NMTTools_Tools.cxx.

{
  Standard_Boolean bFlag;
  // Modified  Thu Sep 14 14:35:18 2006
  // Contribution of Samtech www.samcef.com BEGIN
  Standard_Integer aNbE1, aNbE2;
  Standard_Real aTolF1, aTolF2, aTol;
  gp_Pnt2d aP2D;
  gp_Pnt aP;
  TopoDS_Face aF1, aF2;
  TopExp_Explorer aExp;
  TopTools_MapOfShape aME1, aME2;
  TopTools_MapIteratorOfMapOfShape aIt;
  //
  bFlag=Standard_False;
  // Contribution of Samtech www.samcef.com END
  //
  aF1=aF1x;
  aF1.Orientation(TopAbs_FORWARD);
  aF2=aF2y;
  aF2.Orientation(TopAbs_FORWARD);
  //
  // Modified  Thu Sep 14 14:35:18 2006
  // Contribution of Samtech www.samcef.com BEGIN
  //
  // 1
  aExp.Init(aF1, TopAbs_EDGE);
  for (; aExp.More(); aExp.Next()) {
    const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
    if (!BRep_Tool::Degenerated(aE)) {
      aME1.Add(aE);
    }
  }
  //
  aExp.Init(aF2, TopAbs_EDGE);
  for (; aExp.More(); aExp.Next()) {
    const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
    if (!BRep_Tool::Degenerated(aE)) {
      if (!aME1.Contains(aE)) {
        return bFlag;
      }
      aME2.Add(aE);
    }
  }
  //
  // Contribution of Samtech www.samcef.com END
  //
  aNbE1=aME1.Extent();
  aNbE2=aME2.Extent();
  //
  if(!aNbE1 || !aNbE2){
    return bFlag;
  }
  //
  if(aNbE1!=aNbE2) {
    return bFlag;
  }
  //
  // 2
  aTolF1=BRep_Tool::Tolerance(aF1);
  aTolF2=BRep_Tool::Tolerance(aF2);
  aTol=aTolF1+aTolF2;
  //
  aIt.Initialize(aME1);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Edge& aE=TopoDS::Edge(aIt.Key());
    BOPTools_Tools3D::PointNearEdge(aE, aF1, aP2D, aP);
    bFlag=aCtx->IsValidPointForFace(aP, aF2, aTol);
    break;
  }
  //
  return bFlag;
}

Here is the caller graph for this function:

void NMTTools_Tools::FindChains ( const BOPTools_CArray1OfVVInterference &  aVVs,
BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger &  aMCX 
) [static]

Definition at line 346 of file NMTTools_Tools.cxx.

{
  Standard_Integer j, aNb, anIndex1, anIndex2;
  BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMCV;
  //
  aNb=VVs.Extent();
  for (j=1; j<=aNb; ++j) {
    const BOPTools_VVInterference& VV=VVs(j);
    VV.Indices(anIndex1, anIndex2);
    //
    if (aMCV.Contains(anIndex1)) {
      TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex1);
      aMV.Add(anIndex1);
      aMV.Add(anIndex2);
    }
    else {
      TColStd_IndexedMapOfInteger aMV;
      aMV.Add(anIndex1);
      aMV.Add(anIndex2);
      aMCV.Add(anIndex1, aMV);
    }
    //
    if (aMCV.Contains(anIndex2)) {
      TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex2);
      aMV.Add(anIndex1);
      aMV.Add(anIndex2);
    }
    else {
      TColStd_IndexedMapOfInteger aMV;
      aMV.Add(anIndex1);
      aMV.Add(anIndex2);
      aMCV.Add(anIndex2, aMV);
    }
  }
  NMTTools_Tools::FindChains(aMCV, aMapChains);
}

Here is the caller graph for this function:

void NMTTools_Tools::FindChains ( const BOPTools_CArray1OfSSInterference &  aVVs,
BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger &  aMCX 
) [static]

Definition at line 298 of file NMTTools_Tools.cxx.

{
  Standard_Boolean bIsTangentFaces;
  Standard_Integer j, aNb, anIndex1, anIndex2;
  BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMCV;
  //
  aNb=FFs.Extent();
  for (j=1; j<=aNb; ++j) {
    const BOPTools_SSInterference& aFF=FFs(j);
    //
    bIsTangentFaces=aFF.IsTangentFaces();
    if (!bIsTangentFaces) {
      continue;
    }
    //
    aFF.Indices(anIndex1, anIndex2);
    //
    if (aMCV.Contains(anIndex1)) {
      TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex1);
      aMV.Add(anIndex1);
      aMV.Add(anIndex2);
    }
    else {
      TColStd_IndexedMapOfInteger aMV;
      aMV.Add(anIndex1);
      aMV.Add(anIndex2);
      aMCV.Add(anIndex1, aMV);
    }
    //
    if (aMCV.Contains(anIndex2)) {
      TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex2);
      aMV.Add(anIndex1);
      aMV.Add(anIndex2);
    }
    else {
      TColStd_IndexedMapOfInteger aMV;
      aMV.Add(anIndex1);
      aMV.Add(anIndex2);
      aMCV.Add(anIndex2, aMV);
    }
  }
  NMTTools_Tools::FindChains(aMCV, aMapChains);
}

Here is the call graph for this function:

void NMTTools_Tools::FindChains ( const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger &  aMCV,
BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger &  aMCX 
) [static]

Definition at line 388 of file NMTTools_Tools.cxx.

{
  Standard_Integer  i, j, aNbCV, aNbV, iV, iVx;
  TColStd_IndexedMapOfInteger aProcessed, aChain;
  //
  aNbCV=aMCV.Extent();
  for (i=1; i<=aNbCV; ++i) {
    iV=aMCV.FindKey(i);
    if (aProcessed.Contains(iV)) {
      continue;
    }
    //
    aProcessed.Add(iV);
    aChain.Add(iV);
    //
    const TColStd_IndexedMapOfInteger& aMV=aMCV(i);
    aNbV=aMV.Extent();
    for (j=1; j<=aNbV; ++j) {
      iVx=aMV(j);
      ProcessBlock(iVx, aMCV, aProcessed, aChain);
    }
    aMapChains.Add(i, aChain);
    aChain.Clear();
  }
}

Here is the call graph for this function:

Definition at line 521 of file NMTTools_Tools.cxx.

{
  NMTTools_ListIteratorOfListOfCoupleOfShape aItCS;
  NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMCV;
  //
  aItCS.Initialize(aLCS);
  for (; aItCS.More(); aItCS.Next()) {
    const NMTTools_CoupleOfShape& aCS=aItCS.Value();
    //
    const TopoDS_Shape& aF1=aCS.Shape1();
    const TopoDS_Shape& aF2=aCS.Shape2();
    //
    //
    if (aMCV.Contains(aF1)) {
      TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF1);
      aMV.Add(aF1);
      aMV.Add(aF2);
    }
    else {
      TopTools_IndexedMapOfShape aMV;
      aMV.Add(aF1);
      aMV.Add(aF2);
      aMCV.Add(aF1, aMV);
    }
    //
    if (aMCV.Contains(aF2)) {
      TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF2);
      aMV.Add(aF1);
      aMV.Add(aF2);
    }
    else {
      TopTools_IndexedMapOfShape aMV;
      aMV.Add(aF1);
      aMV.Add(aF2);
      aMCV.Add(aF2, aMV);
    }
  }
  NMTTools_Tools::FindChains(aMCV, aMapChains);
}

Here is the call graph for this function:

Definition at line 565 of file NMTTools_Tools.cxx.

{
  Standard_Integer  i, j, aNbCV, aNbV;
  TopTools_IndexedMapOfShape aProcessed, aChain;
  //
  aNbCV=aMCV.Extent();
  for (i=1; i<=aNbCV; ++i) {
    const TopoDS_Shape& aF=aMCV.FindKey(i);
    if (aProcessed.Contains(aF)) {
      continue;
    }
    //
    aProcessed.Add(aF);
    aChain.Add(aF);
    //
    const TopTools_IndexedMapOfShape& aMV=aMCV(i);
    aNbV=aMV.Extent();
    for (j=1; j<=aNbV; ++j) {
      const TopoDS_Shape& aFx=aMV(j);
      ProcessBlock(aFx, aMCV, aProcessed, aChain);
    }
    aMapChains.Add(aF, aChain);
    aChain.Clear();
  }
}

Here is the call graph for this function:

Standard_Boolean NMTTools_Tools::IsSplitInOnFace ( const TopoDS_Edge &  aE,
const TopoDS_Face &  aF,
const Handle(IntTools_Context)&  aCtx 
) [static]

Definition at line 216 of file NMTTools_Tools.cxx.

{
  Standard_Boolean bFlag;
  Standard_Real aT, aTolE, aTolF, aTol, aDist, aU, aV;
  gp_Pnt aP;
  gp_Pnt2d aP2D;
  //
  aTolE=BRep_Tool::Tolerance(aE);
  aTolF=BRep_Tool::Tolerance(aF);
  aTol=aTolE+aTolF;
  //
  GeomAPI_ProjectPointOnSurf& aProjector=aContext->ProjPS(aF);
  //
  aT=BOPTools_Tools2D::IntermediatePoint(aE);
  BOPTools_Tools::PointOnEdge(aE, aT, aP);
  //
  aProjector.Perform(aP);
  bFlag=aProjector.IsDone();
  if (!bFlag) {
    return bFlag;
  }
  //
  aDist=aProjector.LowerDistance();
  bFlag=(aDist <= aTol);
  if (!bFlag) {
    return bFlag;
  }
  //
  aProjector.LowerDistanceParameters(aU, aV);
  aP2D.SetCoord(aU, aV);
  bFlag=aContext->IsPointInOnFace (aF, aP2D);
  return bFlag;
}
void NMTTools_Tools::MakeNewVertex ( const TopTools_ListOfShape &  aLV,
TopoDS_Vertex &  aNewVertex 
) [static]

Definition at line 255 of file NMTTools_Tools.cxx.

{
  Standard_Integer aNb;
  Standard_Real aTi, aDi, aDmax=-1.e5;
  gp_Pnt aPi, aP;
  gp_XYZ aXYZ(0.,0.,0.), aXYZi;
  TopTools_ListIteratorOfListOfShape anIt;
  //
  aNb=aLVs.Extent();
  if (!aNb) {
    return;
  }
  //
  anIt.Initialize(aLVs);
  for (; anIt.More(); anIt.Next()) {
    TopoDS_Vertex aVi=TopoDS::Vertex(anIt.Value());
    aPi=BRep_Tool::Pnt(aVi);
    aXYZi=aPi.XYZ();
    aXYZ=aXYZ+aXYZi;
  }
  //
  aXYZ.Divide((Standard_Real)aNb);
  aP.SetXYZ(aXYZ);
  //
  anIt.Initialize(aLVs);
  for (; anIt.More(); anIt.Next()) {
    TopoDS_Vertex aVi=TopoDS::Vertex(anIt.Value());
    aPi=BRep_Tool::Pnt(aVi);
    aTi=BRep_Tool::Tolerance(aVi);
    aDi=aP.Distance(aPi);
    aDi=aDi+aTi;
    if (aDi > aDmax) {
      aDmax=aDi;
    }
  }
  BRep_Builder aBB;
  aBB.MakeVertex (aNewVertex, aP, aDmax);
}
void NMTTools_Tools::MakePCurve ( const TopoDS_Edge &  aE,
const TopoDS_Face &  aF,
const Handle(Geom2d_Curve)&  aC2D 
) [static]

Definition at line 117 of file NMTTools_Tools.cxx.

{
  Standard_Real aTolE, aT1, aT2, aOutFirst, aOutLast, aOutTol;
  Handle(Geom2d_Curve) aC2D, aC2DA;
  TopoDS_Face aFFWD;
  BRep_Builder aBB;
  //
  aFFWD=aF;
  aFFWD.Orientation(TopAbs_FORWARD);
  //
  aTolE=BRep_Tool::Tolerance(aE);
  //
  const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aT1, aT2);
  Handle(Geom_TrimmedCurve)aC3DETrim=new Geom_TrimmedCurve(aC3DE, aT1, aT2);
  //
  aC2D=aC2Dx1;
  if (aC2D.IsNull()) { // ?
    BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aFFWD);
    BOPTools_Tools2D::CurveOnSurface(aE, aFFWD, aC2D, aOutFirst, aOutLast, aOutTol, Standard_True);
  }
  //
  if (aC3DE->IsPeriodic()) {
    BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2,  aC2D, aC2DA);
  }
  else {
    BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA);
  }
  //
  aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE);
  BRepLib::SameParameter(aE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NMTTools_Tools::UpdateEdge ( const TopoDS_Edge &  aE,
const Standard_Real  aTol 
) [static]

Definition at line 93 of file NMTTools_Tools.cxx.

{
  Standard_Real aTolE, aTolES, aTolV;
  TopoDS_Iterator aIt;
  BRep_Builder aBB;
  //
  aTolE=BRep_Tool::Tolerance(aE);
  aTolES=Max(aTolR, aTolE);
  aBB.UpdateEdge(aE, aTolES);
  //
  aIt.Initialize(aE);
  for (; aIt.More(); aIt.Next()) {
    const TopoDS_Vertex& aV=TopoDS::Vertex(aIt.Value());
    aTolV=BRep_Tool::Tolerance(aV);
    if (aTolV<aTolES) {
       aBB.UpdateVertex(aV, aTolES);
    }
  }
}

Here is the caller graph for this function:


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