1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
18 #ifndef _BRepExtrema_DistanceSS_HeaderFile
19 #define _BRepExtrema_DistanceSS_HeaderFile
21 #ifndef _Standard_HeaderFile
22 #include <Standard.hxx>
24 #ifndef _Standard_DefineAlloc_HeaderFile
25 #include <Standard_DefineAlloc.hxx>
27 #ifndef _Standard_Macro_HeaderFile
28 #include <Standard_Macro.hxx>
31 #ifndef _BRepExtrema_SeqOfSolution_HeaderFile
32 #include <BRepExtrema_SeqOfSolution.hxx>
34 #ifndef _Standard_Real_HeaderFile
35 #include <Standard_Real.hxx>
37 #ifndef _Standard_Boolean_HeaderFile
38 #include <Standard_Boolean.hxx>
40 #ifndef _Extrema_ExtFlag_HeaderFile
41 #include <Extrema_ExtFlag.hxx>
43 #ifndef _Extrema_ExtAlgo_HeaderFile
44 #include <Extrema_ExtAlgo.hxx>
46 #ifndef _Precision_HeaderFile
47 #include <Precision.hxx>
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
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)
72 Perform(S1, S2, B1, B2);
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)
85 Perform(S1, S2, B1, B2);
87 //! True if the distance has been computed <br>
88 Standard_EXPORT Standard_Boolean IsDone() const
92 //! returns the distance value <br>
93 Standard_EXPORT Standard_Real DistValue() const
97 //! returns the list of solutions on the first shape <br>
98 Standard_EXPORT const BRepExtrema_SeqOfSolution& Seq1Value() const
102 //! returns the list of solutions on the second shape <br>
103 Standard_EXPORT const BRepExtrema_SeqOfSolution& Seq2Value() const
107 //! sets the flag controlling minimum and maximum search
108 Standard_EXPORT void SetFlag(const Extrema_ExtFlag F)
112 //! sets the flag controlling ...
113 Standard_EXPORT void SetAlgo(const Extrema_ExtAlgo A)
120 //! computes the distance between two Shapes ( face edge vertex) <br>
121 Standard_EXPORT void Perform(const TopoDS_Shape& S1,const TopoDS_Shape& S2,const Bnd_Box& B1,const Bnd_Box& B2);
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);
130 //! computes the minimum distance between an edge and a vertex <br>
131 void Perform(const TopoDS_Edge& S1,const TopoDS_Vertex& S2,const Bnd_Box& B1,const Bnd_Box& B2);
133 Perform(S2, S1, B2, B1);
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);
140 //! computes the minimum distance betwwen a face and a vertex <br>
141 void Perform(const TopoDS_Face& S1,const TopoDS_Vertex& S2,const Bnd_Box& B1,const Bnd_Box& B2);
143 Perform(S2, S1, B2, B1);
145 //! computes the minimum distance between a face and an edge <br>
146 void Perform(const TopoDS_Face& S1,const TopoDS_Edge& S2,const Bnd_Box& B1,const Bnd_Box& B2);
148 Perform(S2, S1, B2, B1);
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);
153 BRepExtrema_SeqOfSolution SeqSolShape1;
154 BRepExtrema_SeqOfSolution SeqSolShape2;
155 Standard_Real myDstRef;
156 Standard_Boolean myModif;
158 Extrema_ExtFlag myFlag;
159 Extrema_ExtAlgo myAlgo;