0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / IntTools / IntTools_FaceFace.hxx
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>
32 class GeomAdaptor_HSurface;
33 class IntTools_Context;
34 class StdFail_NotDone;
35 class TopoDS_Face;
36 class Adaptor3d_TopolTool;
37
38
39 //! This class provides the intersection of
40 //! face's underlying surfaces.
41 class IntTools_FaceFace 
42 {
43 public:
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   //! Returns first of processed faces
75   Standard_EXPORT const TopoDS_Face& Face1() const;
76   
77
78   //! Returns second of processed faces
79   Standard_EXPORT const TopoDS_Face& Face2() const;
80   
81
82   //! Returns True if faces are tangent
83   Standard_EXPORT Standard_Boolean TangentFaces() const;
84
85
86   //! Provides post-processing the result lines.
87   //! <bToSplit> - the flag.
88   //! In case of <bToSplit> is true the closed 3D-curves will be splitted
89   //! on parts.
90   //! In case of <bToSplit> is false the closed 3D-curves remain untouched.
91   Standard_EXPORT void PrepareLines3D (const Standard_Boolean bToSplit = Standard_True);
92   
93   Standard_EXPORT void SetList (IntSurf_ListOfPntOn2S& ListOfPnts);
94   
95
96   //! Sets the intersecton context
97   Standard_EXPORT void SetContext (const Handle(IntTools_Context)& aContext);
98
99   //! Sets the Fuzzy value
100   Standard_EXPORT void SetFuzzyValue (const Standard_Real theFuzz);
101
102   
103   //! Returns Fuzzy value
104   Standard_EXPORT Standard_Real FuzzyValue() const;
105
106   //! Gets the intersecton context
107   Standard_EXPORT const Handle(IntTools_Context)& Context() const;
108
109 protected:
110
111   //! Creates curves from the IntPatch_Line.
112   Standard_EXPORT void MakeCurve (const Standard_Integer Index,
113                                   const Handle(Adaptor3d_TopolTool)& D1,
114                                   const Handle(Adaptor3d_TopolTool)& D2,
115                                   const Standard_Real theToler);
116
117   //! Computes the valid tolerance for the intersection curves
118   //! as a maximal deviation between 3D curve and 2D curves on faces.<br>
119   //! If there are no 2D curves the maximal deviation between 3D curves
120   //! and surfaces is computed.
121   Standard_EXPORT void ComputeTolReached3d();
122
123 protected:
124
125   Standard_Boolean myIsDone;
126   IntPatch_Intersection myIntersector;
127   GeomInt_LineConstructor myLConstruct;
128   Handle(GeomAdaptor_HSurface) myHS1;
129   Handle(GeomAdaptor_HSurface) myHS2;
130   Standard_Integer myNbrestr;
131   Standard_Boolean myApprox;
132   Standard_Boolean myApprox1;
133   Standard_Boolean myApprox2;
134   Standard_Real myTolApprox;
135   Standard_Real myTolF1;
136   Standard_Real myTolF2;
137   Standard_Real myTol;
138   Standard_Real myFuzzyValue;
139   IntTools_SequenceOfCurves mySeqOfCurve;
140   Standard_Boolean myTangentFaces;
141   TopoDS_Face myFace1;
142   TopoDS_Face myFace2;
143   IntTools_SequenceOfPntOn2Faces myPnts;
144   IntSurf_ListOfPntOn2S myListOfPnts;
145   Handle(IntTools_Context) myContext;
146
147 };
148
149 #endif // _IntTools_FaceFace_HeaderFile