mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0032552: Modeling Algorithms - BRepExtrema_DistShapeShape algorithm consumes too much memory
Used a new BRepExtrema_DistShapeShape::DistanceVertVert() function to replace DistanceMapMap() to calculate vertex/vertex distance
This commit is contained in:
parent
b878139461
commit
92c1f9728e
@ -147,7 +147,6 @@ Standard_Boolean BRepExtrema_DistShapeShape::DistanceMapMap (const TopTools_Inde
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::stable_sort(aPairList.begin(), aPairList.end(), BRepExtrema_CheckPair_Comparator);
|
std::stable_sort(aPairList.begin(), aPairList.end(), BRepExtrema_CheckPair_Comparator);
|
||||||
Message_ProgressRange aDistRange(aTwinScope.Next(0.7));
|
Message_ProgressRange aDistRange(aTwinScope.Next(0.7));
|
||||||
Message_ProgressScope aDistScope(aDistRange, NULL, aPairList.Size());
|
Message_ProgressScope aDistScope(aDistRange, NULL, aPairList.Size());
|
||||||
@ -205,6 +204,64 @@ Standard_Boolean BRepExtrema_DistShapeShape::DistanceMapMap (const TopTools_Inde
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : DistanceVertVert
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Boolean BRepExtrema_DistShapeShape::DistanceVertVert(const TopTools_IndexedMapOfShape& theMap1,
|
||||||
|
const TopTools_IndexedMapOfShape& theMap2,
|
||||||
|
const Message_ProgressRange& theRange)
|
||||||
|
{
|
||||||
|
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())
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
const TopoDS_Vertex& aVertex1 = TopoDS::Vertex(theMap1.FindKey(anIdx1));
|
||||||
|
const gp_Pnt aPoint1 = BRep_Tool::Pnt(aVertex1);
|
||||||
|
for (Standard_Integer anIdx2 = 1; anIdx2 <= aCount2; ++anIdx2)
|
||||||
|
{
|
||||||
|
const TopoDS_Vertex& aVertex2 = TopoDS::Vertex(theMap2.FindKey(anIdx2));
|
||||||
|
const gp_Pnt aPoint2 = BRep_Tool::Pnt(aVertex2);
|
||||||
|
|
||||||
|
const Standard_Real aDist = aPoint1.Distance(aPoint2);
|
||||||
|
if (aDist < myDistRef - myEps)
|
||||||
|
{
|
||||||
|
mySolutionsShape1.Clear();
|
||||||
|
mySolutionsShape2.Clear();
|
||||||
|
|
||||||
|
const BRepExtrema_SolutionElem Sol1(aDist, aPoint1, BRepExtrema_IsVertex, aVertex1);
|
||||||
|
const BRepExtrema_SolutionElem Sol2(aDist, aPoint2, BRepExtrema_IsVertex, aVertex2);
|
||||||
|
mySolutionsShape1.Append(Sol1);
|
||||||
|
mySolutionsShape2.Append(Sol2);
|
||||||
|
|
||||||
|
myDistRef = aDist;
|
||||||
|
}
|
||||||
|
else if (fabs(aDist - myDistRef) < myEps)
|
||||||
|
{
|
||||||
|
const BRepExtrema_SolutionElem Sol1(aDist, aPoint1, BRepExtrema_IsVertex, aVertex1);
|
||||||
|
const BRepExtrema_SolutionElem Sol2(aDist, aPoint2, BRepExtrema_IsVertex, aVertex2);
|
||||||
|
mySolutionsShape1.Append(Sol1);
|
||||||
|
mySolutionsShape2.Append(Sol2);
|
||||||
|
|
||||||
|
if (myDistRef > aDist)
|
||||||
|
{
|
||||||
|
myDistRef = aDist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : BRepExtrema_DistShapeShape
|
//function : BRepExtrema_DistShapeShape
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -408,7 +465,7 @@ Standard_Boolean BRepExtrema_DistShapeShape::Perform(const Message_ProgressRange
|
|||||||
else
|
else
|
||||||
myDistRef= 1.e30; //szv:!!!
|
myDistRef= 1.e30; //szv:!!!
|
||||||
|
|
||||||
if(!DistanceMapMap (myMapV1, myMapV2, myBV1, myBV2, aRootScope.Next()))
|
if(!DistanceVertVert(myMapV1, myMapV2, aRootScope.Next()))
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
@ -154,6 +154,11 @@ private:
|
|||||||
const Bnd_SeqOfBox& LBox2,
|
const Bnd_SeqOfBox& LBox2,
|
||||||
const Message_ProgressRange& theRange);
|
const Message_ProgressRange& theRange);
|
||||||
|
|
||||||
|
//! computes the minimum distance between two maps of vertices <br>
|
||||||
|
Standard_Boolean DistanceVertVert(const TopTools_IndexedMapOfShape& theMap1,
|
||||||
|
const TopTools_IndexedMapOfShape& theMap2,
|
||||||
|
const Message_ProgressRange& theRange);
|
||||||
|
|
||||||
Standard_Boolean SolidTreatment(const TopoDS_Shape& theShape,
|
Standard_Boolean SolidTreatment(const TopoDS_Shape& theShape,
|
||||||
const TopTools_IndexedMapOfShape& theMap,
|
const TopTools_IndexedMapOfShape& theMap,
|
||||||
const Message_ProgressRange& theRange);
|
const Message_ProgressRange& theRange);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user