0026738: Make Boolean operations safely treating arguments when running with fuzzy...
[occt.git] / src / IntTools / IntTools_FaceFace.hxx
CommitLineData
42cf5bc1 1// Created on: 2000-11-23
2// Created by: Michael KLOKOV
3// Copyright (c) 2000-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _IntTools_FaceFace_HeaderFile
17#define _IntTools_FaceFace_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_DefineAlloc.hxx>
21#include <Standard_Handle.hxx>
22
23#include <Standard_Boolean.hxx>
24#include <IntPatch_Intersection.hxx>
25#include <GeomInt_LineConstructor.hxx>
26#include <Standard_Integer.hxx>
27#include <Standard_Real.hxx>
28#include <IntTools_SequenceOfCurves.hxx>
29#include <TopoDS_Face.hxx>
30#include <IntTools_SequenceOfPntOn2Faces.hxx>
31#include <IntSurf_ListOfPntOn2S.hxx>
32class GeomAdaptor_HSurface;
33class IntTools_Context;
34class StdFail_NotDone;
35class TopoDS_Face;
36class Adaptor3d_TopolTool;
37
38
39//! This class provides the intersection of
40//! face's underlying surfaces.
41class IntTools_FaceFace
42{
43public:
44
45 DEFINE_STANDARD_ALLOC
46
47
48
49 //! Empty constructor.
50 Standard_EXPORT IntTools_FaceFace();
51
52
53 //! Modifier
54 Standard_EXPORT void SetParameters (const Standard_Boolean ApproxCurves, const Standard_Boolean ComputeCurveOnS1, const Standard_Boolean ComputeCurveOnS2, const Standard_Real ApproximationTolerance);
55
56
57 //! Intersects underliing surfaces of F1 and F2
58 //! Use sum of tolerance of F1 and F2 as intersection
59 //! criteria
60 Standard_EXPORT void Perform (const TopoDS_Face& F1, const TopoDS_Face& F2);
61
62
63 //! Returns True if the intersection was successful
64 Standard_EXPORT Standard_Boolean IsDone() const;
65
66
67 //! Returns sequence of 3d curves as result of intersection
68 Standard_EXPORT const IntTools_SequenceOfCurves& Lines() const;
69
70
71 //! Returns sequence of 3d curves as result of intersection
72 Standard_EXPORT const IntTools_SequenceOfPntOn2Faces& Points() const;
73
74
3510db62 75 //! Returns tolerance reached during approximation,
76 //! and possibly increased to cover more area due to a small angle between surfaces.
42cf5bc1 77 //! If approximation was not done, returns zero.
78 Standard_EXPORT Standard_Real TolReached3d() const;
3510db62 79
80 //! Returns tolerance reached during approximation, without any increase.
81 //! If approximation was not done, returns zero.
82 Standard_EXPORT Standard_Real TolReal() const;
42cf5bc1 83
84 //! Returns tolerance reached during approximation.
85 //! If approximation was not done, returns zero.
86 Standard_EXPORT Standard_Real TolReached2d() const;
87
88
89 //! Returns first of processed faces
90 Standard_EXPORT const TopoDS_Face& Face1() const;
91
92
93 //! Returns second of processed faces
94 Standard_EXPORT const TopoDS_Face& Face2() const;
95
96
97 //! Returns True if faces are tangent
98 Standard_EXPORT Standard_Boolean TangentFaces() const;
3510db62 99
42cf5bc1 100
101 //! Provides post-processing the result lines.
102 //! <bToSplit> - the flag.
103 //! In case of <bToSplit> is true the closed 3D-curves will be splitted
104 //! on parts.
105 //! In case of <bToSplit> is false the closed 3D-curves remain untouched.
106 Standard_EXPORT void PrepareLines3D (const Standard_Boolean bToSplit = Standard_True);
107
108 Standard_EXPORT void SetList (IntSurf_ListOfPntOn2S& ListOfPnts);
109
110
111 //! Sets the intersecton context
112 Standard_EXPORT void SetContext (const Handle(IntTools_Context)& aContext);
0d0481c7 113
114 //! Sets the Fuzzy value
115 void SetFuzzyValue (const Standard_Real theFuzz);
116
42cf5bc1 117
0d0481c7 118 //! Returns Fuzzy value
119 Standard_Real FuzzyValue() const;
42cf5bc1 120
121 //! Gets the intersecton context
122 Standard_EXPORT const Handle(IntTools_Context)& Context() const;
123
124
125
126
127protected:
128
129
71958f7d 130 Standard_EXPORT void MakeCurve (const Standard_Integer Index,
131 const Handle(Adaptor3d_TopolTool)& D1,
132 const Handle(Adaptor3d_TopolTool)& D2,
133 const Standard_Real theToler);
42cf5bc1 134
135 Standard_EXPORT void ComputeTolReached3d();
136
137 Standard_EXPORT Standard_Real ComputeTolerance();
138
139
140
141
142private:
143
144
145
146 Standard_Boolean myIsDone;
147 IntPatch_Intersection myIntersector;
148 GeomInt_LineConstructor myLConstruct;
149 Handle(GeomAdaptor_HSurface) myHS1;
150 Handle(GeomAdaptor_HSurface) myHS2;
151 Standard_Integer myNbrestr;
152 Standard_Real myTolReached2d;
153 Standard_Real myTolReached3d;
3510db62 154 Standard_Real myTolReal;
42cf5bc1 155 Standard_Boolean myApprox;
156 Standard_Boolean myApprox1;
157 Standard_Boolean myApprox2;
158 Standard_Real myTolApprox;
0d0481c7 159 Standard_Real myTolF1;
160 Standard_Real myTolF2;
161 Standard_Real myTol;
162 Standard_Real myFuzzyValue;
42cf5bc1 163 IntTools_SequenceOfCurves mySeqOfCurve;
164 Standard_Boolean myTangentFaces;
165 TopoDS_Face myFace1;
166 TopoDS_Face myFace2;
167 IntTools_SequenceOfPntOn2Faces myPnts;
168 IntSurf_ListOfPntOn2S myListOfPnts;
169 Handle(IntTools_Context) myContext;
170
171
172};
173
174
175
176
177
178
179
180#endif // _IntTools_FaceFace_HeaderFile