File indexing completed on 2026-09-17 09:19:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _BRepExtrema_DistShapeShape_HeaderFile
0015 #define _BRepExtrema_DistShapeShape_HeaderFile
0016
0017 #include <Bnd_Box.hxx>
0018 #include <NCollection_Array1.hxx>
0019 #include <NCollection_Sequence.hxx>
0020 #include <BRepExtrema_SolutionElem.hxx>
0021 #include <BRepExtrema_SupportType.hxx>
0022 #include <Extrema_ExtAlgo.hxx>
0023 #include <Extrema_ExtFlag.hxx>
0024 #include <Message_ProgressRange.hxx>
0025 #include <TopoDS_Shape.hxx>
0026 #include <Standard_OStream.hxx>
0027 #include <Standard_DefineAlloc.hxx>
0028 #include <TopTools_ShapeMapHasher.hxx>
0029 #include <NCollection_IndexedMap.hxx>
0030
0031
0032
0033 class BRepExtrema_DistShapeShape
0034 {
0035 public:
0036 DEFINE_STANDARD_ALLOC
0037
0038
0039 Standard_EXPORT BRepExtrema_DistShapeShape();
0040
0041
0042
0043
0044
0045
0046
0047
0048 Standard_EXPORT BRepExtrema_DistShapeShape(
0049 const TopoDS_Shape& Shape1,
0050 const TopoDS_Shape& Shape2,
0051 const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
0052 const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad,
0053 const Message_ProgressRange& theRange = Message_ProgressRange());
0054
0055
0056
0057
0058
0059
0060
0061
0062 Standard_EXPORT BRepExtrema_DistShapeShape(
0063 const TopoDS_Shape& Shape1,
0064 const TopoDS_Shape& Shape2,
0065 const double theDeflection,
0066 const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
0067 const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad,
0068 const Message_ProgressRange& theRange = Message_ProgressRange());
0069
0070
0071 void SetDeflection(const double theDeflection) { myEps = theDeflection; }
0072
0073
0074 Standard_EXPORT void LoadS1(const TopoDS_Shape& Shape1);
0075
0076
0077 Standard_EXPORT void LoadS2(const TopoDS_Shape& Shape1);
0078
0079
0080
0081
0082
0083
0084
0085 Standard_EXPORT bool Perform(const Message_ProgressRange& theRange = Message_ProgressRange());
0086
0087
0088 bool IsDone() const { return myIsDone; }
0089
0090
0091 int NbSolution() const { return mySolutionsShape1.Length(); }
0092
0093
0094 Standard_EXPORT double Value() const;
0095
0096
0097
0098 bool InnerSolution() const { return myInnerSol; }
0099
0100
0101 const gp_Pnt& PointOnShape1(const int N) const { return mySolutionsShape1.Value(N).Point(); }
0102
0103
0104 const gp_Pnt& PointOnShape2(const int N) const { return mySolutionsShape2.Value(N).Point(); }
0105
0106
0107
0108
0109
0110
0111 BRepExtrema_SupportType SupportTypeShape1(const int N) const
0112 {
0113 return mySolutionsShape1.Value(N).SupportKind();
0114 }
0115
0116
0117
0118
0119
0120
0121 BRepExtrema_SupportType SupportTypeShape2(const int N) const
0122 {
0123 return mySolutionsShape2.Value(N).SupportKind();
0124 }
0125
0126
0127
0128 Standard_EXPORT TopoDS_Shape SupportOnShape1(const int N) const;
0129
0130
0131
0132 Standard_EXPORT TopoDS_Shape SupportOnShape2(const int N) const;
0133
0134
0135
0136 Standard_EXPORT void ParOnEdgeS1(const int N, double& t) const;
0137
0138
0139
0140 Standard_EXPORT void ParOnEdgeS2(const int N, double& t) const;
0141
0142
0143
0144 Standard_EXPORT void ParOnFaceS1(const int N, double& u, double& v) const;
0145
0146
0147
0148 Standard_EXPORT void ParOnFaceS2(const int N, double& u, double& v) const;
0149
0150
0151 Standard_EXPORT void Dump(Standard_OStream& o) const;
0152
0153
0154
0155 void SetFlag(const Extrema_ExtFlag F) { myFlag = F; }
0156
0157
0158
0159 void SetAlgo(const Extrema_ExtAlgo A) { myAlgo = A; }
0160
0161
0162 void SetMultiThread(bool theIsMultiThread) { myIsMultiThread = theIsMultiThread; }
0163
0164
0165
0166 bool IsMultiThread() const { return myIsMultiThread; }
0167
0168 private:
0169
0170 bool DistanceMapMap(const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& Map1,
0171 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& Map2,
0172 const NCollection_Array1<Bnd_Box>& LBox1,
0173 const NCollection_Array1<Bnd_Box>& LBox2,
0174 const Message_ProgressRange& theRange);
0175
0176
0177 bool DistanceVertVert(
0178 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMap1,
0179 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMap2,
0180 const Message_ProgressRange& theRange);
0181
0182 bool SolidTreatment(const TopoDS_Shape& theShape,
0183 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMap,
0184 const Message_ProgressRange& theRange);
0185
0186 private:
0187 double myDistRef;
0188 bool myIsDone;
0189 NCollection_Sequence<BRepExtrema_SolutionElem> mySolutionsShape1;
0190 NCollection_Sequence<BRepExtrema_SolutionElem> mySolutionsShape2;
0191 bool myInnerSol;
0192 double myEps;
0193 TopoDS_Shape myShape1;
0194 TopoDS_Shape myShape2;
0195 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myMapV1;
0196 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myMapV2;
0197 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myMapE1;
0198 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myMapE2;
0199 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myMapF1;
0200 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myMapF2;
0201 bool myIsInitS1;
0202 bool myIsInitS2;
0203 Extrema_ExtFlag myFlag;
0204 Extrema_ExtAlgo myAlgo;
0205 NCollection_Array1<Bnd_Box> myBV1;
0206 NCollection_Array1<Bnd_Box> myBV2;
0207 NCollection_Array1<Bnd_Box> myBE1;
0208 NCollection_Array1<Bnd_Box> myBE2;
0209 NCollection_Array1<Bnd_Box> myBF1;
0210 NCollection_Array1<Bnd_Box> myBF2;
0211 bool myIsMultiThread;
0212 };
0213
0214 #endif