Merge pull request #9339 from xtemp09/path-fix
Fixed segmentation fault in Path workbench
This commit is contained in:
@@ -783,14 +783,11 @@ cSimTool::cSimTool(const TopoDS_Shape& toolShape, float res){
|
||||
|
||||
float cSimTool::GetToolProfileAt(float pos) // pos is -1..1 location along the radius of the tool (0 is center)
|
||||
{
|
||||
try{
|
||||
float radPos = std::abs(pos) * radius;
|
||||
toolShapePoint test; test.radiusPos = radPos;
|
||||
auto it = std::lower_bound(m_toolShape.begin(), m_toolShape.end(), test, toolShapePoint::less_than());
|
||||
return it->heightPos;
|
||||
}catch(...){
|
||||
return 0;
|
||||
}
|
||||
toolShapePoint test;
|
||||
test.radiusPos = std::abs(pos) * radius;
|
||||
|
||||
auto it = std::lower_bound(m_toolShape.begin(), m_toolShape.end(), test, toolShapePoint::less_than());
|
||||
return it != m_toolShape.end() ? it->heightPos : 0.0f;
|
||||
}
|
||||
|
||||
bool cSimTool::isInside(const TopoDS_Shape& toolShape, Base::Vector3d pnt, float res)
|
||||
|
||||
@@ -107,8 +107,10 @@ public:
|
||||
float GetToolProfileAt(float pos);
|
||||
bool isInside(const TopoDS_Shape& toolShape, Base::Vector3d pnt, float res);
|
||||
|
||||
std::vector< toolShapePoint > m_toolShape;
|
||||
float radius;
|
||||
/* m_toolShape has to be populated with linearly increased
|
||||
radiusPos to get the tool profile at given position */
|
||||
std::vector <toolShapePoint> m_toolShape;
|
||||
float radius;
|
||||
float length;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user