1 // Created on: 1994-10-13
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1994-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 _TopOpeBRep_EdgesIntersector_HeaderFile
18 #define _TopOpeBRep_EdgesIntersector_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <TopoDS_Face.hxx>
25 #include <GeomAbs_SurfaceType.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <IntRes2d_Domain.hxx>
28 #include <TopoDS_Edge.hxx>
29 #include <Geom2dAdaptor_Curve.hxx>
30 #include <Standard_Real.hxx>
31 #include <Geom2dInt_GInter.hxx>
32 #include <IntRes2d_SequenceOfIntersectionPoint.hxx>
33 #include <IntRes2d_SequenceOfIntersectionSegment.hxx>
34 #include <Standard_Integer.hxx>
35 #include <TopoDS_Vertex.hxx>
36 #include <TopOpeBRep_SequenceOfPoint2d.hxx>
37 #include <TopOpeBRep_P2Dstatus.hxx>
38 #include <TopAbs_Orientation.hxx>
39 #include <TopOpeBRepDS_Config.hxx>
40 class BRepAdaptor_HSurface;
43 class Geom2dAdaptor_Curve;
44 class BRepAdaptor_Surface;
45 class TCollection_AsciiString;
46 class TopOpeBRep_Point2d;
47 class IntRes2d_IntersectionSegment;
48 class IntRes2d_IntersectionPoint;
49 class TopOpeBRepDS_Transition;
53 //! Describes the intersection of two edges on the same surface
54 class TopOpeBRep_EdgesIntersector
61 Standard_EXPORT TopOpeBRep_EdgesIntersector();
63 Standard_EXPORT virtual ~TopOpeBRep_EdgesIntersector();
65 Standard_EXPORT void SetFaces (const TopoDS_Shape& F1, const TopoDS_Shape& F2);
67 Standard_EXPORT void SetFaces (const TopoDS_Shape& F1, const TopoDS_Shape& F2, const Bnd_Box& B1, const Bnd_Box& B2);
69 Standard_EXPORT void ForceTolerances (const Standard_Real Tol1, const Standard_Real Tol2);
71 Standard_EXPORT void Dimension (const Standard_Integer D);
73 //! set working space dimension D = 1 for E &|| W, 2 for E in F
74 Standard_EXPORT Standard_Integer Dimension() const;
76 Standard_EXPORT void Perform (const TopoDS_Shape& E1, const TopoDS_Shape& E2, const Standard_Boolean ReduceSegments = Standard_True);
78 Standard_EXPORT Standard_Boolean IsEmpty();
80 //! true if at least one intersection segment.
81 Standard_EXPORT Standard_Boolean HasSegment() const;
84 Standard_EXPORT Standard_Boolean SameDomain() const;
86 Standard_EXPORT const TopoDS_Shape& Edge (const Standard_Integer Index) const;
88 Standard_EXPORT const Geom2dAdaptor_Curve& Curve (const Standard_Integer Index) const;
90 Standard_EXPORT const TopoDS_Shape& Face (const Standard_Integer Index) const;
92 Standard_EXPORT const BRepAdaptor_Surface& Surface (const Standard_Integer Index) const;
94 Standard_EXPORT Standard_Boolean SurfacesSameOriented() const;
96 Standard_EXPORT Standard_Boolean FacesSameOriented() const;
98 Standard_EXPORT Standard_Real ToleranceMax() const;
100 Standard_EXPORT void Tolerances (Standard_Real& tol1, Standard_Real& tol2) const;
102 Standard_EXPORT Standard_Integer NbPoints() const;
104 Standard_EXPORT Standard_Integer NbSegments() const;
106 Standard_EXPORT void Dump (const TCollection_AsciiString& str, const Standard_Integer ie1 = 0, const Standard_Integer ie2 = 0);
108 Standard_EXPORT void InitPoint (const Standard_Boolean selectkeep = Standard_True);
110 Standard_EXPORT Standard_Boolean MorePoint() const;
112 Standard_EXPORT void NextPoint();
114 Standard_EXPORT const TopOpeBRep_SequenceOfPoint2d& Points() const;
116 Standard_EXPORT const TopOpeBRep_Point2d& Point() const;
118 Standard_EXPORT const TopOpeBRep_Point2d& Point (const Standard_Integer I) const;
120 Standard_EXPORT virtual Standard_Boolean ReduceSegment (TopOpeBRep_Point2d& P1, TopOpeBRep_Point2d& P2, TopOpeBRep_Point2d& Pn) const;
122 Standard_EXPORT TopOpeBRep_P2Dstatus Status1() const;
136 Standard_EXPORT void Find();
138 //! process if current edges can be considered as SameDomain
139 Standard_EXPORT Standard_Boolean ComputeSameDomain();
141 //! set field mySameDomain to B and return B value
142 Standard_EXPORT Standard_Boolean SetSameDomain (const Standard_Boolean B);
144 Standard_EXPORT void MakePoints2d();
146 Standard_EXPORT void ReduceSegments();
148 Standard_EXPORT const IntRes2d_IntersectionSegment& Segment1() const;
150 Standard_EXPORT Standard_Boolean IsOpposite1() const;
152 Standard_EXPORT void InitPoint1();
154 Standard_EXPORT Standard_Boolean MorePoint1() const;
156 Standard_EXPORT void NextPoint1();
158 Standard_EXPORT const IntRes2d_IntersectionPoint& Point1() const;
160 Standard_EXPORT TopOpeBRepDS_Transition Transition1 (const Standard_Integer Index, const TopAbs_Orientation EO) const;
162 Standard_EXPORT Standard_Real Parameter1 (const Standard_Integer Index) const;
164 Standard_EXPORT Standard_Boolean IsVertex1 (const Standard_Integer Index);
166 Standard_EXPORT const TopoDS_Shape& Vertex1 (const Standard_Integer Index);
168 Standard_EXPORT gp_Pnt Value1() const;
170 Standard_EXPORT Standard_Boolean IsPointOfSegment1() const;
172 Standard_EXPORT Standard_Integer Index1() const;
174 //! geometric configuration of E1,E2 at current intersection point :
175 //! UNSHGEOMETRY if the edges do not share geometry.
176 //! SAMEORIENTED if the edges share geometry and are same oriented.
177 //! DIFFORIENTED if the edges share geometry and are not same oriented.
178 Standard_EXPORT TopOpeBRepDS_Config EdgesConfig1() const;
183 Handle(BRepAdaptor_HSurface) mySurface1;
184 Handle(BRepAdaptor_HSurface) mySurface2;
185 GeomAbs_SurfaceType mySurfaceType1;
186 GeomAbs_SurfaceType mySurfaceType2;
187 Standard_Boolean mySurfacesSameOriented;
188 Standard_Boolean myFacesSameOriented;
189 IntRes2d_Domain myDomain1;
190 IntRes2d_Domain myDomain2;
193 Geom2dAdaptor_Curve myCurve1;
194 Geom2dAdaptor_Curve myCurve2;
195 Standard_Real myTol1;
196 Standard_Real myTol2;
197 Standard_Boolean myTolForced;
198 Geom2dInt_GInter myIntersector;
199 IntRes2d_SequenceOfIntersectionPoint mylpnt;
200 IntRes2d_SequenceOfIntersectionSegment mylseg;
201 Standard_Integer myNbPoints;
202 Standard_Integer myNbSegments;
203 Standard_Integer myTrueNbPoints;
204 Standard_Integer myPointIndex;
205 Standard_Integer myIsVertexPointIndex;
206 Standard_Integer myIsVertexIndex;
207 Standard_Boolean myIsVertexValue;
208 TopoDS_Vertex myIsVertexVertex;
209 Standard_Integer myDimension;
210 Standard_Boolean myHasSegment;
211 Standard_Boolean mySameDomain;
212 Standard_Boolean myf1surf1F_sameoriented;
213 Standard_Boolean myf2surf1F_sameoriented;
214 TopOpeBRep_SequenceOfPoint2d mysp2d;
215 Standard_Integer myip2d;
216 Standard_Integer mynp2d;
217 Standard_Boolean myselectkeep;
228 #endif // _TopOpeBRep_EdgesIntersector_HeaderFile