Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 09:00:32

0001 // Created on: 1993-01-11
0002 // Created by: Christophe MARION
0003 // Copyright (c) 1993-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 _HLRBRep_Data_HeaderFile
0018 #define _HLRBRep_Data_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <TopTools_IndexedMapOfShape.hxx>
0025 #include <HLRBRep_Array1OfEData.hxx>
0026 #include <HLRBRep_Array1OfFData.hxx>
0027 #include <TColStd_Array1OfInteger.hxx>
0028 #include <Standard_ShortReal.hxx>
0029 #include <HLRAlgo_Projector.hxx>
0030 #include <HLRBRep_CLProps.hxx>
0031 #include <HLRBRep_SLProps.hxx>
0032 #include <Standard_Real.hxx>
0033 #include <HLRBRep_FaceIterator.hxx>
0034 #include <GeomAbs_SurfaceType.hxx>
0035 #include <Standard_Boolean.hxx>
0036 #include <GeomAbs_CurveType.hxx>
0037 #include <TopAbs_Orientation.hxx>
0038 #include <HLRBRep_Intersector.hxx>
0039 #include <HLRAlgo_Interference.hxx>
0040 #include <Standard_Transient.hxx>
0041 #include <BRepTopAdaptor_MapOfShapeTool.hxx>
0042 #include <TopAbs_State.hxx>
0043 #include <HLRAlgo_InterferenceList.hxx>
0044 class BRepTopAdaptor_TopolTool;
0045 class gp_Dir2d;
0046 class HLRBRep_EdgeData;
0047 class HLRBRep_FaceData;
0048 class IntRes2d_IntersectionPoint;
0049 class TableauRejection;
0050 
0051 class HLRBRep_Data;
0052 DEFINE_STANDARD_HANDLE(HLRBRep_Data, Standard_Transient)
0053 
0054 class HLRBRep_Data : public Standard_Transient
0055 {
0056 
0057 public:
0058 
0059   
0060   //! Create an  empty data structure  of <NV> vertices,
0061   //! <NE> edges and <NF> faces.
0062   Standard_EXPORT HLRBRep_Data(const Standard_Integer NV, const Standard_Integer NE, const Standard_Integer NF);
0063   
0064   //! Write <DS>    in   me  with   a     translation of
0065   //! <dv>,<de>,<df>.
0066   Standard_EXPORT void Write (const Handle(HLRBRep_Data)& DS, const Standard_Integer dv, const Standard_Integer de, const Standard_Integer df);
0067   
0068     HLRBRep_Array1OfEData& EDataArray();
0069   
0070     HLRBRep_Array1OfFData& FDataArray();
0071   
0072   //! Set the  tolerance for the  rejections  during the
0073   //! exploration
0074     void Tolerance (const Standard_ShortReal tol);
0075   
0076   //! returns  the tolerance for the  rejections  during
0077   //! the exploration
0078     Standard_ShortReal Tolerance() const;
0079   
0080   //! end of building  of the Data and updating
0081   //! all the information linked to the projection.
0082   Standard_EXPORT void Update (const HLRAlgo_Projector& P);
0083   
0084     HLRAlgo_Projector& Projector();
0085   
0086     Standard_Integer NbVertices() const;
0087   
0088     Standard_Integer NbEdges() const;
0089   
0090     Standard_Integer NbFaces() const;
0091   
0092     TopTools_IndexedMapOfShape& EdgeMap();
0093   
0094     TopTools_IndexedMapOfShape& FaceMap();
0095   
0096   //! to compare with only non rejected edges.
0097   Standard_EXPORT void InitBoundSort (const HLRAlgo_EdgesBlock::MinMaxIndices& MinMaxTot, const Standard_Integer e1, const Standard_Integer e2);
0098   
0099   //! Begin an iteration only  on visible Edges
0100   //! crossing the face number <FI>.
0101   Standard_EXPORT void InitEdge (const Standard_Integer FI, BRepTopAdaptor_MapOfShapeTool& MST);
0102   
0103   Standard_EXPORT Standard_Boolean MoreEdge();
0104   
0105   Standard_EXPORT void NextEdge (const Standard_Boolean skip = Standard_True);
0106   
0107   //! Returns the  current Edge
0108   Standard_EXPORT Standard_Integer Edge() const;
0109   
0110   //! Returns true if   the  current edge to   be hidden
0111   //! belongs to the hiding face.
0112     Standard_Boolean HidingTheFace() const;
0113   
0114   //! Returns true if the current hiding face is not  an
0115   //! auto-intersected one.
0116     Standard_Boolean SimpleHidingFace() const;
0117   
0118   //! Intersect  the current  Edge  with the boundary of
0119   //! the hiding  face.   The interferences are given by
0120   //! the More, Next, and Value methods.
0121   Standard_EXPORT void InitInterference();
0122   
0123     Standard_Boolean MoreInterference() const;
0124   
0125   Standard_EXPORT void NextInterference();
0126   
0127   //! Returns  True if the  interference is rejected.
0128   Standard_EXPORT Standard_Boolean RejectedInterference();
0129   
0130   //! Returns True if the rejected interference is above
0131   //! the face.
0132   Standard_EXPORT Standard_Boolean AboveInterference();
0133   
0134     HLRAlgo_Interference& Interference();
0135   
0136   //! Returns the local description of the projection of
0137   //! the current LEdge  at parameter  <Param>.
0138   Standard_EXPORT void LocalLEGeometry2D (const Standard_Real Param, gp_Dir2d& Tg, gp_Dir2d& Nm, Standard_Real& Cu);
0139   
0140   //! Returns the local description of the projection of
0141   //! the current FEdge  at parameter  <Param>.
0142   Standard_EXPORT void LocalFEGeometry2D (const Standard_Integer FE, const Standard_Real Param, gp_Dir2d& Tg, gp_Dir2d& Nm, Standard_Real& Cu);
0143   
0144   //! Returns the local  3D   state of the  intersection
0145   //! between the current edge and the current face at the
0146   //! <p1> and <p2> parameters.
0147   Standard_EXPORT void EdgeState (const Standard_Real p1, const Standard_Real p2, TopAbs_State& stbef, TopAbs_State& staf);
0148   
0149   //! Returns the  true if the  Edge <ED> belongs to the
0150   //! Hiding Face.
0151     Standard_Boolean EdgeOfTheHidingFace (const Standard_Integer E, const HLRBRep_EdgeData& ED) const;
0152   
0153   //! Returns the number of  levels of hiding face above
0154   //! the   first  point  of   the    edge <ED>.     The
0155   //! InterferenceList is  given to  compute far away of
0156   //! the Interferences and then come back.
0157   Standard_EXPORT Standard_Integer HidingStartLevel (const Standard_Integer E, const HLRBRep_EdgeData& ED, const HLRAlgo_InterferenceList& IL);
0158   
0159   //! Returns   the  state   of  the   Edge  <ED>  after
0160   //! classification.
0161   Standard_EXPORT TopAbs_State Compare (const Standard_Integer E, const HLRBRep_EdgeData& ED);
0162   
0163   //! Simple classification of part of edge [p1,  p2].
0164   //! Returns OUT if at least 1 of Nbp points of edge is out; otherwise returns IN.
0165   //! It is used to check "suspicion" hidden part of edge.
0166   Standard_EXPORT TopAbs_State SimplClassify (const Standard_Integer E, const HLRBRep_EdgeData& ED, const Standard_Integer Nbp, const Standard_Real p1, const Standard_Real p2);
0167   
0168   //! Classification of an edge.
0169   Standard_EXPORT TopAbs_State Classify (const Standard_Integer E, const HLRBRep_EdgeData& ED, const Standard_Boolean LevelFlag, Standard_Integer& Level, const Standard_Real param);
0170 
0171   //! Returns true if the current face is bad.
0172   Standard_EXPORT Standard_Boolean IsBadFace() const;
0173 
0174   Standard_EXPORT void Destroy();
0175 ~HLRBRep_Data()
0176 {
0177   Destroy();
0178 }
0179 
0180   DEFINE_STANDARD_RTTIEXT(HLRBRep_Data,Standard_Transient)
0181 
0182 private:
0183 
0184   //! Orient the   OutLines  ( left  must  be  inside in
0185   //! projection ). Returns True if the face of a closed
0186   //! shell has been inverted;
0187   Standard_EXPORT Standard_Boolean OrientOutLine (const Standard_Integer I, HLRBRep_FaceData& FD);
0188   
0189   //! Orient the Edges which  are not  Internal OutLine,
0190   //! not Double and not IsoLine.
0191   Standard_EXPORT void OrientOthEdge (const Standard_Integer I, HLRBRep_FaceData& FD);
0192   
0193   //! Returns  True  if the  intersection is  rejected.
0194   Standard_EXPORT Standard_Boolean RejectedPoint (const IntRes2d_IntersectionPoint& PInter, const TopAbs_Orientation BoundOri, const Standard_Integer NumSeg);
0195   
0196   //! Returns True if there is a common vertex between myLE and myFE depending on <head1> and <head2>.
0197   Standard_EXPORT Standard_Boolean SameVertex (const Standard_Boolean head1, const Standard_Boolean head2);
0198 
0199 private:
0200 
0201   Standard_Integer myNbVertices;
0202   Standard_Integer myNbEdges;
0203   Standard_Integer myNbFaces;
0204   TopTools_IndexedMapOfShape myEMap;
0205   TopTools_IndexedMapOfShape myFMap;
0206   HLRBRep_Array1OfEData myEData;
0207   HLRBRep_Array1OfFData myFData;
0208   TColStd_Array1OfInteger myEdgeIndices;
0209   Standard_ShortReal myToler;
0210   HLRAlgo_Projector myProj;
0211   HLRBRep_CLProps myLLProps;
0212   HLRBRep_CLProps myFLProps;
0213   HLRBRep_SLProps mySLProps;
0214   Standard_Real myBigSize;
0215   HLRBRep_FaceIterator myFaceItr1;
0216   HLRBRep_FaceIterator myFaceItr2;
0217   Standard_Integer iFace;
0218   HLRBRep_FaceData* iFaceData;
0219   Standard_Address iFaceGeom;
0220   HLRAlgo_EdgesBlock::MinMaxIndices* iFaceMinMax;
0221   GeomAbs_SurfaceType iFaceType;
0222   Standard_Boolean iFaceBack;
0223   Standard_Boolean iFaceSimp;
0224   Standard_Boolean iFaceSmpl;
0225   Standard_Boolean iFaceTest;
0226   Standard_Integer myHideCount;
0227   Standard_Real myDeca[16];
0228   Standard_Real mySurD[16];
0229   Standard_Integer myCurSortEd;
0230   Standard_Integer myNbrSortEd;
0231   Standard_Integer myLE;
0232   Standard_Boolean myLEOutLine;
0233   Standard_Boolean myLEInternal;
0234   Standard_Boolean myLEDouble;
0235   Standard_Boolean myLEIsoLine;
0236   HLRBRep_EdgeData* myLEData;
0237   const HLRBRep_Curve* myLEGeom;
0238   HLRAlgo_EdgesBlock::MinMaxIndices* myLEMinMax;
0239   GeomAbs_CurveType myLEType;
0240   Standard_ShortReal myLETol;
0241   Standard_Integer myFE;
0242   TopAbs_Orientation myFEOri;
0243   Standard_Boolean myFEOutLine;
0244   Standard_Boolean myFEInternal;
0245   Standard_Boolean myFEDouble;
0246   HLRBRep_EdgeData* myFEData;
0247   HLRBRep_Curve* myFEGeom;
0248   GeomAbs_CurveType myFEType;
0249   Standard_ShortReal myFETol;
0250   HLRBRep_Intersector myIntersector;
0251   Handle(BRepTopAdaptor_TopolTool) myClassifier;
0252   Standard_Boolean mySameVertex;
0253   Standard_Boolean myIntersected;
0254   Standard_Integer myNbPoints;
0255   Standard_Integer myNbSegments;
0256   Standard_Integer iInterf;
0257   HLRAlgo_Interference myIntf;
0258   Standard_Boolean myAboveIntf;
0259   TableauRejection* myReject;
0260 
0261 };
0262 
0263 #include <HLRBRep_Data.lxx>
0264 
0265 
0266 #endif // _HLRBRep_Data_HeaderFile