Fix transformation support, so that support is updated with any previous transformation executed

This commit is contained in:
Abdullah Tahiri
2017-06-03 16:24:05 +02:00
committed by wmayer
parent 9e215721b0
commit ff188383a1
2 changed files with 71 additions and 74 deletions

View File

@@ -40,9 +40,6 @@
# include <Bnd_Box.hxx>
# include <BRepBndLib.hxx>
# include <BRepExtrema_DistShapeShape.hxx>
# include <BRep_Tool.hxx>
# include <TopoDS_Vertex.hxx>
# include <TopoDS.hxx>
#endif
@@ -341,7 +338,6 @@ std::vector<Part::cutFaces> Part::findAllFacesCutBy(
bool Part::checkIntersection(const TopoDS_Shape& first, const TopoDS_Shape& second,
const bool quick, const bool touch_is_intersection) {
//return true;
Bnd_Box first_bb, second_bb;
BRepBndLib::Add(first, first_bb);
first_bb.SetGap(0);
@@ -349,15 +345,19 @@ bool Part::checkIntersection(const TopoDS_Shape& first, const TopoDS_Shape& seco
second_bb.SetGap(0);
// Note: This test fails if the objects are touching one another at zero distance
// if it fails sometimes when touching and touching is intersection, then please check further
// unless the user asked for quick
// Improving reliability: If it fails sometimes when touching and touching is intersection,
// then please check further unless the user asked for a quick potentially unreliable result
if (first_bb.IsOut(second_bb) && !touch_is_intersection)
return false; // no intersection
if (quick && first_bb.IsOut(second_bb))
if (quick && !first_bb.IsOut(second_bb))
return true; // assumed intersection
// Try harder
// This has been disabled because of:
// https://www.freecadweb.org/tracker/view.php?id=3065
//extrema method
/*BRepExtrema_DistShapeShape extrema(first, second);
if (!extrema.IsDone())
@@ -374,17 +374,9 @@ bool Part::checkIntersection(const TopoDS_Shape& first, const TopoDS_Shape& seco
//non manifold condition. 1 has to be a face
for (int index = 1; index < extrema.NbSolution() + 1; ++index)
{
return true;
gp_Pnt pnt1, pnt2;
if (extrema.SupportTypeShape1(index) == BRepExtrema_IsVertex)
pnt1 = BRep_Tool::Pnt(TopoDS::Vertex(extrema.SupportOnShape1(index)));
if (extrema.SupportTypeShape2(index) == BRepExtrema_IsVertex)
pnt2 = BRep_Tool::Pnt(TopoDS::Vertex(extrema.SupportOnShape2(index)));
if (extrema.SupportTypeShape1(index) == BRepExtrema_IsInFace || extrema.SupportTypeShape2(index) == BRepExtrema_IsInFace)
return true;
}
return false;
}
else