mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +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:
parent
718d07fe5e
commit
7c08e3ac6e
@ -16,10 +16,8 @@
|
|||||||
#include <BRepExtrema_TriangleSet.hxx>
|
#include <BRepExtrema_TriangleSet.hxx>
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <BRepAdaptor_Surface.hxx>
|
|
||||||
#include <BVH_LinearBuilder.hxx>
|
#include <BVH_LinearBuilder.hxx>
|
||||||
#include <Poly_Triangulation.hxx>
|
#include <Poly_Triangulation.hxx>
|
||||||
#include <TColgp_Array1OfPnt2d.hxx>
|
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)
|
IMPLEMENT_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)
|
||||||
|
|
||||||
@ -152,9 +150,6 @@ void BRepExtrema_TriangleSet::Clear()
|
|||||||
BVH_Array4i anEmptyTriangles;
|
BVH_Array4i anEmptyTriangles;
|
||||||
myTriangles.swap (anEmptyTriangles);
|
myTriangles.swap (anEmptyTriangles);
|
||||||
|
|
||||||
BVH_Array2d anEmptyVertUVArray;
|
|
||||||
myVertUVArray.swap (anEmptyVertUVArray);
|
|
||||||
|
|
||||||
BVH_Array3d anEmptyVertexArray;
|
BVH_Array3d anEmptyVertexArray;
|
||||||
myVertexArray.swap (anEmptyVertexArray);
|
myVertexArray.swap (anEmptyVertexArray);
|
||||||
}
|
}
|
||||||
@ -179,8 +174,6 @@ Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& the
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
BRepAdaptor_Surface aFaceAdaptor (theFaces (aFaceIdx), Standard_False);
|
|
||||||
|
|
||||||
const Standard_Integer aVertOffset =
|
const Standard_Integer aVertOffset =
|
||||||
static_cast<Standard_Integer> (myVertexArray.size()) - 1;
|
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(),
|
myVertexArray.push_back (BVH_Vec3d (aVertex.X(),
|
||||||
aVertex.Y(),
|
aVertex.Y(),
|
||||||
aVertex.Z()));
|
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)
|
for (Standard_Integer aTriIdx = 1; aTriIdx <= aTriangulation->NbTriangles(); ++aTriIdx)
|
||||||
|
@ -75,9 +75,6 @@ protected:
|
|||||||
//! Array of vertex indices.
|
//! Array of vertex indices.
|
||||||
BVH_Array4i myTriangles;
|
BVH_Array4i myTriangles;
|
||||||
|
|
||||||
//! Array of vertex UV params.
|
|
||||||
BVH_Array2d myVertUVArray;
|
|
||||||
|
|
||||||
//! Array of vertex coordinates.
|
//! Array of vertex coordinates.
|
||||||
BVH_Array3d myVertexArray;
|
BVH_Array3d myVertexArray;
|
||||||
|
|
||||||
|
20
tests/bugs/modalg_7/bug30829
Normal file
20
tests/bugs/modalg_7/bug30829
Normal 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
|
Loading…
x
Reference in New Issue
Block a user