Archived issue #0030829
BRepExtrema_ShapeProximity crashes with shape from STL/WRL
Description
BRepExtrema_ShapeProximity() method crashes when I try to use shapes that are loaded from stl or wrl files.
It works well with IGES/STEP.
It works well with IGES/STEP.
Steps to reproduce
Any proximity check with shapes that don't have topological information but only meshed triangles
test bugs modalg_7 bug30829
test bugs modalg_7 bug30829
Additional information
I have check the involved classes and there are 3 steps that needs topological information to be executed. The meshed object loaded from stl and wrl don't have this information and the classes crashes.
In particular there are 3 classes involved :
BRepExtrema_ShapeProximity, BRepExtrema_TriangleSet and BRepExtrema_OverlapTool.
The crash is in BRepExtrema_TriangleSet::Init() method called from BRepExtrema_ShapeProximity.
The crash can be avoid by commenting the line :
//BRepAdaptor_Surface aFaceAdaptor (theFaces (aFaceIdx), Standard_False);
N.B. aFaceAdaptor is never used in this method !!!
and 3 other lines:
//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));
N.B. loading myVertUVArray is not mandatory.
By doing these changes the BRepExtrema_ShapeProximity() class can check proximity also for stl and wrl files.
I attach the modified class that I have used to check the right working.
In particular there are 3 classes involved :
BRepExtrema_ShapeProximity, BRepExtrema_TriangleSet and BRepExtrema_OverlapTool.
The crash is in BRepExtrema_TriangleSet::Init() method called from BRepExtrema_ShapeProximity.
The crash can be avoid by commenting the line :
//BRepAdaptor_Surface aFaceAdaptor (theFaces (aFaceIdx), Standard_False);
N.B. aFaceAdaptor is never used in this method !!!
and 3 other lines:
//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));
N.B. loading myVertUVArray is not mandatory.
By doing these changes the BRepExtrema_ShapeProximity() class can check proximity also for stl and wrl files.
I attach the modified class that I have used to check the right working.
Public activity
8 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: msv
Date: Wed Jul 17 16:50:43 2019 +0300
0030829: BRepExtrema_ShapeProximity crashes with shape from STL/WRL
The fix makes algorithm independent on geometrical data. Only triangulation is needed for its work.
[revision removed]
Detailed log of new commits:
Author: msv
Date: Wed Jul 17 16:50:43 2019 +0300
0030829: BRepExtrema_ShapeProximity crashes with shape from STL/WRL
The fix makes algorithm independent on geometrical data. Only triangulation is needed for its work.
No remarks.
Although filling myVertexArray.push_back()/myTriangles.push_back() without pre-pass resizing arrays looks strange.
Although filling myVertexArray.push_back()/myTriangles.push_back() without pre-pass resizing arrays looks strange.
Test bug30829 does not pass.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Test case corrected.
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian80-64:
OCCT
Total CPU difference: 10675.620000000086 / 10681.040000000101 [-0.05%]
Products
---
Windows-64-VC14:
OCCT
Total CPU difference: 17644.9375 / 17623.078125 [+0.12%]
Products
Total CPU difference: 12086.46875 / 12058.53125 [+0.23%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian80-64:
OCCT
Total CPU difference: 10675.620000000086 / 10681.040000000101 [-0.05%]
Products
---
Windows-64-VC14:
OCCT
Total CPU difference: 17644.9375 / 17623.078125 [+0.12%]
Products
Total CPU difference: 12086.46875 / 12058.53125 [+0.23%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Related records