0022815: Missing delete operator for placement new
[occt.git] / src / BRepExtrema / BRepExtrema_DistShapeShape.hxx
1 // File generated by CPPExt (Value)
2 //
3 //                     Copyright (C) 1991 - 2000 by  
4 //                      Matra Datavision SA.  All rights reserved.
5 //  
6 //                     Copyright (C) 2001 - 2004 by
7 //                     Open CASCADE SA.  All rights reserved.
8 // 
9 // This file is part of the Open CASCADE Technology software.
10 //
11 // This software may be distributed and/or modified under the terms and
12 // conditions of the Open CASCADE Public License as defined by Open CASCADE SA
13 // and appearing in the file LICENSE included in the packaging of this file.
14 //  
15 // This software is distributed on an "AS IS" basis, without warranty of any
16 // kind, and Open CASCADE SA hereby disclaims all such warranties,
17 // including without limitation, any warranties of merchantability, fitness
18 // for a particular purpose or non-infringement. Please see the License for
19 // the specific terms and conditions governing rights and limitations under the
20 // License.
21
22 #ifndef _BRepExtrema_DistShapeShape_HeaderFile
23 #define _BRepExtrema_DistShapeShape_HeaderFile
24
25 #ifndef _Standard_HeaderFile
26 #include <Standard.hxx>
27 #endif
28 #ifndef _Standard_DefineAlloc_HeaderFile
29 #include <Standard_DefineAlloc.hxx>
30 #endif
31 #ifndef _Standard_Macro_HeaderFile
32 #include <Standard_Macro.hxx>
33 #endif
34
35 #ifndef _Standard_Integer_HeaderFile
36 #include <Standard_Integer.hxx>
37 #endif
38 #ifndef _Standard_Real_HeaderFile
39 #include <Standard_Real.hxx>
40 #endif
41 #ifndef _Standard_Boolean_HeaderFile
42 #include <Standard_Boolean.hxx>
43 #endif
44 #ifndef _BRepExtrema_SeqOfSolution_HeaderFile
45 #include <BRepExtrema_SeqOfSolution.hxx>
46 #endif
47 #ifndef _BRepExtrema_SolutionElem_HeaderFile
48 #include <BRepExtrema_SolutionElem.hxx>
49 #endif
50 #ifndef _TopoDS_Shape_HeaderFile
51 #include <TopoDS_Shape.hxx>
52 #endif
53 #ifndef _TopTools_IndexedMapOfShape_HeaderFile
54 #include <TopTools_IndexedMapOfShape.hxx>
55 #endif
56 #ifndef _Extrema_ExtFlag_HeaderFile
57 #include <Extrema_ExtFlag.hxx>
58 #endif
59 #ifndef _Extrema_ExtAlgo_HeaderFile
60 #include <Extrema_ExtAlgo.hxx>
61 #endif
62 #ifndef _BRepExtrema_SupportType_HeaderFile
63 #include <BRepExtrema_SupportType.hxx>
64 #endif
65 #ifndef _Standard_OStream_HeaderFile
66 #include <Standard_OStream.hxx>
67 #endif
68 #ifndef _gp_Pnt_HeaderFile
69 #include <gp_Pnt.hxx>
70 #endif
71 class TopoDS_Shape;
72 class TopTools_IndexedMapOfShape;
73 class Bnd_SeqOfBox;
74
75
76 //! This class  provides tools to compute minimum distance <br>
77 //! between two Shapes (Compound,CompSolid, Solid, Shell, Face, Wire, Edge, Vertex). <br>
78 class BRepExtrema_DistShapeShape
79 {
80  public:
81
82   DEFINE_STANDARD_ALLOC
83
84   //! create empty tool <br>
85   Standard_EXPORT BRepExtrema_DistShapeShape();
86   //! computation of the minimum distance (value and pair of points) using default deflection <br>
87   //! Default value is Precision::Confusion(). <br>
88   Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
89   //! create tool and load both shapes into it <br>
90   Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
91   
92   Standard_EXPORT void SetDeflection(const Standard_Real theDeflection)
93   {
94     myEps = theDeflection;
95   }
96   //! load first shape into extrema <br>
97   Standard_EXPORT void LoadS1(const TopoDS_Shape& Shape1);
98   //! load second shape into extrema <br>
99   Standard_EXPORT void LoadS2(const TopoDS_Shape& Shape1);
100   //! computation of  the minimum  distance  (value  and <br>
101   //!          couple  of points). Parameter theDeflection is used <br>
102   //!          to specify a maximum deviation of extreme distances <br>
103   //!          from the minimum one. <br>
104   //!          Returns IsDone status. <br>
105   Standard_EXPORT Standard_Boolean Perform();
106   //! True if the minimum distance is found. <br>
107   Standard_EXPORT Standard_Boolean IsDone() const
108   { 
109     return myIsDone;
110   }
111   //! Returns the number of solutions satisfying the minimum distance. <br>
112   Standard_EXPORT Standard_Integer NbSolution() const
113   { 
114     return mySolutionsShape1.Length();
115   }
116   //! Returns the value of the minimum distance. <br>
117   Standard_EXPORT Standard_Real Value() const;
118   //! True if one of the shapes is a solid and the other shape <br>
119   //! is completely or partially inside the solid. <br>
120   Standard_EXPORT Standard_Boolean InnerSolution() const
121   { 
122     return myInnerSol;
123   }
124   //! Returns the Point corresponding to the <N>th solution on the first Shape <br>
125   Standard_EXPORT const gp_Pnt & PointOnShape1(const Standard_Integer N) const
126   { 
127     return mySolutionsShape1.Value(N).Point();
128   }
129   //! Returns the Point corresponding to the <N>th solution on the second Shape <br>
130   Standard_EXPORT const gp_Pnt & PointOnShape2(const Standard_Integer N) const
131   { 
132     return mySolutionsShape2.Value(N).Point();
133   }
134   //! gives the type of the support where the Nth solution on the first shape is situated: <br>
135   //!   IsVertex => the Nth solution on the first shape is a Vertex <br>
136   //!   IsOnEdge => the Nth soluion on the first shape is on a Edge <br>
137   //!   IsInFace => the Nth solution on the first shape is inside a face <br>
138   //! the corresponding support is obtained by the method SupportOnShape1 <br>
139   Standard_EXPORT BRepExtrema_SupportType SupportTypeShape1(const Standard_Integer N) const
140   { 
141     return mySolutionsShape1.Value(N).SupportKind();
142   }
143   //! gives the type of the support where the Nth solution on the second shape is situated: <br>
144   //!   IsVertex => the Nth solution on the second shape is a Vertex <br>
145   //!   IsOnEdge => the Nth soluion on the secondt shape is on a Edge <br>
146   //!   IsInFace => the Nth solution on the second shape is inside a face <br>
147   //! the corresponding support is obtained by the method SupportOnShape2 <br>
148   Standard_EXPORT BRepExtrema_SupportType SupportTypeShape2(const Standard_Integer N) const
149   { 
150     return mySolutionsShape2.Value(N).SupportKind();
151   }
152   //! gives the support where the Nth solution on the first shape is situated. <br>
153   //! This support can be a Vertex, an Edge or a Face. <br>
154   Standard_EXPORT TopoDS_Shape SupportOnShape1(const Standard_Integer N) const;
155   //! gives the support where the Nth solution on the second shape is situated. <br>
156   //! This support can be a Vertex, an Edge or a Face. <br>
157   Standard_EXPORT TopoDS_Shape SupportOnShape2(const Standard_Integer N) const;
158   //! gives the corresponding parameter t if the Nth solution <br>
159   //! is situated on an Egde of the first shape <br>
160   Standard_EXPORT void ParOnEdgeS1(const Standard_Integer N,Standard_Real& t) const;
161   //! gives the corresponding parameter t if the Nth solution <br>
162   //! is situated on an Egde of the first shape <br>
163   Standard_EXPORT void ParOnEdgeS2(const Standard_Integer N,Standard_Real& t) const;
164   //! gives the corresponding parameters (U,V) if the Nth solution <br>
165   //! is situated on an face of the first shape <br>
166   Standard_EXPORT void ParOnFaceS1(const Standard_Integer N,Standard_Real& u,Standard_Real& v) const;
167   //! gives the corresponding parameters (U,V) if the Nth solution <br>
168   //! is situated on an Face of the second shape <br>
169   Standard_EXPORT void ParOnFaceS2(const Standard_Integer N,Standard_Real& u,Standard_Real& v) const;
170   //! Prints on the stream o information on the current state of the object. <br>
171   Standard_EXPORT void Dump(Standard_OStream& o) const;
172
173   Standard_EXPORT void SetFlag(const Extrema_ExtFlag F)
174   {
175     myFlag = F;
176   }
177
178   Standard_EXPORT void SetAlgo(const Extrema_ExtAlgo A)
179   {
180     myAlgo = A;
181   }
182
183 private:
184
185   //! computes the minimum distance between two maps of shapes (Face,Edge,Vertex) <br>
186   Standard_EXPORT void DistanceMapMap(const TopTools_IndexedMapOfShape& Map1,const TopTools_IndexedMapOfShape& Map2,const Bnd_SeqOfBox& LBox1,const Bnd_SeqOfBox& LBox2);
187
188   Standard_Real myDistRef;
189   Standard_Real myDistValue;
190   Standard_Boolean myIsDone;
191   BRepExtrema_SeqOfSolution mySolutionsShape1;
192   BRepExtrema_SeqOfSolution mySolutionsShape2;
193   Standard_Boolean myInnerSol;
194   Standard_Real myEps;
195   TopoDS_Shape myShape1;
196   TopoDS_Shape myShape2;
197   TopTools_IndexedMapOfShape myMapV1;
198   TopTools_IndexedMapOfShape myMapV2;
199   TopTools_IndexedMapOfShape myMapE1;
200   TopTools_IndexedMapOfShape myMapE2;
201   TopTools_IndexedMapOfShape myMapF1;
202   TopTools_IndexedMapOfShape myMapF2;
203   Extrema_ExtFlag myFlag;
204   Extrema_ExtAlgo myAlgo;
205 };
206
207 #endif