//purpose :
//=======================================================================
+void BRepExtrema_DistShapeShape::DistanceVertVert(const TopTools_IndexedMapOfShape& theMap1,
+ const TopTools_IndexedMapOfShape& theMap2,
+ const Bnd_SeqOfBox& theLBox1,
+ const Bnd_SeqOfBox& theLBox2,
+ const Message_ProgressRange& theRange)
+{
+ NCollection_Vector<BRepExtrema_CheckPair> aPairList;
+ const Standard_Integer aCount1 = theMap1.Extent();
+ const Standard_Integer aCount2 = theMap2.Extent();
+
+ Message_ProgressScope aScope(theRange, NULL, aCount1);
+
+ for (Standard_Integer anIdx1 = 1; anIdx1 <= aCount1; ++anIdx1)
+ {
+ aScope.Next();
+ if (!aScope.More())
+ {
+ throw StdFail_NotDone();
+ }
+ for (Standard_Integer anIdx2 = 1; anIdx2 <= aCount2; ++anIdx2)
+ {
+ const Bnd_Box& aBox1 = theLBox1.Value(anIdx1);
+ const Bnd_Box& aBox2 = theLBox2.Value(anIdx2);
+ if (aBox1.IsVoid()
+ || aBox2.IsVoid())
+ {
+ continue;
+ }
+ const TopoDS_Shape& aShape1 = theMap1.FindKey(anIdx1);
+ const TopoDS_Shape& aShape2 = theMap2.FindKey(anIdx1);
+
+ BRepExtrema_DistanceSS aDistTool(aShape1, aShape2, aBox1, aBox2, myDistRef, myEps);
+ if (aDistTool.IsDone())
+ {
+ if (aDistTool.DistValue() < myDistRef - myEps)
+ {
+ mySolutionsShape1.Clear();
+ mySolutionsShape2.Clear();
+
+ BRepExtrema_SeqOfSolution aSeq1 = aDistTool.Seq1Value();
+ BRepExtrema_SeqOfSolution aSeq2 = aDistTool.Seq2Value();
+
+ mySolutionsShape1.Append(aSeq1);
+ mySolutionsShape2.Append(aSeq2);
+
+ myDistRef = aDistTool.DistValue();
+ }
+ else if (fabs(aDistTool.DistValue() - myDistRef) < myEps)
+ {
+ BRepExtrema_SeqOfSolution aSeq1 = aDistTool.Seq1Value();
+ BRepExtrema_SeqOfSolution aSeq2 = aDistTool.Seq2Value();
+
+ mySolutionsShape1.Append(aSeq1);
+ mySolutionsShape2.Append(aSeq2);
+
+ if (myDistRef > aDistTool.DistValue())
+ {
+ myDistRef = aDistTool.DistValue();
+ }
+ }
+ }
+ }
+ }
+}
+
+//=======================================================================
+//function : DistanceMapMap
+//purpose :
+//=======================================================================
+
void BRepExtrema_DistShapeShape::DistanceMapMap (const TopTools_IndexedMapOfShape& theMap1,
const TopTools_IndexedMapOfShape& theMap2,
const Bnd_SeqOfBox& theLBox1,
//purpose :
//=======================================================================
void BRepExtrema_DistShapeShape::SolidTreatmentOne(const TopoDS_Shape& theShape,
- const TopTools_IndexedMapOfShape& theMap,
- const Message_ProgressRange& theRange
+ const TopTools_IndexedMapOfShape& theVertexMap,
+ const Message_ProgressRange& theRange)
{
BRepClass3d_SolidClassifier aClassifier(theShape);
const Standard_Real aTolerance = 0.001;
- Message_ProgressScope aScope(theRange, NULL, theMap.Extent());
- for (Standard_Integer i = 1; i < theMap.Extent(); ++i)
+ Message_ProgressScope aScope(theRange, NULL, theVertexMap.Extent());
+ for (Standard_Integer i = 1; i < theVertexMap.Extent(); ++i)
{
Message_ProgressRange aRange = aScope.Next();
if (!aScope.More())
//function : SolidTreatmentMulty
//purpose :
//=======================================================================
-Standard_Boolean BRepExtrema_DistShapeShape::SolidTreatmentMulty(const TopoDS_Shape& theShape,
- const TopTools_IndexedMapOfShape& theVertexMap,
- const Message_ProgressRange& theRange)
+void BRepExtrema_DistShapeShape::SolidTreatmentMulty(const TopoDS_Shape& theShape,
+ const TopTools_IndexedMapOfShape& theVertexMap,
+ const Message_ProgressRange& theRange)
{
const Standard_Integer aMapSize = theVertexMap.Extent();
const Standard_Integer aMinTaskSize = 3;
if (myIsBreak)
{
- return Standard_False;
+ throw StdFail_NotDone();
}
if (myInnerSol)
mySolutionsShape1.Append(aTaskArray[anI].mySolutionsShape);
mySolutionsShape2.Append(aTaskArray[anI].mySolutionsShape);
}
-
- return Standard_True;
}
//=======================================================================
//function : SolidTreatment
//purpose :
//=======================================================================
-Standard_Boolean BRepExtrema_DistShapeShape::SolidTreatment(const TopoDS_Shape& theShape,
- const TopTools_IndexedMapOfShape& theVertexMap,
- const Message_ProgressRange& theRange,
- const Standard_Boolean theIsMultiThread)
+void BRepExtrema_DistShapeShape::SolidTreatment(const TopoDS_Shape& theShape,
+ const TopTools_IndexedMapOfShape& theVertexMap,
+ const Message_ProgressRange& theRange,
+ const Standard_Boolean theIsMultiThread)
{
if (theIsMultiThread)
{
- return SolidTreatmentMulty(theShape, theVertexMap, theRange);
+ SolidTreatmentMulty(theShape, theVertexMap, theRange);
}
else
{
- return SolidTreatmentOne(theShape, theVertexMap, theRange);
+ SolidTreatmentOne(theShape, theVertexMap, theRange);
}
}
{
if (anIsSolid1)
{
- SolidTreatment(myShape1, myMapV2, aRootScope.Next(), theIsMultiThread));
+ SolidTreatment(myShape1, myMapV2, aRootScope.Next(), theIsMultiThread);
}
- if (anIsSolid2 && (!myInnerSol))
+ if (anIsSolid2 && (!myInnerSol))
{
- SolidTreatment(myShape2, myMapV1, aRootScope.Next(), theIsMultiThread));
+ SolidTreatment(myShape2, myMapV1, aRootScope.Next(), theIsMultiThread);
}
if (!myInnerSol)
else
myDistRef= 1.e30; //szv:!!!
- DistanceMapMap (myMapV1, myMapV2, myBV1, myBV2, aRootScope.Next());
- DistanceMapMap (myMapV1, myMapE2, myBV1, myBE2, aRootScope.Next());
- DistanceMapMap (myMapE1, myMapV2, myBE1, myBV2, aRootScope.Next());
- DistanceMapMap (myMapV1, myMapF2, myBV1, myBF2, aRootScope.Next());
- DistanceMapMap (myMapF1, myMapV2, myBF1, myBV2, aRootScope.Next());
- DistanceMapMap (myMapE1, myMapE2, myBE1, myBE2, aRootScope.Next());
- DistanceMapMap (myMapE1, myMapF2, myBE1, myBF2, aRootScope.Next());
- DistanceMapMap (myMapF1, myMapE2, myBF1, myBE2, aRootScope.Next());
+ DistanceVertVert(myMapV1, myMapV2, myBV1, myBV2, aRootScope.Next());
+ DistanceMapMap (myMapV1, myMapE2, myBV1, myBE2, aRootScope.Next());
+ DistanceMapMap (myMapE1, myMapV2, myBE1, myBV2, aRootScope.Next());
+ DistanceMapMap (myMapV1, myMapF2, myBV1, myBF2, aRootScope.Next());
+ DistanceMapMap (myMapF1, myMapV2, myBF1, myBV2, aRootScope.Next());
+ DistanceMapMap (myMapE1, myMapE2, myBE1, myBE2, aRootScope.Next());
+ DistanceMapMap (myMapE1, myMapF2, myBE1, myBF2, aRootScope.Next());
+ DistanceMapMap (myMapF1, myMapE2, myBF1, myBE2, aRootScope.Next());
if (fabs (myDistRef) > myEps)
{