1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0030829: BRepExtrema_ShapeProximity crashes with shape from STL/WRL

The fix makes algorithm independent on geometrical data. Only triangulation is needed for its work.
This commit is contained in:
msv 2019-07-17 16:50:43 +03:00 committed by bugmaster
parent 718d07fe5e
commit 7c08e3ac6e
3 changed files with 20 additions and 15 deletions

View File

@ -16,10 +16,8 @@
#include <BRepExtrema_TriangleSet.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BVH_LinearBuilder.hxx>
#include <Poly_Triangulation.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)
@ -152,9 +150,6 @@ void BRepExtrema_TriangleSet::Clear()
BVH_Array4i anEmptyTriangles;
myTriangles.swap (anEmptyTriangles);
BVH_Array2d anEmptyVertUVArray;
myVertUVArray.swap (anEmptyVertUVArray);
BVH_Array3d anEmptyVertexArray;
myVertexArray.swap (anEmptyVertexArray);
}
@ -179,8 +174,6 @@ Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& the
return Standard_False;
}
BRepAdaptor_Surface aFaceAdaptor (theFaces (aFaceIdx), Standard_False);
const Standard_Integer aVertOffset =
static_cast<Standard_Integer> (myVertexArray.size()) - 1;
@ -193,11 +186,6 @@ Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& the
myVertexArray.push_back (BVH_Vec3d (aVertex.X(),
aVertex.Y(),
aVertex.Z()));
const Standard_Real aU = aTriangulation->UVNodes().Value (aVertIdx).X();
const Standard_Real aV = aTriangulation->UVNodes().Value (aVertIdx).Y();
myVertUVArray.push_back (BVH_Vec2d (aU, aV));
}
for (Standard_Integer aTriIdx = 1; aTriIdx <= aTriangulation->NbTriangles(); ++aTriIdx)

View File

@ -75,9 +75,6 @@ protected:
//! Array of vertex indices.
BVH_Array4i myTriangles;
//! Array of vertex UV params.
BVH_Array2d myVertUVArray;
//! Array of vertex coordinates.
BVH_Array3d myVertexArray;

View File

@ -0,0 +1,20 @@
puts "========"
puts "0030829: BRepExtrema_ShapeProximity crashes with shape from STL/WRL"
puts "========"
puts ""
pload XSDRAW
box b 10 10 10
pcylinder c 5 10
incmesh b 0.1
incmesh c 0.1
writestl b ${imagedir}/${test_image}_b.stl
writestl c ${imagedir}/${test_image}_c.stl
readstl b ${imagedir}/${test_image}_b.stl
readstl c ${imagedir}/${test_image}_c.stl
file delete ${imagedir}/${test_image}_b.stl
file delete ${imagedir}/${test_image}_c.stl
proximity b c