Commit | Line | Data |
---|---|---|
973c2be1 | 1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
92d1589b | 2 | // |
973c2be1 | 3 | // This file is part of Open CASCADE Technology software library. |
92d1589b | 4 | // |
d5f74e42 | 5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published | |
973c2be1 | 7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |
9 | // distribution for complete text of the license and disclaimer of any warranty. | |
b311480e | 10 | // |
973c2be1 | 11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. | |
92d1589b A |
13 | |
14 | #ifndef _BRepExtrema_DistanceSS_HeaderFile | |
15 | #define _BRepExtrema_DistanceSS_HeaderFile | |
16 | ||
92d1589b | 17 | #include <BRepExtrema_SeqOfSolution.hxx> |
92d1589b | 18 | #include <Extrema_ExtFlag.hxx> |
92d1589b | 19 | #include <Extrema_ExtAlgo.hxx> |
92d1589b | 20 | #include <Precision.hxx> |
ebc93ae7 | 21 | #include <Standard_DefineAlloc.hxx> |
22 | ||
92d1589b A |
23 | class TopoDS_Shape; |
24 | class Bnd_Box; | |
25 | class TopoDS_Vertex; | |
26 | class TopoDS_Edge; | |
27 | class TopoDS_Face; | |
28 | ||
29 | ||
30 | //! This class allows to compute minimum distance between two shapes <br> | |
31 | //! (face edge vertex) and is used in DistShapeShape class. <br> | |
32 | class BRepExtrema_DistanceSS | |
33 | { | |
34 | public: | |
35 | ||
1c35b92f | 36 | DEFINE_STANDARD_ALLOC |
92d1589b A |
37 | |
38 | //! computes the distance between two Shapes ( face edge vertex). <br> | |
0f57ab75 | 39 | BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2, |
92d1589b A |
40 | const Bnd_Box& B1, const Bnd_Box& B2, |
41 | const Standard_Real DstRef, | |
42 | const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, | |
43 | const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad) | |
44 | : myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F), myAlgo(A) | |
45 | { | |
46 | Perform(S1, S2, B1, B2); | |
47 | } | |
48 | //! computes the distance between two Shapes ( face edge vertex). <br> | |
49 | //! Parameter theDeflection is used to specify a maximum deviation <br> | |
50 | //! of extreme distances from the minimum one. <br> | |
51 | //! Default value is Precision::Confusion(). <br> | |
0f57ab75 | 52 | BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2, |
92d1589b A |
53 | const Bnd_Box& B1, const Bnd_Box& B2, |
54 | const Standard_Real DstRef, const Standard_Real aDeflection, | |
55 | const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, | |
56 | const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad) | |
57 | : myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F), myAlgo(A) | |
58 | { | |
59 | Perform(S1, S2, B1, B2); | |
60 | } | |
61 | //! True if the distance has been computed <br> | |
0f57ab75 | 62 | Standard_Boolean IsDone() const |
92d1589b A |
63 | { |
64 | return myModif; | |
65 | } | |
66 | //! returns the distance value <br> | |
0f57ab75 | 67 | Standard_Real DistValue() const |
92d1589b A |
68 | { |
69 | return myDstRef; | |
70 | } | |
71 | //! returns the list of solutions on the first shape <br> | |
0f57ab75 | 72 | const BRepExtrema_SeqOfSolution& Seq1Value() const |
92d1589b A |
73 | { |
74 | return SeqSolShape1; | |
75 | } | |
76 | //! returns the list of solutions on the second shape <br> | |
0f57ab75 | 77 | const BRepExtrema_SeqOfSolution& Seq2Value() const |
92d1589b A |
78 | { |
79 | return SeqSolShape2; | |
80 | } | |
81 | //! sets the flag controlling minimum and maximum search | |
0f57ab75 | 82 | void SetFlag(const Extrema_ExtFlag F) |
92d1589b A |
83 | { |
84 | myFlag = F; | |
85 | } | |
86 | //! sets the flag controlling ... | |
0f57ab75 | 87 | void SetAlgo(const Extrema_ExtAlgo A) |
92d1589b A |
88 | { |
89 | myAlgo = A; | |
90 | } | |
91 | ||
92 | private: | |
93 | ||
94 | //! computes the distance between two Shapes ( face edge vertex) <br> | |
2a3ff1e0 | 95 | Standard_EXPORT void Perform(const TopoDS_Shape& S1,const TopoDS_Shape& S2,const Bnd_Box& B1,const Bnd_Box& B2); |
92d1589b A |
96 | |
97 | //! computes the distance between two vertices <br> | |
98 | void Perform(const TopoDS_Vertex& S1,const TopoDS_Vertex& S2); | |
99 | //! computes the minimum distance between a vertex and an edge <br> | |
100 | void Perform(const TopoDS_Vertex& S1,const TopoDS_Edge& S2,const Bnd_Box& B1,const Bnd_Box& B2); | |
101 | //! computes the minimum distance between a vertex and a face <br> | |
102 | void Perform(const TopoDS_Vertex& S1,const TopoDS_Face& S2,const Bnd_Box& B1,const Bnd_Box& B2); | |
103 | ||
104 | //! computes the minimum distance between an edge and a vertex <br> | |
6aeb8ed1 A |
105 | void Perform(const TopoDS_Edge& S1,const TopoDS_Vertex& S2,const Bnd_Box& B1,const Bnd_Box& B2); |
106 | /*{ | |
92d1589b | 107 | Perform(S2, S1, B2, B1); |
6aeb8ed1 | 108 | }*/ |
92d1589b A |
109 | //! computes the minimum distance between two edges <br> |
110 | void Perform(const TopoDS_Edge& S1,const TopoDS_Edge& S2,const Bnd_Box& B1,const Bnd_Box& B2); | |
111 | //! computes the minimum distance an edge and a face <br> | |
112 | void Perform(const TopoDS_Edge& S1,const TopoDS_Face& S2,const Bnd_Box& B1,const Bnd_Box& B2); | |
113 | ||
114 | //! computes the minimum distance betwwen a face and a vertex <br> | |
6aeb8ed1 A |
115 | void Perform(const TopoDS_Face& S1,const TopoDS_Vertex& S2,const Bnd_Box& B1,const Bnd_Box& B2); |
116 | /*{ | |
92d1589b | 117 | Perform(S2, S1, B2, B1); |
6aeb8ed1 | 118 | }*/ |
92d1589b | 119 | //! computes the minimum distance between a face and an edge <br> |
6aeb8ed1 A |
120 | void Perform(const TopoDS_Face& S1,const TopoDS_Edge& S2,const Bnd_Box& B1,const Bnd_Box& B2); |
121 | /*{ | |
92d1589b | 122 | Perform(S2, S1, B2, B1); |
6aeb8ed1 | 123 | }*/ |
92d1589b A |
124 | //! computes the minimum distance between two faces <br> |
125 | void Perform(const TopoDS_Face& S1,const TopoDS_Face& S2,const Bnd_Box& B1,const Bnd_Box& B2); | |
126 | ||
127 | BRepExtrema_SeqOfSolution SeqSolShape1; | |
128 | BRepExtrema_SeqOfSolution SeqSolShape2; | |
129 | Standard_Real myDstRef; | |
130 | Standard_Boolean myModif; | |
131 | Standard_Real myEps; | |
132 | Extrema_ExtFlag myFlag; | |
133 | Extrema_ExtAlgo myAlgo; | |
134 | }; | |
135 | ||
136 | #endif |