Commit | Line | Data |
---|---|---|
b311480e | 1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
92d1589b | 2 | // |
b311480e | 3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file | |
5 | // except in compliance with the License. Please obtain a copy of the License | |
6 | // at http://www.opencascade.org and read it completely before using this file. | |
92d1589b | 7 | // |
b311480e | 8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. | |
10 | // | |
11 | // The Original Code and all software distributed under the License is | |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the | |
13 | // Initial Developer hereby disclaims all such warranties, including without | |
14 | // limitation, any warranties of merchantability, fitness for a particular | |
15 | // purpose or non-infringement. Please see the License for the specific terms | |
16 | // and conditions governing the rights and limitations under the License. | |
92d1589b A |
17 | |
18 | #ifndef _BRepExtrema_DistanceSS_HeaderFile | |
19 | #define _BRepExtrema_DistanceSS_HeaderFile | |
20 | ||
21 | #ifndef _Standard_HeaderFile | |
22 | #include <Standard.hxx> | |
23 | #endif | |
1c35b92f | 24 | #ifndef _Standard_DefineAlloc_HeaderFile |
25 | #include <Standard_DefineAlloc.hxx> | |
26 | #endif | |
92d1589b A |
27 | #ifndef _Standard_Macro_HeaderFile |
28 | #include <Standard_Macro.hxx> | |
29 | #endif | |
30 | ||
31 | #ifndef _BRepExtrema_SeqOfSolution_HeaderFile | |
32 | #include <BRepExtrema_SeqOfSolution.hxx> | |
33 | #endif | |
34 | #ifndef _Standard_Real_HeaderFile | |
35 | #include <Standard_Real.hxx> | |
36 | #endif | |
37 | #ifndef _Standard_Boolean_HeaderFile | |
38 | #include <Standard_Boolean.hxx> | |
39 | #endif | |
40 | #ifndef _Extrema_ExtFlag_HeaderFile | |
41 | #include <Extrema_ExtFlag.hxx> | |
42 | #endif | |
43 | #ifndef _Extrema_ExtAlgo_HeaderFile | |
44 | #include <Extrema_ExtAlgo.hxx> | |
45 | #endif | |
46 | #ifndef _Precision_HeaderFile | |
47 | #include <Precision.hxx> | |
48 | #endif | |
49 | class TopoDS_Shape; | |
50 | class Bnd_Box; | |
51 | class TopoDS_Vertex; | |
52 | class TopoDS_Edge; | |
53 | class TopoDS_Face; | |
54 | ||
55 | ||
56 | //! This class allows to compute minimum distance between two shapes <br> | |
57 | //! (face edge vertex) and is used in DistShapeShape class. <br> | |
58 | class BRepExtrema_DistanceSS | |
59 | { | |
60 | public: | |
61 | ||
1c35b92f | 62 | DEFINE_STANDARD_ALLOC |
92d1589b A |
63 | |
64 | //! computes the distance between two Shapes ( face edge vertex). <br> | |
65 | Standard_EXPORT BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2, | |
66 | const Bnd_Box& B1, const Bnd_Box& B2, | |
67 | const Standard_Real DstRef, | |
68 | const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, | |
69 | const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad) | |
70 | : myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F), myAlgo(A) | |
71 | { | |
72 | Perform(S1, S2, B1, B2); | |
73 | } | |
74 | //! computes the distance between two Shapes ( face edge vertex). <br> | |
75 | //! Parameter theDeflection is used to specify a maximum deviation <br> | |
76 | //! of extreme distances from the minimum one. <br> | |
77 | //! Default value is Precision::Confusion(). <br> | |
78 | Standard_EXPORT BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2, | |
79 | const Bnd_Box& B1, const Bnd_Box& B2, | |
80 | const Standard_Real DstRef, const Standard_Real aDeflection, | |
81 | const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, | |
82 | const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad) | |
83 | : myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F), myAlgo(A) | |
84 | { | |
85 | Perform(S1, S2, B1, B2); | |
86 | } | |
87 | //! True if the distance has been computed <br> | |
88 | Standard_EXPORT Standard_Boolean IsDone() const | |
89 | { | |
90 | return myModif; | |
91 | } | |
92 | //! returns the distance value <br> | |
93 | Standard_EXPORT Standard_Real DistValue() const | |
94 | { | |
95 | return myDstRef; | |
96 | } | |
97 | //! returns the list of solutions on the first shape <br> | |
98 | Standard_EXPORT const BRepExtrema_SeqOfSolution& Seq1Value() const | |
99 | { | |
100 | return SeqSolShape1; | |
101 | } | |
102 | //! returns the list of solutions on the second shape <br> | |
103 | Standard_EXPORT const BRepExtrema_SeqOfSolution& Seq2Value() const | |
104 | { | |
105 | return SeqSolShape2; | |
106 | } | |
107 | //! sets the flag controlling minimum and maximum search | |
108 | Standard_EXPORT void SetFlag(const Extrema_ExtFlag F) | |
109 | { | |
110 | myFlag = F; | |
111 | } | |
112 | //! sets the flag controlling ... | |
113 | Standard_EXPORT void SetAlgo(const Extrema_ExtAlgo A) | |
114 | { | |
115 | myAlgo = A; | |
116 | } | |
117 | ||
118 | private: | |
119 | ||
120 | //! computes the distance between two Shapes ( face edge vertex) <br> | |
2a3ff1e0 | 121 | Standard_EXPORT void Perform(const TopoDS_Shape& S1,const TopoDS_Shape& S2,const Bnd_Box& B1,const Bnd_Box& B2); |
92d1589b A |
122 | |
123 | //! computes the distance between two vertices <br> | |
124 | void Perform(const TopoDS_Vertex& S1,const TopoDS_Vertex& S2); | |
125 | //! computes the minimum distance between a vertex and an edge <br> | |
126 | void Perform(const TopoDS_Vertex& S1,const TopoDS_Edge& S2,const Bnd_Box& B1,const Bnd_Box& B2); | |
127 | //! computes the minimum distance between a vertex and a face <br> | |
128 | void Perform(const TopoDS_Vertex& S1,const TopoDS_Face& S2,const Bnd_Box& B1,const Bnd_Box& B2); | |
129 | ||
130 | //! computes the minimum distance between an edge and a vertex <br> | |
6aeb8ed1 A |
131 | void Perform(const TopoDS_Edge& S1,const TopoDS_Vertex& S2,const Bnd_Box& B1,const Bnd_Box& B2); |
132 | /*{ | |
92d1589b | 133 | Perform(S2, S1, B2, B1); |
6aeb8ed1 | 134 | }*/ |
92d1589b A |
135 | //! computes the minimum distance between two edges <br> |
136 | void Perform(const TopoDS_Edge& S1,const TopoDS_Edge& S2,const Bnd_Box& B1,const Bnd_Box& B2); | |
137 | //! computes the minimum distance an edge and a face <br> | |
138 | void Perform(const TopoDS_Edge& S1,const TopoDS_Face& S2,const Bnd_Box& B1,const Bnd_Box& B2); | |
139 | ||
140 | //! computes the minimum distance betwwen a face and a vertex <br> | |
6aeb8ed1 A |
141 | void Perform(const TopoDS_Face& S1,const TopoDS_Vertex& S2,const Bnd_Box& B1,const Bnd_Box& B2); |
142 | /*{ | |
92d1589b | 143 | Perform(S2, S1, B2, B1); |
6aeb8ed1 | 144 | }*/ |
92d1589b | 145 | //! computes the minimum distance between a face and an edge <br> |
6aeb8ed1 A |
146 | void Perform(const TopoDS_Face& S1,const TopoDS_Edge& S2,const Bnd_Box& B1,const Bnd_Box& B2); |
147 | /*{ | |
92d1589b | 148 | Perform(S2, S1, B2, B1); |
6aeb8ed1 | 149 | }*/ |
92d1589b A |
150 | //! computes the minimum distance between two faces <br> |
151 | void Perform(const TopoDS_Face& S1,const TopoDS_Face& S2,const Bnd_Box& B1,const Bnd_Box& B2); | |
152 | ||
153 | BRepExtrema_SeqOfSolution SeqSolShape1; | |
154 | BRepExtrema_SeqOfSolution SeqSolShape2; | |
155 | Standard_Real myDstRef; | |
156 | Standard_Boolean myModif; | |
157 | Standard_Real myEps; | |
158 | Extrema_ExtFlag myFlag; | |
159 | Extrema_ExtAlgo myAlgo; | |
160 | }; | |
161 | ||
162 | #endif |