0026431: Can't cut a sphere from a cylinder
[occt.git] / src / IntPatch / IntPatch_Intersection.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-01-21
2// Created by: Jacques GOUSSARD
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _IntPatch_Intersection_HeaderFile
18#define _IntPatch_Intersection_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25#include <IntPatch_SequenceOfPoint.hxx>
26#include <IntPatch_SequenceOfLine.hxx>
27#include <Standard_Real.hxx>
28#include <IntSurf_ListOfPntOn2S.hxx>
29#include <GeomAbs_SurfaceType.hxx>
30#include <Standard_Integer.hxx>
31class StdFail_NotDone;
32class Standard_OutOfRange;
33class Standard_DomainError;
34class Standard_ConstructionError;
35class Adaptor3d_HSurface;
36class Adaptor3d_TopolTool;
37class IntPatch_Point;
38class IntPatch_Line;
39
40
41//! This class provides a generic algorithm to intersect
42//! 2 surfaces.
43class IntPatch_Intersection
44{
45public:
46
47 DEFINE_STANDARD_ALLOC
48
49
50 Standard_EXPORT IntPatch_Intersection();
51
52 Standard_EXPORT IntPatch_Intersection(const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang);
53
54 Standard_EXPORT IntPatch_Intersection(const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Standard_Real TolArc, const Standard_Real TolTang);
55
56 //! Set the tolerances used by the algorithms:
57 //! --- Implicit - Parametric
58 //! --- Parametric - Parametric
59 //! --- Implicit - Implicit
60 //!
61 //! TolArc is used to compute the intersections
62 //! between the restrictions of a surface and a
63 //! walking line.
64 //!
65 //! TolTang is used to compute the points on a walking
66 //! line, and in geometric algorithms.
67 //!
68 //! Fleche is a parameter used in the walking
69 //! algorithms to provide small curvatures on a line.
70 //!
71 //! UVMaxStep is a parameter used in the walking
72 //! algorithms to compute the distance between to
73 //! points in their respective parametrtic spaces.
74 Standard_EXPORT void SetTolerances (const Standard_Real TolArc, const Standard_Real TolTang, const Standard_Real UVMaxStep, const Standard_Real Fleche);
75
76 //! Flag theIsReqToKeepRLine has been enterred only for
77 //! compatibility with TopOpeBRep package. It shall be deleted
78 //! after deleting TopOpeBRep.
79 //! When intersection result returns IntPatch_RLine and another
80 //! IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
81 //! will always keep both lines even if they are coincided.
4e14c88f 82 //! Flag theIsReqToPostWLProc has been enterred only for
83 //! compatibility with TopOpeBRep package. It shall be deleted
84 //! after deleting TopOpeBRep.
85 //! If theIsReqToPostWLProc == FALSE, then we will work with Walking-line
86 //! obtained after intersection algorithm directly (wothout any post-processing).
87 Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, const Standard_Boolean isGeomInt = Standard_True, const Standard_Boolean theIsReqToKeepRLine = Standard_False, const Standard_Boolean theIsReqToPostWLProc = Standard_True);
42cf5bc1 88
89 //! If isGeomInt == Standard_False, then method
90 //! Param-Param intersection will be used.
4e14c88f 91 //! Flag theIsReqToKeepRLine has been enterred only for
92 //! compatibility with TopOpeBRep package. It shall be deleted
93 //! after deleting TopOpeBRep.
94 //! When intersection result returns IntPatch_RLine and another
95 //! IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
96 //! will always keep both lines even if they are coincided.
97 //! Flag theIsReqToPostWLProc has been enterred only for
98 //! compatibility with TopOpeBRep package. It shall be deleted
99 //! after deleting TopOpeBRep.
100 //! If theIsReqToPostWLProc == FALSE, then we will work with Walking-line
101 //! obtained after intersection algorithm directly (wothout any post-processing).
102 Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, IntSurf_ListOfPntOn2S& LOfPnts, const Standard_Boolean RestrictLine = Standard_True, const Standard_Boolean isGeomInt = Standard_True, const Standard_Boolean theIsReqToKeepRLine = Standard_False, const Standard_Boolean theIsReqToPostWLProc = Standard_True);
42cf5bc1 103
4e14c88f 104 //! Perform with start point
42cf5bc1 105 Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, const Standard_Real TolArc, const Standard_Real TolTang);
106
4e14c88f 107 //! Uses for finding self-intersected surfaces.
42cf5bc1 108 Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Standard_Real TolArc, const Standard_Real TolTang);
109
110 //! Returns True if the calculus was succesfull.
111 Standard_Boolean IsDone() const;
112
113 //! Returns true if the is no intersection.
114 Standard_Boolean IsEmpty() const;
115
116 //! Returns True if the two patches are considered as
117 //! entierly tangent, i-e every restriction arc of one
118 //! patch is inside the geometric base of the other patch.
119 Standard_Boolean TangentFaces() const;
120
121 //! Returns True when the TangentFaces returns True and the
122 //! normal vectors evaluated at a point on the first and the
123 //! second surface are opposite.
124 //! The exception DomainError is raised if TangentFaces
125 //! returns False.
126 Standard_Boolean OppositeFaces() const;
127
128 //! Returns the number of "single" points.
129 Standard_Integer NbPnts() const;
130
131 //! Returns the point of range Index.
132 //! An exception is raised if Index<=0 or Index>NbPnt.
133 const IntPatch_Point& Point (const Standard_Integer Index) const;
134
135 //! Returns the number of intersection lines.
136 Standard_Integer NbLines() const;
137
138 //! Returns the line of range Index.
139 //! An exception is raised if Index<=0 or Index>NbLine.
140 const Handle(IntPatch_Line)& Line (const Standard_Integer Index) const;
141
142 Standard_EXPORT const IntPatch_SequenceOfLine& SequenceOfLine() const;
143
144 //! Dump of each result line.
145 //! Mode for more accurate dumps.
146 Standard_EXPORT void Dump (const Standard_Integer Mode, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2) const;
147
148
149
150
151protected:
152
153
154
155
156
157private:
158
159
160 Standard_EXPORT void ParamParamPerfom (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, IntSurf_ListOfPntOn2S& LOfPnts, const Standard_Boolean RestrictLine, const GeomAbs_SurfaceType typs1, const GeomAbs_SurfaceType typs2);
161
162 //! Flag theIsReqToKeepRLine has been enterred only for
163 //! compatibility with TopOpeBRep package. It shall be deleted
164 //! after deleting TopOpeBRep.
165 //! When intersection result returns IntPatch_RLine and another
166 //! IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
167 //! will always keep both lines even if they are coincided.
168 Standard_EXPORT void GeomGeomPerfom (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, IntSurf_ListOfPntOn2S& LOfPnts, const Standard_Boolean RestrictLine, const GeomAbs_SurfaceType typs1, const GeomAbs_SurfaceType typs2, const Standard_Boolean theIsReqToKeepRLine = Standard_False);
169
170 //! Flag theIsReqToKeepRLine has been enterred only for
171 //! compatibility with TopOpeBRep package. It shall be deleted
172 //! after deleting TopOpeBRep.
173 //! When intersection result returns IntPatch_RLine and another
174 //! IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
175 //! will always keep both lines even if they are coincided.
176 Standard_EXPORT void GeomGeomPerfomTrimSurf (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, IntSurf_ListOfPntOn2S& LOfPnts, const Standard_Boolean RestrictLine, const GeomAbs_SurfaceType typs1, const GeomAbs_SurfaceType typs2, const Standard_Boolean theIsReqToKeepRLine = Standard_False);
177
178 Standard_EXPORT void GeomParamPerfom (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Boolean isNotAnalitical, const GeomAbs_SurfaceType typs1, const GeomAbs_SurfaceType typs2);
179
180
181 Standard_Boolean done;
182 Standard_Boolean empt;
183 Standard_Boolean tgte;
184 Standard_Boolean oppo;
185 IntPatch_SequenceOfPoint spnt;
186 IntPatch_SequenceOfLine slin;
187 Standard_Real myTolArc;
188 Standard_Real myTolTang;
189 Standard_Real myUVMaxStep;
190 Standard_Real myFleche;
191 Standard_Boolean myIsStartPnt;
192 Standard_Real myU1Start;
193 Standard_Real myV1Start;
194 Standard_Real myU2Start;
195 Standard_Real myV2Start;
196
197
198};
199
200
201#include <IntPatch_Intersection.lxx>
202
203
204
205
206
207#endif // _IntPatch_Intersection_HeaderFile