1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _BRepExtrema_DistanceSS_HeaderFile
15 #define _BRepExtrema_DistanceSS_HeaderFile
17 #include <BRepExtrema_SeqOfSolution.hxx>
18 #include <Extrema_ExtFlag.hxx>
19 #include <Extrema_ExtAlgo.hxx>
20 #include <Precision.hxx>
21 #include <Standard_DefineAlloc.hxx>
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
38 //! computes the distance between two Shapes ( face edge vertex). <br>
39 BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
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)
46 Perform(S1, S2, B1, B2);
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>
52 BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
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)
59 Perform(S1, S2, B1, B2);
61 //! True if the distance has been computed <br>
62 Standard_Boolean IsDone() const
66 //! returns the distance value <br>
67 Standard_Real DistValue() const
71 //! returns the list of solutions on the first shape <br>
72 const BRepExtrema_SeqOfSolution& Seq1Value() const
76 //! returns the list of solutions on the second shape <br>
77 const BRepExtrema_SeqOfSolution& Seq2Value() const
81 //! sets the flag controlling minimum and maximum search
82 void SetFlag(const Extrema_ExtFlag F)
86 //! sets the flag controlling ...
87 void SetAlgo(const Extrema_ExtAlgo A)
94 //! computes the distance between two Shapes ( face edge vertex) <br>
95 Standard_EXPORT void Perform(const TopoDS_Shape& S1,const TopoDS_Shape& S2,const Bnd_Box& B1,const Bnd_Box& B2);
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);
104 //! computes the minimum distance between an edge and a vertex <br>
105 void Perform(const TopoDS_Edge& S1,const TopoDS_Vertex& S2,const Bnd_Box& B1,const Bnd_Box& B2);
107 Perform(S2, S1, B2, B1);
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);
114 //! computes the minimum distance betwwen a face and a vertex <br>
115 void Perform(const TopoDS_Face& S1,const TopoDS_Vertex& S2,const Bnd_Box& B1,const Bnd_Box& B2);
117 Perform(S2, S1, B2, B1);
119 //! computes the minimum distance between a face and an edge <br>
120 void Perform(const TopoDS_Face& S1,const TopoDS_Edge& S2,const Bnd_Box& B1,const Bnd_Box& B2);
122 Perform(S2, S1, B2, B1);
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);
127 BRepExtrema_SeqOfSolution SeqSolShape1;
128 BRepExtrema_SeqOfSolution SeqSolShape2;
129 Standard_Real myDstRef;
130 Standard_Boolean myModif;
132 Extrema_ExtFlag myFlag;
133 Extrema_ExtAlgo myAlgo;