Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:47:04

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