1 // Created on: 1993-01-11
2 // Created by: Christophe MARION
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _HLRBRep_Data_HeaderFile
18 #define _HLRBRep_Data_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Integer.hxx>
24 #include <TopTools_IndexedMapOfShape.hxx>
25 #include <HLRBRep_Array1OfEData.hxx>
26 #include <HLRBRep_Array1OfFData.hxx>
27 #include <TColStd_Array1OfInteger.hxx>
28 #include <Standard_ShortReal.hxx>
29 #include <HLRAlgo_Projector.hxx>
30 #include <HLRBRep_CLProps.hxx>
31 #include <HLRBRep_SLProps.hxx>
32 #include <Standard_Real.hxx>
33 #include <HLRBRep_FaceIterator.hxx>
34 #include <Standard_Address.hxx>
35 #include <GeomAbs_SurfaceType.hxx>
36 #include <Standard_Boolean.hxx>
37 #include <GeomAbs_CurveType.hxx>
38 #include <TopAbs_Orientation.hxx>
39 #include <HLRBRep_Intersector.hxx>
40 #include <HLRAlgo_Interference.hxx>
41 #include <MMgt_TShared.hxx>
42 #include <BRepTopAdaptor_MapOfShapeTool.hxx>
43 #include <TopAbs_State.hxx>
44 #include <HLRAlgo_InterferenceList.hxx>
45 class BRepTopAdaptor_TopolTool;
46 class StdFail_UndefinedDerivative;
47 class HLRAlgo_Projector;
48 class HLRAlgo_Interference;
50 class HLRBRep_EdgeData;
51 class HLRBRep_FaceData;
52 class IntRes2d_IntersectionPoint;
56 DEFINE_STANDARD_HANDLE(HLRBRep_Data, MMgt_TShared)
59 class HLRBRep_Data : public MMgt_TShared
65 //! Create an empty data structure of <NV> vertices,
66 //! <NE> edges and <NF> faces.
67 Standard_EXPORT HLRBRep_Data(const Standard_Integer NV, const Standard_Integer NE, const Standard_Integer NF);
69 //! Write <DS> in me with a translation of
71 Standard_EXPORT void Write (const Handle(HLRBRep_Data)& DS, const Standard_Integer dv, const Standard_Integer de, const Standard_Integer df);
73 HLRBRep_Array1OfEData& EDataArray();
75 HLRBRep_Array1OfFData& FDataArray();
77 //! Set the tolerance for the rejections during the
79 void Tolerance (const Standard_ShortReal tol);
81 //! returns the tolerance for the rejections during
83 Standard_ShortReal Tolerance() const;
85 //! end of building of the Data and updating
86 //! all the informations linked to the projection.
87 Standard_EXPORT void Update (const HLRAlgo_Projector& P);
89 HLRAlgo_Projector& Projector();
91 Standard_Integer NbVertices() const;
93 Standard_Integer NbEdges() const;
95 Standard_Integer NbFaces() const;
97 TopTools_IndexedMapOfShape& EdgeMap();
99 TopTools_IndexedMapOfShape& FaceMap();
101 //! to compare with only non rejected edges.
102 Standard_EXPORT void InitBoundSort (const Standard_Address MinMaxTot, const Standard_Integer e1, const Standard_Integer e2);
104 //! Begin an iteration only on visible Edges
105 //! crossing the face number <FI>.
106 Standard_EXPORT void InitEdge (const Standard_Integer FI, BRepTopAdaptor_MapOfShapeTool& MST);
108 Standard_EXPORT Standard_Boolean MoreEdge();
110 Standard_EXPORT void NextEdge (const Standard_Boolean skip = Standard_True);
112 //! Returns the current Edge
113 Standard_EXPORT Standard_Integer Edge() const;
115 //! Returns true if the current edge to be hidden
116 //! belongs to the hiding face.
117 Standard_Boolean HidingTheFace() const;
119 //! Returns true if the current hiding face is not an
120 //! auto-intersected one.
121 Standard_Boolean SimpleHidingFace() const;
123 //! Intersect the current Edge with the boundary of
124 //! the hiding face. The interferences are given by
125 //! the More, Next, and Value methods.
126 Standard_EXPORT void InitInterference();
128 Standard_Boolean MoreInterference() const;
130 Standard_EXPORT void NextInterference();
132 //! Returns True if the interference is rejected.
133 Standard_EXPORT Standard_Boolean RejectedInterference();
135 //! Returns True if the rejected interference is above
137 Standard_EXPORT Standard_Boolean AboveInterference();
139 HLRAlgo_Interference& Interference();
141 //! Returns the local description of the projection of
142 //! the current LEdge at parameter <Param>.
143 Standard_EXPORT void LocalLEGeometry2D (const Standard_Real Param, gp_Dir2d& Tg, gp_Dir2d& Nm, Standard_Real& Cu);
145 //! Returns the local description of the projection of
146 //! the current FEdge at parameter <Param>.
147 Standard_EXPORT void LocalFEGeometry2D (const Standard_Integer FE, const Standard_Real Param, gp_Dir2d& Tg, gp_Dir2d& Nm, Standard_Real& Cu);
149 //! Returns the local 3D state of the intersection
150 //! between the current edge and the current face at the
151 //! <p1> and <p2> parameters.
152 Standard_EXPORT void EdgeState (const Standard_Real p1, const Standard_Real p2, TopAbs_State& stbef, TopAbs_State& staf);
154 //! Returns the true if the Edge <ED> belongs to the
156 Standard_Boolean EdgeOfTheHidingFace (const Standard_Integer E, const HLRBRep_EdgeData& ED) const;
158 //! Returns the number of levels of hiding face above
159 //! the first point of the edge <ED>. The
160 //! InterferenceList is given to compute far away of
161 //! the Interferences and then come back.
162 Standard_EXPORT Standard_Integer HidingStartLevel (const Standard_Integer E, const HLRBRep_EdgeData& ED, const HLRAlgo_InterferenceList& IL);
164 //! Returns the state of the Edge <ED> after
166 Standard_EXPORT TopAbs_State Compare (const Standard_Integer E, const HLRBRep_EdgeData& ED);
168 //! Simple classification of part of edge [p1, p2]
169 //! returns OUT if at least 1 of Nbp points of edge is out
170 //! othewise returns IN
171 //! It is used to check "suspision" hided part of edge.
172 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);
174 //! Classification of an edge.
175 Standard_EXPORT TopAbs_State Classify (const Standard_Integer E, const HLRBRep_EdgeData& ED, const Standard_Boolean LevelFlag, Standard_Integer& Level, const Standard_Real param);
177 Standard_EXPORT void Destroy();
185 DEFINE_STANDARD_RTTIEXT(HLRBRep_Data,MMgt_TShared)
195 //! Orient the OutLines ( left must be inside in
196 //! projection ). Returns True if the face of a closed
197 //! shell has been inverted;
198 Standard_EXPORT Standard_Boolean OrientOutLine (const Standard_Integer I, HLRBRep_FaceData& FD);
200 //! Orient the Edges which are not Internal OutLine,
201 //! not Double and not IsoLine.
202 Standard_EXPORT void OrientOthEdge (const Standard_Integer I, HLRBRep_FaceData& FD);
204 //! Returns True if the intersection is rejected.
205 Standard_EXPORT Standard_Boolean RejectedPoint (const IntRes2d_IntersectionPoint& PInter, const TopAbs_Orientation BoundOri, const Standard_Integer NumSeg);
207 //! returns True if there is a common vertex between
208 //! myLE and myFE dependig on <head1> and <head2>.
209 Standard_EXPORT Standard_Boolean SameVertex (const Standard_Boolean head1, const Standard_Boolean head2);
211 Standard_Integer myNbVertices;
212 Standard_Integer myNbEdges;
213 Standard_Integer myNbFaces;
214 TopTools_IndexedMapOfShape myEMap;
215 TopTools_IndexedMapOfShape myFMap;
216 HLRBRep_Array1OfEData myEData;
217 HLRBRep_Array1OfFData myFData;
218 TColStd_Array1OfInteger myEdgeIndices;
219 Standard_ShortReal myToler;
220 HLRAlgo_Projector myProj;
221 HLRBRep_CLProps myLLProps;
222 HLRBRep_CLProps myFLProps;
223 HLRBRep_SLProps mySLProps;
224 Standard_Real myBigSize;
225 HLRBRep_FaceIterator myFaceItr1;
226 HLRBRep_FaceIterator myFaceItr2;
227 Standard_Integer iFace;
228 Standard_Address iFaceData;
229 Standard_Address iFaceGeom;
230 Standard_Address iFaceMinMax;
231 GeomAbs_SurfaceType iFaceType;
232 Standard_Boolean iFaceBack;
233 Standard_Boolean iFaceSimp;
234 Standard_Boolean iFaceSmpl;
235 Standard_Boolean iFaceTest;
236 Standard_Integer myHideCount;
237 Standard_Real myDeca[16];
238 Standard_Real mySurD[16];
239 Standard_Integer myCurSortEd;
240 Standard_Integer myNbrSortEd;
241 Standard_Integer myLE;
242 Standard_Boolean myLEOutLine;
243 Standard_Boolean myLEInternal;
244 Standard_Boolean myLEDouble;
245 Standard_Boolean myLEIsoLine;
246 Standard_Address myLEData;
247 Standard_Address myLEGeom;
248 Standard_Address myLEMinMax;
249 GeomAbs_CurveType myLEType;
250 Standard_ShortReal myLETol;
251 Standard_Integer myFE;
252 TopAbs_Orientation myFEOri;
253 Standard_Boolean myFEOutLine;
254 Standard_Boolean myFEInternal;
255 Standard_Boolean myFEDouble;
256 Standard_Address myFEData;
257 Standard_Address myFEGeom;
258 GeomAbs_CurveType myFEType;
259 Standard_ShortReal myFETol;
260 HLRBRep_Intersector myIntersector;
261 Handle(BRepTopAdaptor_TopolTool) myClassifier;
262 Standard_Boolean mySameVertex;
263 Standard_Boolean myIntersected;
264 Standard_Integer myNbPoints;
265 Standard_Integer myNbSegments;
266 Standard_Integer iInterf;
267 HLRAlgo_Interference myIntf;
268 Standard_Boolean myAboveIntf;
269 Standard_Address myReject;
275 #include <HLRBRep_Data.lxx>
281 #endif // _HLRBRep_Data_HeaderFile