Logo Search packages:      
Sourcecode: opencascade version File versions  Download package

void TopOpeBRep_FacesFiller::ProcessVPonR ( const TopOpeBRep_VPointInter &  VP,
const TopOpeBRepDS_Transition &  trans1,
const TopoDS_Shape F1,
const Standard_Integer  ShapeIndex 
)

adds <VP>'s geometric point (if not stored) and
computes (curve or edge)/(point or vertex) interference.

Definition at line 617 of file TopOpeBRep_vpr.cxx.

References Precision::Angular(), TopExp_Explorer::Current(), BRep_Tool::Degenerated(), TopExp_Explorer::Init(), TopoDS_Shape::IsSame(), gp_Vec::Magnitude(), TopExp_Explorer::More(), TopExp_Explorer::Next(), TopoDS_Shape::Orientation(), gp_Vec::Reverse(), TopOpeBRepDS_Interference::Support(), TopOpeBRepDS_Interference::SupportType(), and BRep_Tool::Surface().

Referenced by ProcessVPR().

{
  Standard_Integer absindex = VP.ShapeIndex(); // 0,1,2,3
  Standard_Integer iVP = VP.Index();
  Standard_Boolean OOShapeIndex = (ShapeIndex == 1) ? 2 : 1;
  Standard_Boolean on2edges = (absindex == 3);
  Standard_Boolean hasONedge = (VP.State(OOShapeIndex) == TopAbs_ON);
  Standard_Boolean hasOOedge = (on2edges) ? Standard_True : hasONedge;

  TopoDS_Face Face = (*this).Face(ShapeIndex);
  Standard_Integer iSIFace = myDS->Shape(Face);
  if (iSIFace == 0) iSIFace = myDS->AddShape(Face,ShapeIndex);
  TopoDS_Face OOFace = (*this).Face(OOShapeIndex);
  Standard_Integer iOOFace = myDS->Shape(OOFace);
  if (iOOFace == 0)  iOOFace = myDS->AddShape(OOFace,OOShapeIndex);

  // current VPoint is on <edge>
  Standard_Integer SIedgeIndex = 0;
  const TopoDS_Edge& edge = TopoDS::Edge(VP.Edge(ShapeIndex));
  if (myDS->HasShape(edge)) SIedgeIndex = myDS->Shape(edge);
  Standard_Real paredge = VP.EdgeParameter(ShapeIndex);
  Standard_Boolean isrest = myDS->IsSectionEdge(edge);
  Standard_Boolean closing = TopOpeBRepTool_ShapeTool::Closed(edge,Face);
  Standard_Boolean dge = BRep_Tool::Degenerated(edge);
  
  // dummy if !<hasOOedge>
  Standard_Integer OOedgeIndex = 0; 
  Standard_Boolean OOclosing,OOisrest; OOclosing = OOisrest = Standard_False;
  TopoDS_Edge OOedge; Standard_Real OOparedge = 0.; Standard_Boolean dgOOe = Standard_False;
  if ( hasOOedge ) {
    if (on2edges) OOparedge = VP.EdgeParameter(OOShapeIndex);
    else          OOparedge = VP.EdgeONParameter(OOShapeIndex);
    TopoDS_Shape OOe;
    if (on2edges) OOe = VP.Edge(OOShapeIndex);
    else          OOe = VP.EdgeON(OOShapeIndex);
    OOedge = TopoDS::Edge(OOe);
    if (myDS->HasShape(OOedge)) OOedgeIndex = myDS->Shape(OOedge);
    OOisrest = myDS->IsSectionEdge(OOedge);
    OOclosing = TopOpeBRepTool_ShapeTool::Closed(OOedge,OOFace);
    dgOOe = BRep_Tool::Degenerated(OOedge);
  }

#ifdef DEB
  Standard_Boolean traceDSF = TopOpeBRepDS_GettraceDSF();
  Standard_Boolean traceDSP = TopOpeBRepDS_GettraceDSP();
  Standard_Integer ili=myLine->Index(),ivp=iVP,isi=ShapeIndex;
  if(traceDSF || traceDSP){
    cout<<endl;
    cout<<"trc tnvp 1 "<<myexF1<<" "<<myexF2<<" "<<ili<<" "<<ivp<<" "<<isi;
    cout<<"; # VPonR "<<iVP<<" on "<<ShapeIndex<<" from "<<absindex<<endl;
  }
  GLOBAL_bvpr = TopOpeBRep_GettraceNVP(myexF1,myexF2,ili,ivp,isi);
  if (TopOpeBRepDS_GettraceISTO()) {
    cout<<"f1,f2,l,vp,si : ";
    cout<<myexF1<<","<<myexF2<<","<<ili<<","<<ivp<<","<<isi<<endl;
  }
  if (GLOBAL_bvpr) debvprmess(myexF1,myexF2,ili,ivp,isi);
  if (traceDSF){
    cout<<"VP is on";if (closing) cout<<" CLOSING";
    cout<<" edge "<<SIedgeIndex; 
    if(isrest) cout<<" RESTRICTION"; cout<<endl;
    if (OOclosing) cout<<"      on CLOSING OOedge "<<OOedgeIndex; 
    if(OOisrest) cout<<" RESTRICTION"; cout<<endl;
  }
#endif

  // degenerated edge processing 
  // ---------------------------
  Standard_Integer PVIndex = 0; // POINT or VERTEX index
  TopOpeBRepDS_Kind PVKind;
  Standard_Boolean EPIfound,CPIfound;
  EPIfound = CPIfound = Standard_False;
  Handle(TopOpeBRepDS_Interference) IEPI,ICPI;
  ProcessVPondgE(VP, ShapeIndex,
             PVKind,PVIndex, // out
             EPIfound,IEPI,  // out
             CPIfound,ICPI); // out
  Standard_Boolean foundPVIndex = (PVIndex != 0);
  
  
  // ===================================================================
  //              <TransLine>, <transEdge>
  // ===================================================================
  
  Standard_Boolean wline = (myLine->TypeLineCurve() == TopOpeBRep_WALKING);
  Standard_Boolean grestriction = (myLine->TypeLineCurve() == TopOpeBRep_RESTRICTION);
  Standard_Boolean glinenotoned = !wline && !grestriction && !myLineIsonEdge;
  
  // lasttransLine (for walking line)
  // -------------
  // set lasttransLine for a WALKING line
  Standard_Boolean dscilempty = myDSCIL.IsEmpty();
  Standard_Boolean setlastonwl = wline && !dscilempty;
  if (setlastonwl) { //xpu171198, FRA61896 (f7,f13-> null DSC1)
    Standard_Real parline = VP.ParameterOnLine();
    Standard_Real par = FDS_Parameter(myDSCIL.Last()); // parameter on curve
    Standard_Real dd = Abs(par-parline); // en fait, ce sont des entiers
    if (dd == 0) setlastonwl=Standard_False;
  }
  TopOpeBRepDS_Transition lasttransLine; if (setlastonwl) lasttransLine = myDSCIL.Last()->Transition();
  
  // edgeori, transLine
  // ------------------
  TopAbs_Orientation edgeori = edge.Orientation();
  TopOpeBRepDS_Transition transLine; 
  transLine = TopOpeBRep_FFTransitionTool::ProcessLineTransition
    (VP,ShapeIndex,edgeori);
  Standard_Boolean trliunk = transLine.IsUnknown();
  
  // 1_ If vpmin has transition OUT/IN, and vpmax is UNKNOWN, 
  //    we change vpmax transition as IN/OUT
  //
  // 2_ If vpmin is UNKNOWN (if vp is first on line and transition is UNKNOWN,
  //    vpmin's transition is ON/ON the OOshape)
  //    we change vpmin transition as OUT/IN
  //
  // (kpart : sphere/box, with the sphere's sewing edge lying on one boxe's 
  //  face and one of the edge's vertices IN the same face)
  
  Standard_Integer iINON1,iINONn,nINON; myLine->VPBounds(iINON1,iINONn,nINON);
  Standard_Boolean islastvp = (iVP == iINONn);
  Standard_Boolean isfirstvp = (iVP == iINON1);
  
  Standard_Boolean keepvp = Standard_False;
  Standard_Boolean ret1 = Standard_False; 
  if ( trliunk ) {
    // <transLine> is unknown :
    //  for a walking -> 
    //     - if <myDSCIL> is not empty,
    //                   we set it as the last transition complemented
    //     - else, 
    //          we look after an determinate transition on VP(i>iVP)
    //          and set transLine as this last complemented.
    //
    //  for a gline not on edge -> 
    //     - if the transition on edge is unknown too and !<keepvp>,
    //       we do not keep it.
    //  elsewhere -> we do not keep <VP>
    
    if      ( wline ) {
      if (setlastonwl) transLine = lasttransLine.Complement();
      else             ::FUN_transForWL(*myLine,iVP,ShapeIndex,transLine);

      //  walki vpfirst on 3, vplast on 0, nvpkept = 2 kept
      if (transLine.IsUnknown()) {
      //modified by NIZHNY-MKK  Mon Jul  3 11:30:03 2000.BEGIN
      Standard_Boolean keepvpfirst = dscilempty && isfirstvp && (nINON == 2);
      if(absindex==3)
        keepvpfirst = keepvpfirst && myLastVPison0;
      //modified by NIZHNY-MKK  Mon Jul  3 11:30:21 2000.END
      if (keepvpfirst) transLine.Set(TopAbs_FORWARD);
#ifdef DEB
      if (traceDSF) cout<<"myLastVPison0 ->"<<endl;
#endif
      ret1 = Standard_False;
      }
    }
    else if ( glinenotoned ) {
      //       if (islastvp)  keepvp = !dscilempty;
      //       if (isfirstvp) keepvp = Standard_True;
      if (isfirstvp) keepvp = Standard_True;
      else {
      if (islastvp)  keepvp = !dscilempty;
      else {
        if(!dge && !dgOOe && (VP.IsVertexOnS1() || VP.IsVertexOnS2())) {
          // If VP is on vertex we should compute at least one interference for the edge.
          // This interference is necessary at least to indicate that the edge intersect something.
          const TopOpeBRep_VPointInter& aFirstPoint = myLine->VPoint(iINON1);
          const TopOpeBRep_VPointInter& aLastPoint = myLine->VPoint(iINONn);

          for(Standard_Integer faceindex = 1; !keepvp && faceindex <=2; faceindex++) {
            Standard_Boolean VPIsVertex = (faceindex==1) ? VP.IsVertexOnS1() : VP.IsVertexOnS2();
            Standard_Boolean FirstPointIsVertex = (faceindex==1) ? aFirstPoint.IsVertexOnS1() : aFirstPoint.IsVertexOnS2();
            Standard_Boolean LastPointIsVertex =  (faceindex==1) ? aLastPoint.IsVertexOnS1() : aLastPoint.IsVertexOnS2();
            if(VPIsVertex) {
            const TopoDS_Shape& aV1 =  (faceindex==1) ? VP.VertexOnS1() : VP.VertexOnS2();
            if(FirstPointIsVertex) {              
              const TopoDS_Shape& aV2 =  (faceindex==1) ? aFirstPoint.VertexOnS1(): aFirstPoint.VertexOnS2();
              if(aV1.IsSame(aV2)) {
                keepvp = Standard_True;
              }
            }
            if(!keepvp && LastPointIsVertex) {
              const TopoDS_Shape& aV2 =  (faceindex==1) ? aLastPoint.VertexOnS1() : aLastPoint.VertexOnS2();
              if(aV1.IsSame(aV2)) {
                keepvp = !dscilempty;
              }
            }
            }
          }
        }
      }
      }      
      ret1 = !keepvp;
    }
    else 
      ret1 = Standard_True;
  }
  trliunk = transLine.IsUnknown();
  if (ret1) return;

  // Transori, transEdge
  // -------------------
  TopAbs_Orientation Transori = Trans.Orientation(TopAbs_IN);
  TopOpeBRepDS_Transition transEdge = TopOpeBRep_FFTransitionTool::ProcessEdgeTransition(VP,ShapeIndex,Transori);  
#ifdef DEB
  if(traceDSF){cout<<"trans edge on f"<<ShapeIndex<<" / f"<<OOShapeIndex<<" : ";
             transEdge.Dump(cout);cout<<endl;}
#endif

  Standard_Boolean Tunknown = FDS_hasUNK(transEdge);
  TopOpeBRepDS_Point PDS = TopOpeBRep_PointGeomTool::MakePoint(VP);// <VP>'s geometry  
  TopOpeBRepDS_ListOfInterference lITOOFonVP; // {I on <edge> = (T on <OOface>, G on <VP>, S)}
  Standard_Boolean found = Standard_False;
  if (SIedgeIndex != 0) {
    TopOpeBRepDS_ListOfInterference lI; 
    const TopOpeBRepDS_ListOfInterference& lIedge = myDS->ShapeInterferences(edge);
    if (PVIndex == 0) ::FUN_ScanInterfList(PDS,myHDS,lIedge,lI);
    else              ::FUN_selectGinterference(lIedge,PVIndex,lI);
    found = ::FUN_selectTRAISHAinterference(lI,iOOFace,lITOOFonVP);    
  }

//  if (found && myLineINL && Tunknown) return; //xpu220998 : cto cylcong A1 (edge8,OOface4)

  // <Transori> = INTERNAL or EXTERNAL (tangent cases), compute <transEdge>
  Standard_Boolean newtransEdge = (Transori == TopAbs_INTERNAL) || (Transori == TopAbs_EXTERNAL);
  TopAbs_Orientation otransEdge = transEdge.Orientation(TopAbs_IN);
  Standard_Boolean allINT = (Transori == TopAbs_INTERNAL) || (otransEdge == TopAbs_INTERNAL);
  Standard_Boolean allEXT = (Transori == TopAbs_EXTERNAL) || (otransEdge == TopAbs_EXTERNAL);


  newtransEdge = newtransEdge && (!allINT) && (!allEXT);
  newtransEdge = newtransEdge || Tunknown;
  // -> intersection fails for closing edges
  // 1. <edge> touches closing <OOedge> at <VP> && <OOedge> is tangent to <OOFace>,
  // intersection -> 1 forward && 1 reversed instead of internal/external.
  // 2. if <edge> is tangent to <OOFace> at <VP> on walking
  newtransEdge = newtransEdge || closing || OOclosing;
  newtransEdge = newtransEdge && (!myLineINL); 
  if (newtransEdge){
#ifdef DEB
    Standard_Integer iedge =
#endif
                myDS->Shape(edge);
    newtransEdge = !found;
    if (found) { 
      // Getting first transition found
      // prequesitory : transition on edge / <OOF> on same geometry point is unchanged
      TopOpeBRepDS_Transition Tr = lITOOFonVP.First()->Transition();
      transEdge.Before(Tr.Before()); transEdge.After(Tr.After());
    }
    if (newtransEdge) {
      // Compute of <transEdge> : transition on <edge> at geometry <VP> / <OOface>
      // if line on a restriction OOedge of <OOface> : gets <edge> transition/<OOface> when
      //                                               at <VP> on OOedge.
      // if line is not on restriction : gets <edge> transition/<OOface>.
      TopOpeBRepDS_Transition Tr;
      Standard_Boolean ok = FUN_newtransEdge(myHDS,(*this),(*myLine),myLineIsonEdge,VP,
                        PVKind,PVIndex,OOShapeIndex,edge,myERL,Tr);
      if (ok) {transEdge.Before(Tr.Before()); transEdge.After(Tr.After());}
      newtransEdge = ok;
    }
#ifdef DEB
    if (traceDSF && (found || newtransEdge)) 
      {if (found) cout<<"*-> found "; if (newtransEdge) cout<<"*-> new ";
       cout<<"transEdge (edge "<<iedge<<",face"<<iOOFace<<") = "; TopAbs::Print(transEdge.Before(),cout);
       cout<<" ";TopAbs::Print(transEdge.After(),cout);cout<<endl;}
#endif
  } // newtransEdge

  Standard_Boolean tredunk = transEdge.IsUnknown();
  Standard_Boolean ret2 = Standard_False;
  if ( tredunk ) {
    if (!trliunk) transEdge = transLine.Complement();
    if (trliunk && !keepvp) ret2 = Standard_True;
  }
  if (ret2) return;
  tredunk = transEdge.IsUnknown();

  // ===================================================================
  //              DS geometry Management
  // ===================================================================
  // SI*** : data issued from shape ShapeIndex
  // OO*** : data issued from other shape
    
  if (SIedgeIndex == 0) SIedgeIndex = myDS->AddShape(edge,ShapeIndex);
#ifdef DEB
  Standard_Boolean trce = TopOpeBRepDS_GettraceSPSX(SIedgeIndex); if(trce) debarc(SIedgeIndex);
#endif

  Standard_Boolean SIisvertex = VP.IsVertex(ShapeIndex);
  Standard_Boolean OOisvertex = VP.IsVertex(OOShapeIndex);
    
  // <PVIndex>, <PVKind> :
  // --------------------
  // search for an interference with a equal 3D geometry
  // if found, set <PVIndex> to index of geometry found
  // if not found, make a new geometry PVIndex with 3d point or vertex      

  // modified by NIZHNY-MKK  Tue Apr  3 12:08:38 2001.BEGIN
  Standard_Boolean ismultiplekind = foundPVIndex && !EPIfound && !CPIfound && 
    (SIisvertex || OOisvertex) && (PVKind == TopOpeBRepDS_POINT);

  //   if (!foundPVIndex) FUN_VPIndex ((*this),(*myLine),VP,ShapeIndex,myHDS,myDSCIL, //in
  if (!foundPVIndex || ismultiplekind) FUN_VPIndex ((*this),(*myLine),VP,ShapeIndex,myHDS,myDSCIL, //in
  // modified by NIZHNY-MKK  Tue Apr  3 12:13:17 2001.END
                                        PVKind,PVIndex, // out
                                        EPIfound,IEPI,  // out
                                        CPIfound,ICPI,  // out
                                        M_MKNEWVP);
  if (PVIndex == 0){
#ifdef DEB
    funraise();
#endif
  }
  
  Standard_Boolean VPonedge=Standard_False; if (PVKind == TopOpeBRepDS_VERTEX) VPonedge=::FUN_onedge(PDS,edge);
  if (myLineINL) {
    Standard_Real tolang = Precision::Angular()*1.e5;//=1.e-7 NYITOLXPU

    gp_Vec tgE = FUN_tool_tggeomE(paredge,edge);
    gp_Pnt2d OOuv; Standard_Boolean ok = Standard_False;
    if (VPonedge) {OOuv = VP.SurfaceParameters(OOShapeIndex); ok = Standard_True;}
    else          {ok = FUN_tool_paronEF(OOedge,OOparedge,OOFace, OOuv);} 
    gp_Vec ntOOF;
    if (ok) ntOOF = FUN_tool_nggeomF(OOuv,OOFace);
    if (OOFace.Orientation() == TopAbs_REVERSED) ntOOF.Reverse();       
    
    Standard_Real tol = 1.e-7;
    if (ok) ok = (tgE.Magnitude() > tol)&&(ntOOF.Magnitude() > tol);
    Standard_Real dot = 1.e7; if (ok) dot = gp_Dir(tgE).Dot(gp_Dir(ntOOF));
      

    Handle(Geom_Surface) su = BRep_Tool::Surface(OOFace);
    Standard_Boolean apex = FUN_tool_onapex(OOuv,su);      
    TopOpeBRepDS_Transition T;
    if (!apex && ok && (Abs(dot) > tolang)) {  
      TopAbs_Orientation ori = (dot < 0.) ? TopAbs_FORWARD : TopAbs_REVERSED;
      T.Set(ori);
    }

    if (VPonedge && (!dge)) {
      //xpu231098 : cto904C8(edge11)
      // xpu131198 : CTS21802(edge31)
      if (iOOFace == 0) iOOFace = myDS->AddShape(OOFace,OOShapeIndex);
      Handle(TopOpeBRepDS_Interference) EPIf;
      {
      T.Index(iOOFace);
      EPIf = MakeEPVInterference(T,iOOFace,PVIndex,paredge,PVKind,TopOpeBRepDS_FACE,SIisvertex);
      }
      myHDS->StoreInterference(EPIf,edge);
      if (on2edges || hasONedge) {
      if (OOedgeIndex == 0) OOedgeIndex = myDS->AddShape(OOedge,OOShapeIndex);
      Handle(TopOpeBRepDS_Interference) EPI;
      {
        T.Index(iOOFace);
        EPI = MakeEPVInterference(T,OOedgeIndex,PVIndex,paredge,PVKind,SIisvertex);
      }
      myHDS->StoreInterference(EPI,edge);
      }
      return;
    }//VPonedge
    else {
      // compute interferences later on
      //modified by NIZHNY-MZV  Thu Dec 23 13:27:10 1999
      if(!T.IsUnknown()) {
      transEdge.Before(T.Before()); 
      transEdge.After(T.After());
      }
    }
  }//myLineINL

#ifdef DEB
  Standard_Integer SEPI = (EPIfound) ? IEPI->Support() : 0;
#endif
  TopOpeBRepDS_Kind SKEPI; if(EPIfound) SKEPI=IEPI->SupportType();
#ifdef DEB
  Standard_Integer SCPI = (CPIfound) ? ICPI->Support() : 0;
#endif
  TopOpeBRepDS_Kind SKCPI; if(CPIfound) SKCPI=ICPI->SupportType();

  // Gfound = VP corresponds with an existing geometry of ShapeIndex
  Standard_Boolean Gfound = ( EPIfound || CPIfound );  
#ifdef DEB
  Standard_Boolean trcpv = TopOpeBRepDS_GettraceSPSX(PVIndex);
  Standard_Boolean ispoint = (PVKind == TopOpeBRepDS_POINT);
  if(trcpv && ispoint)  debpoint(PVIndex);
  if(trcpv && !ispoint) debvertex(PVIndex);
  if (GLOBAL_bvpr) debvprmess(myexF1,myexF2,ili,ivp,isi);
#endif

  // ===================================================================
  //          Current VPoint VP is kept
  // ===================================================================  

  // ------------------------------------------
  // -- Curve/(POINT,VERTEX) Interference (CPI)
  // ------------------------------------------
  
  Standard_Boolean noCPI = myLineIsonEdge;
  noCPI = noCPI || (!on2edges && hasOOedge && (OOisrest || isrest)); 

  Standard_Boolean condi = (!noCPI);
  condi = condi && (!myLineINL); // INL
  if (condi) {
    Standard_Integer keptVPnbr = mykeptVPnbr;
    FUN_processCPI((*this),VP,Face,ShapeIndex,(*myLine),myDS,
               transLine,myDSCIL,ICPI,Gfound,PVKind,PVIndex,
               keptVPnbr);
    mykeptVPnbr = keptVPnbr;
  }
  
  // ------------------------------------------
  // --- Edge/(POINT,VERTEX) Interference (EPI) 
  // ------------------------------------------

//  if (on2edges && !Gfound && !closing) {
  Standard_Boolean condi2 = (on2edges && !closing);
  condi2 = condi2 || (hasONedge && !closing); 
  if (condi2 && (!dge)) {
    if (OOedgeIndex == 0) OOedgeIndex = myDS->AddShape(OOedge,OOShapeIndex);
    
    Handle(TopOpeBRepDS_Interference) EPI;
    {
      TopOpeBRepDS_Transition T = transEdge;
      if (iOOFace == 0) iOOFace = myDS->AddShape(OOFace,OOShapeIndex);
      T.Index(iOOFace);
      EPI = MakeEPVInterference(T,OOedgeIndex,PVIndex,paredge,PVKind,SIisvertex);
    }
    myHDS->StoreInterference(EPI,edge);
  } //condi2

  // ===================================================================
  // manip corrective d'un pb. d'intersection
  // - le VPoint est donne sur une restriction de ShapeIndex (1 ou 2),
  // - le VPoint est ON une restriction de l'autre shape (OOShapeIndex)
  // --> le VPoint n'est PAS donne sur restriction de OOShapeIndex NYI
  //     par les intersections (a ameliorer). NYI             
  // L'etat ON sur OOShapeIndex indique que le point est sur une 
  // de ses restrictions :
  // - on ne met PAS le point dans les CPIs
  // - on met le point dans les EPIs de l'arete de OOShapeIndex
  // ===================================================================

  Standard_Boolean correctON = !on2edges && hasONedge && !dgOOe;
  Standard_Boolean correctedON = Standard_False;
  if ( correctON ) {  
    TopOpeBRepDS_ListOfInterference lITFonVP; Standard_Boolean OOfound = Standard_False;
    if (OOedgeIndex != 0) {
      const TopOpeBRepDS_ListOfInterference& lIOOedge = myDS->ShapeInterferences(OOedge); 
      TopOpeBRepDS_ListOfInterference lI; ::FUN_ScanInterfList(PDS,myHDS,lIOOedge,lI);
      OOfound = ::FUN_selectTRAISHAinterference(lI,iSIFace,lITFonVP);
      correctON = !OOfound;        
    }
  }   
  if ( correctON ) {  
#ifdef DEB
    Standard_Boolean trcooe=TopOpeBRepDS_GettraceSPSX(OOedgeIndex);if (trcooe) debooarc(OOedgeIndex);
#endif
    if (OOedgeIndex == 0) OOedgeIndex = myDS->AddShape(OOedge,OOShapeIndex);
    
    // VP a ete classifie ON sur l'edge <OOedge>.
    // calcul de la transition <tOOedge> sur l'arete <OOedge> 
    // (de l'autre face en jeu, OOShapeIndex) ou le VP est donne ON.
    // On tient compte de l'orientation de <edge> dans <Face>.
    // (bug IntPatch_Line : VP n'a pas de donnees en OOShapeIndex 
    // alors qu'il est dessus)
    
    TopOpeBRepDS_Transition tOOedge;
    // distinguish wether OOedge is the edge on which geometric line lies.
    // OOedge == edge(line) ==> tOOedge = f(orientation of <edge> in <Face> FORWARD)
    // OOedge != edge(line) ==> tOOedge = f(orientation of <Face>)    
    Standard_Real OOpar1,OOpar2; Standard_Boolean isonper; FDS_LOIinfsup((*myDS),OOedge,OOparedge,PVKind,PVIndex,
                                        myDS->ShapeInterferences(OOedge),
                                        OOpar1,OOpar2,isonper);
    //FDS_getupperlower(myHDS,OOedgeIndex,OOparedge,par1,par2);
    gp_Pnt2d OOuv = VP.SurfaceParameters(ShapeIndex);
    
    //       <Tr> relative to 3d <OOface> matter,
    //       we take into account <Tr> / 2d <OOface> only if <edge> is normal to <OOface> 
    Standard_Real tola = Precision::Angular()*1.e+2; //dealing with tolerances 

    // KK : supplying tolerances pbm (tola too small)
    Standard_Boolean EsdmEofF = myHDS->HasSameDomain(OOedge);
    if (EsdmEofF) {
      TopExp_Explorer ex;
      for (ex.Init(Face, TopAbs_EDGE); ex.More(); ex.Next())
      if (FUN_ds_sdm(*myDS,ex.Current(),OOedge)) {EsdmEofF = Standard_True; break;}
    }
    Standard_Boolean OOEtgF = Standard_True;
    if (!EsdmEofF) OOEtgF = FUN_tool_EtgF(OOparedge,OOedge,OOuv,Face,tola);  
    Standard_Boolean OOrest = FUN_INlos(edge,myERL);
    Standard_Boolean interf2d = OOEtgF && (OOisrest || OOrest);
    
    Standard_Real factor = 1.e-2;
    TopOpeBRepTool_makeTransition MKT; 
    Standard_Boolean ok = MKT.Initialize(OOedge,OOpar1,OOpar2,OOparedge,Face,OOuv, factor);

    if (ok && !(interf2d && !MKT.IsT2d())) {
      MKT.SetRest(edge,paredge);
      TopAbs_State stb,sta; ok = MKT.MkTonE(stb,sta); 
      if (ok) {
        tOOedge.Before(stb); tOOedge.After(sta);
#ifdef DEB
        if(traceDSF){
          cout<<"* !on2edges && TopAbs_ON *\n";
          if(OOisrest) cout<<"* edge "<<OOedgeIndex<<" RESTRICTION *\n";
          cout<<"Transition sur <OOedge> "<<OOedgeIndex<<" croisant <edge> "<<SIedgeIndex<<" ";
          TopAbs::Print(edgeori,cout);cout<<" ";tOOedge.Dump(cout);cout<<endl;}
#endif      
        Handle(TopOpeBRepDS_Interference) OOEPIe;
        {
          if (iSIFace == 0) iSIFace = myDS->AddShape(Face,ShapeIndex); 
          TopOpeBRepDS_Transition OOT = tOOedge; OOT.Index(iSIFace);      
          OOEPIe = MakeEPVInterference(OOT,SIedgeIndex,PVIndex,OOparedge,PVKind,OOisvertex);
        }
        myHDS->StoreInterference(OOEPIe,OOedge);
      
        // xpu : 09-03-98
        // hsd3d => interf2d  : only IwithSkEDGE interf 
        // elsewhere            : add an IwithSkFACE interference.
        Standard_Boolean addEPIf = !myLineIsonEdge;
        TopTools_ListOfShape dummy; Standard_Boolean hsd3d = FDS_HasSameDomain3d(*myDS,OOedge,&dummy);
        if (hsd3d) addEPIf = Standard_False;
        if (addEPIf) {
          TopOpeBRepDS_Transition OOT = tOOedge; OOT.Index(iSIFace); 
          Handle(TopOpeBRepDS_Interference) OOEPIf = MakeEPVInterference(OOT,iSIFace,PVIndex,OOparedge,PVKind,
                                                                         TopOpeBRepDS_FACE,OOisvertex);
          myHDS->StoreInterference(OOEPIf,OOedge);
        }
        // xpu : 09-03-98    
        correctedON = Standard_True;
      } // ok
    }
  } // correctON

  if (correctON && !correctedON && noCPI && !myLineIsonEdge) {
    // MSV: correct ON failed, so store CPI
    Standard_Integer keptVPnbr = mykeptVPnbr;
    FUN_processCPI((*this),VP,Face,ShapeIndex,(*myLine),myDS,
               transLine,myDSCIL,ICPI,Gfound,PVKind,PVIndex,
               keptVPnbr);
    mykeptVPnbr = keptVPnbr;
  }

  // closing edge processing 
  // -----------------------
  if ((OOclosing || closing)&& !found) {
    ProcessVPonclosingR(VP,Face,ShapeIndex,
                  transEdge,
                  PVKind,PVIndex,
                  EPIfound,IEPI);
    return;
  }

  // VP processing 
  // -------------
  
  Standard_Boolean addEPI = Standard_False;
  if (!Gfound) {
    addEPI = Standard_True; 
  } 
  else { // EPIfound
    TopAbs_Orientation otransEdge = transEdge.Orientation(TopAbs_IN);

    Standard_Boolean opporifound,memorifound; opporifound = memorifound = Standard_False;
    TopOpeBRepDS_ListOfInterference loIfound; 
    const TopOpeBRepDS_ListOfInterference& EPIL = myDS->ShapeInterferences(edge);
    Standard_Boolean ok = FUN_sameGsameS(EPIL,PVIndex,iOOFace,loIfound);
    if (ok) {
      TopOpeBRepDS_PointIterator PI(loIfound); 
      // on cree une EPI orientee <transEdge> ssi :
      // - il en existe deja une d'orientation opposee a TransEdge
      // - il n'en existe pas deja une d'orientation identique a TransEdge
      for (; PI.More(); PI.Next()){
      TopAbs_Orientation oEPI = PI.Value()->Transition().Orientation(TopAbs_IN);
      if (!memorifound) memorifound = ( oEPI == otransEdge );
      if (!opporifound) opporifound = ( oEPI == TopAbs::Complement(otransEdge) );
      addEPI = (opporifound && ! memorifound);
      if (addEPI) break;
      }
    }
    if (!ok) addEPI = Standard_True;
  } // EPIfound
  
#ifdef DEB
  if (GLOBAL_bvpr) debvprmess(myexF1,myexF2,ili,ivp,isi);
#endif  

  // xpu030998 : edge has restriction on OOface, do NOT append EPIf
  //     cto904A3 (edge19,OOface14,vG16), 
  if (myLineINL) {
    Standard_Real tola = Precision::Angular()*1.e+4; //dealing with tolerances
    gp_Pnt2d uv = VP.SurfaceParameters(OOShapeIndex);
    Standard_Boolean EtgOOF = FUN_tool_EtgF(paredge,edge,uv,OOFace,tola);    
    Standard_Boolean inERL = FUN_INlos(edge,myERL);
    if (EtgOOF && inERL) return; // cto904A3
  }
  
  if ( addEPI && (!dge)) {
    // ShapeIndex = 1,2 --> OOShapeIndex = 2,1
    // point est sur une seule arete <edge> de <ShapeIndex>
    // le Support de l'interference est l'autre 
    // face (OOShapeIndex) / ShapeIndex
    if (iOOFace == 0) iOOFace = myDS->AddShape(OOFace,OOShapeIndex);
    Handle(TopOpeBRepDS_Interference) EPIf;
    {
      TopOpeBRepDS_Transition T = transEdge; T.Index(iOOFace);
      EPIf = MakeEPVInterference(T,iOOFace,PVIndex,paredge,PVKind,TopOpeBRepDS_FACE,SIisvertex);
    }
    myHDS->StoreInterference(EPIf,edge);
  } // addEPI  

} // ProcessVPonR


Generated by  Doxygen 1.6.0   Back to index