Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 09:17:17

0001 // Created on: 1994-10-10
0002 // Created by: Jean Yves LEBEY
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TopOpeBRep_FacesFiller_HeaderFile
0018 #define _TopOpeBRep_FacesFiller_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopAbs_Orientation.hxx>
0025 #include <TopOpeBRep_PFacesIntersector.hxx>
0026 #include <TopOpeBRepDS_PDataStructure.hxx>
0027 #include <Standard_Integer.hxx>
0028 #include <TopOpeBRep_PLineInter.hxx>
0029 #include <TopTools_DataMapOfShapeListOfShape.hxx>
0030 #include <TopOpeBRep_PointClassifier.hxx>
0031 #include <TopOpeBRepTool_PShapeClassifier.hxx>
0032 #include <TopOpeBRepDS_ListIteratorOfListOfInterference.hxx>
0033 #include <TopAbs_State.hxx>
0034 class TopOpeBRepDS_HDataStructure;
0035 class TopOpeBRep_FFDumper;
0036 class TopoDS_Shape;
0037 class TopOpeBRep_VPointInter;
0038 class TopOpeBRep_VPointInterClassifier;
0039 class TopOpeBRep_VPointInterIterator;
0040 class TopOpeBRepDS_Interference;
0041 class TopOpeBRepDS_Point;
0042 class gp_Pnt;
0043 
0044 //! Fills a DataStructure from TopOpeBRepDS with the result
0045 //! of Face/Face intersection described by FacesIntersector from TopOpeBRep.
0046 //! if the faces have same Domain, record it in the DS.
0047 //! else record lines and  points and attach list of interferences
0048 //! to the faces, the lines and the edges.
0049 class TopOpeBRep_FacesFiller
0050 {
0051 public:
0052   DEFINE_STANDARD_ALLOC
0053 
0054   Standard_EXPORT TopOpeBRep_FacesFiller();
0055 
0056   //! Stores in <DS> the intersections of <S1> and <S2>.
0057   Standard_EXPORT void Insert(const TopoDS_Shape&                        F1,
0058                               const TopoDS_Shape&                        F2,
0059                               TopOpeBRep_FacesIntersector&               FACINT,
0060                               const Handle(TopOpeBRepDS_HDataStructure)& HDS);
0061 
0062   Standard_EXPORT void ProcessSectionEdges();
0063 
0064   Standard_EXPORT TopOpeBRep_PointClassifier& ChangePointClassifier();
0065 
0066   //! return field myPShapeClassifier.
0067   Standard_EXPORT TopOpeBRepTool_PShapeClassifier PShapeClassifier() const;
0068 
0069   //! set field myPShapeClassifier.
0070   Standard_EXPORT void SetPShapeClassifier(const TopOpeBRepTool_PShapeClassifier& PSC);
0071 
0072   Standard_EXPORT void LoadLine(TopOpeBRep_LineInter& L);
0073 
0074   Standard_EXPORT Standard_Boolean CheckLine(TopOpeBRep_LineInter& L) const;
0075 
0076   //! compute position of VPoints of lines
0077   Standard_EXPORT void VP_Position(TopOpeBRep_FacesIntersector& FACINT);
0078 
0079   //! compute position of VPoints of line L
0080   Standard_EXPORT void VP_Position(TopOpeBRep_LineInter& L);
0081 
0082   //! compute position of VPoints of non-restriction line L.
0083   Standard_EXPORT void VP_PositionOnL(TopOpeBRep_LineInter& L);
0084 
0085   //! compute position of VPoints of restriction line L.
0086   Standard_EXPORT void VP_PositionOnR(TopOpeBRep_LineInter& L);
0087 
0088   //! compute position of VP with current faces,
0089   //! according to VP.ShapeIndex() .
0090   Standard_EXPORT void VP_Position(TopOpeBRep_VPointInter&           VP,
0091                                    TopOpeBRep_VPointInterClassifier& VPC);
0092 
0093   //! Process current intersection line (set by LoadLine)
0094   Standard_EXPORT void ProcessLine();
0095 
0096   Standard_EXPORT void ResetDSC();
0097 
0098   //! Process current restriction line, adding restriction edge
0099   //! and computing face/edge interference.
0100   Standard_EXPORT void ProcessRLine();
0101 
0102   //! VP processing for restriction  line  and line sharing
0103   //! same domain with  section edges :
0104   //! - if restriction :
0105   //! Adds restriction edges as  section edges and compute
0106   //! face/edge  interference.
0107   //! - if  same domain :
0108   //! If line share same domain  with section edges, compute
0109   //! parts of line IN/IN the two faces, and compute curve/point
0110   //! interference for VP boundaries.
0111   Standard_EXPORT void FillLineVPonR();
0112 
0113   Standard_EXPORT void FillLine();
0114 
0115   //! compute 3d curve, pcurves and face/curve interferences
0116   //! for current NDSC. Add them to the DS.
0117   Standard_EXPORT void AddShapesLine();
0118 
0119   //! Get map <mapES > of restriction edges having parts IN one
0120   //! of the 2 faces.
0121   Standard_EXPORT void GetESL(TopTools_ListOfShape& LES);
0122 
0123   //! calling the following ProcessVPIonR and ProcessVPonR.
0124   Standard_EXPORT void ProcessVPR(TopOpeBRep_FacesFiller& FF, const TopOpeBRep_VPointInter& VP);
0125 
0126   //! processing ProcessVPonR for VPI.
0127   Standard_EXPORT void ProcessVPIonR(TopOpeBRep_VPointInterIterator& VPI,
0128                                      const TopOpeBRepDS_Transition&  trans1,
0129                                      const TopoDS_Shape&             F1,
0130                                      const Standard_Integer          ShapeIndex);
0131 
0132   //! adds <VP>'s   geometric   point (if not   stored)  and
0133   //! computes (curve or edge)/(point or vertex) interference.
0134   Standard_EXPORT void ProcessVPonR(const TopOpeBRep_VPointInter&  VP,
0135                                     const TopOpeBRepDS_Transition& trans1,
0136                                     const TopoDS_Shape&            F1,
0137                                     const Standard_Integer         ShapeIndex);
0138 
0139   //! VP processing on closing arc.
0140   Standard_EXPORT void ProcessVPonclosingR(const TopOpeBRep_VPointInter&            VP,
0141                                            const TopoDS_Shape&                      F1,
0142                                            const Standard_Integer                   ShapeIndex,
0143                                            const TopOpeBRepDS_Transition&           transEdge,
0144                                            const TopOpeBRepDS_Kind                  PVKind,
0145                                            const Standard_Integer                   PVIndex,
0146                                            const Standard_Boolean                   EPIfound,
0147                                            const Handle(TopOpeBRepDS_Interference)& IEPI);
0148 
0149   //! VP processing on degenerated arc.
0150   Standard_EXPORT Standard_Boolean ProcessVPondgE(const TopOpeBRep_VPointInter&      VP,
0151                                                   const Standard_Integer             ShapeIndex,
0152                                                   TopOpeBRepDS_Kind&                 PVKind,
0153                                                   Standard_Integer&                  PVIndex,
0154                                                   Standard_Boolean&                  EPIfound,
0155                                                   Handle(TopOpeBRepDS_Interference)& IEPI,
0156                                                   Standard_Boolean&                  CPIfound,
0157                                                   Handle(TopOpeBRepDS_Interference)& ICPI);
0158 
0159   //! processing ProcessVPnotonR for VPI.
0160   Standard_EXPORT void ProcessVPInotonR(TopOpeBRep_VPointInterIterator& VPI);
0161 
0162   //! adds <VP>'s  geometrical point to the DS (if not stored)
0163   //! and computes curve point interference.
0164   Standard_EXPORT void ProcessVPnotonR(const TopOpeBRep_VPointInter& VP);
0165 
0166   //! Get the geometry of a DS point <DSP>.
0167   //! Search for it with ScanInterfList (previous method).
0168   //! if found, set <G> to the geometry of the interference found.
0169   //! else, add the point <DSP> in the <DS> and set <G> to the
0170   //! value of the new geometry such created.
0171   //! returns the value of ScanInterfList().
0172   Standard_EXPORT Standard_Boolean GetGeometry(TopOpeBRepDS_ListIteratorOfListOfInterference& IT,
0173                                                const TopOpeBRep_VPointInter&                  VP,
0174                                                Standard_Integer&                              G,
0175                                                TopOpeBRepDS_Kind&                             K);
0176 
0177   Standard_EXPORT Standard_Integer MakeGeometry(const TopOpeBRep_VPointInter& VP,
0178                                                 const Standard_Integer        ShapeIndex,
0179                                                 TopOpeBRepDS_Kind&            K);
0180 
0181   //! Add interference <I> to list myDSCIL.
0182   //! on a given line, at first call, add a new DS curve.
0183   Standard_EXPORT void StoreCurveInterference(const Handle(TopOpeBRepDS_Interference)& I);
0184 
0185   //! search for G = geometry of Point which is identical to <DSP>
0186   //! among the DS Points created in the CURRENT face/face
0187   //! intersection ( current Insert() call).
0188   Standard_EXPORT Standard_Boolean GetFFGeometry(const TopOpeBRepDS_Point& DSP,
0189                                                  TopOpeBRepDS_Kind&        K,
0190                                                  Standard_Integer&         G) const;
0191 
0192   //! search for G = geometry of Point which is identical to <VP>
0193   //! among the DS Points created in the CURRENT face/face
0194   //! intersection ( current Insert() call).
0195   Standard_EXPORT Standard_Boolean GetFFGeometry(const TopOpeBRep_VPointInter& VP,
0196                                                  TopOpeBRepDS_Kind&            K,
0197                                                  Standard_Integer&             G) const;
0198 
0199   Standard_EXPORT TopOpeBRep_FacesIntersector& ChangeFacesIntersector();
0200 
0201   Standard_EXPORT Handle(TopOpeBRepDS_HDataStructure) HDataStructure();
0202 
0203   Standard_EXPORT TopOpeBRepDS_DataStructure& ChangeDataStructure();
0204 
0205   Standard_EXPORT const TopoDS_Face& Face(const Standard_Integer I) const;
0206 
0207   Standard_EXPORT const TopOpeBRepDS_Transition& FaceFaceTransition(const TopOpeBRep_LineInter& L,
0208                                                                     const Standard_Integer I) const;
0209 
0210   Standard_EXPORT const TopOpeBRepDS_Transition& FaceFaceTransition(const Standard_Integer I) const;
0211 
0212   Standard_EXPORT TopOpeBRep_PFacesIntersector PFacesIntersectorDummy() const;
0213 
0214   Standard_EXPORT TopOpeBRepDS_PDataStructure PDataStructureDummy() const;
0215 
0216   Standard_EXPORT TopOpeBRep_PLineInter PLineInterDummy() const;
0217 
0218   Standard_EXPORT void SetTraceIndex(const Standard_Integer exF1, const Standard_Integer exF2);
0219 
0220   Standard_EXPORT void GetTraceIndex(Standard_Integer& exF1, Standard_Integer& exF2) const;
0221 
0222   //! Computes <pmin> and <pmax> the upper and lower bounds of <L>
0223   //! enclosing all vpoints.
0224   Standard_EXPORT static void Lminmax(const TopOpeBRep_LineInter& L,
0225                                       Standard_Real&              pmin,
0226                                       Standard_Real&              pmax);
0227 
0228   //! Returns <True> if <L> shares a same geometric domain with
0229   //! at least one of the section edges of <ERL>.
0230   Standard_EXPORT static Standard_Boolean LSameDomainERL(const TopOpeBRep_LineInter& L,
0231                                                          const TopTools_ListOfShape& ERL);
0232 
0233   //! Computes the transition <T> of the VPoint <iVP> on the edge
0234   //! of <SI12>. Returns <False> if the status is unknown.
0235   Standard_EXPORT static Standard_Boolean IsVPtransLok(const TopOpeBRep_LineInter& L,
0236                                                        const Standard_Integer      iVP,
0237                                                        const Standard_Integer      SI12,
0238                                                        TopOpeBRepDS_Transition&    T);
0239 
0240   //! Computes   transition   on line for  VP<iVP>   on edge
0241   //! restriction of <SI>.  If <isINOUT>  :  returns <true> if
0242   //! transition computed is IN/OUT else : returns <true> if
0243   //! transition computed is OUT/IN.
0244   Standard_EXPORT static Standard_Boolean TransvpOK(const TopOpeBRep_LineInter& L,
0245                                                     const Standard_Integer      iVP,
0246                                                     const Standard_Integer      SI,
0247                                                     const Standard_Boolean      isINOUT);
0248 
0249   //! Returns parameter u of vp on the restriction edge.
0250   Standard_EXPORT static Standard_Real VPParamOnER(const TopOpeBRep_VPointInter& vp,
0251                                                    const TopOpeBRep_LineInter&   Lrest);
0252 
0253   Standard_EXPORT static Standard_Boolean EqualpPonR(const TopOpeBRep_LineInter&   Lrest,
0254                                                      const TopOpeBRep_VPointInter& VP1,
0255                                                      const TopOpeBRep_VPointInter& VP2);
0256 
0257 protected:
0258 private:
0259   Standard_EXPORT Standard_Boolean KeepRLine(const TopOpeBRep_LineInter& Lrest,
0260                                              const Standard_Boolean      checkkeep) const;
0261 
0262   Standard_EXPORT TopOpeBRepDS_Transition GetEdgeTrans(const TopOpeBRep_VPointInter& VP,
0263                                                        const TopOpeBRepDS_Kind       PVKind,
0264                                                        const Standard_Integer        PVIndex,
0265                                                        const Standard_Integer        Sind,
0266                                                        const TopoDS_Face&            F);
0267 
0268   //! If <VP>'s index != 3, calls a classifier to determine
0269   //! <VP>'s state on the face.
0270   Standard_EXPORT TopAbs_State StateVPonFace(const TopOpeBRep_VPointInter& VP) const;
0271 
0272   //! <VP> is of geometry <P>.
0273   //! Looks after a   VPoint on RESTRICTION <Lrest>  with
0274   //! geometric value  <P>. If true, updates states ON for <VP>.
0275   Standard_EXPORT Standard_Boolean PequalVPonR(const gp_Pnt&           P3D,
0276                                                const Standard_Integer  VPshapeindex,
0277                                                TopOpeBRep_VPointInter& VP,
0278                                                TopOpeBRep_LineInter&   Lrest) const;
0279 
0280   //! Classifies (VPf, VPl) middle point on restriction edge
0281   Standard_EXPORT TopAbs_State StBipVPonF(const TopOpeBRep_VPointInter& IVPf,
0282                                           const TopOpeBRep_VPointInter& IVPl,
0283                                           const TopOpeBRep_LineInter&   Lrest,
0284                                           const Standard_Boolean        isonedge1) const;
0285 
0286   TopoDS_Face                         myF1;
0287   TopoDS_Face                         myF2;
0288   TopAbs_Orientation                  myF1ori;
0289   TopAbs_Orientation                  myF2ori;
0290   TopOpeBRep_PFacesIntersector        myFacesIntersector;
0291   Handle(TopOpeBRepDS_HDataStructure) myHDS;
0292   TopOpeBRepDS_PDataStructure         myDS;
0293   Standard_Integer                    myFFfirstDSP;
0294   TopOpeBRep_PLineInter               myLine;
0295   Standard_Boolean                    myLineOK;
0296   Standard_Boolean                    myLineINL;
0297   TopOpeBRepDS_Transition             myLineTonF1;
0298   TopOpeBRepDS_Transition             myLineTonF2;
0299   Standard_Boolean                    myLineIsonEdge;
0300   TopTools_ListOfShape                myERL;
0301   TopTools_DataMapOfShapeListOfShape  myDataforDegenEd;
0302   Standard_Boolean                    myLastVPison0;
0303   Standard_Integer                    mykeptVPnbr;
0304   Standard_Integer                    myDSCIndex;
0305   TopOpeBRepDS_ListOfInterference     myDSCIL;
0306   TopOpeBRep_PointClassifier          myPointClassifier;
0307   TopOpeBRepTool_PShapeClassifier     myPShapeClassifier;
0308   Standard_Integer                    myexF1;
0309   Standard_Integer                    myexF2;
0310   Handle(TopOpeBRep_FFDumper)         myHFFD;
0311 };
0312 
0313 #endif // _TopOpeBRep_FacesFiller_HeaderFile