添加错误判断:返回值为-1时
This commit is contained in:
parent
ec210c520d
commit
3076a17c18
@ -410,8 +410,18 @@ SSX_BQworkpieceResult sx_BQ_getWorkpieceCorners(
|
||||
SVzNL3DPoint firstPt = region[0].edge[0];
|
||||
SVzNL3DPoint lastPt = region[0].edge.back();
|
||||
int idx0 = _getPointClosestContour(v_trees, true, firstPt, scanLines, true);
|
||||
if (idx0 < 0)
|
||||
{
|
||||
*errCode = SX_ERR_INVLD_CLOSES_PT;
|
||||
return;
|
||||
}
|
||||
_getEdgeLinkingContour(&v_trees[idx0], true, firstPt, region[0].edgeLink_1, scanLines, true, workpieceParam.lineLen);
|
||||
int idx1 = _getPointClosestContour(v_trees, true, lastPt, scanLines, true);
|
||||
if (idx1 < 0)
|
||||
{
|
||||
*errCode = SX_ERR_INVLD_CLOSES_PT;
|
||||
return;
|
||||
}
|
||||
_getEdgeLinkingContour(&v_trees[idx1], true, lastPt, region[0].edgeLink_2, scanLines, true, workpieceParam.lineLen);
|
||||
if ((region[0].edgeLink_1.size() < 5) || (region[0].edgeLink_2.size() < 5))
|
||||
{
|
||||
@ -425,8 +435,18 @@ SSX_BQworkpieceResult sx_BQ_getWorkpieceCorners(
|
||||
firstPt = region[1].edge[0];
|
||||
lastPt = region[1].edge.back();
|
||||
idx0 = _getPointClosestContour(h_trees, false, firstPt, scanLines, true);
|
||||
if (idx0 < 0)
|
||||
{
|
||||
*errCode = SX_ERR_INVLD_CLOSES_PT;
|
||||
return;
|
||||
}
|
||||
_getEdgeLinkingContour(&h_trees[idx0], false, firstPt, region[1].edgeLink_1, scanLines, true, workpieceParam.lineLen);
|
||||
idx1 = _getPointClosestContour(h_trees, false, lastPt, scanLines, true);
|
||||
if (idx1 < 0)
|
||||
{
|
||||
*errCode = SX_ERR_INVLD_CLOSES_PT;
|
||||
return;
|
||||
}
|
||||
_getEdgeLinkingContour(&h_trees[idx1], false, lastPt, region[1].edgeLink_2, scanLines, true, workpieceParam.lineLen);
|
||||
if ((region[1].edgeLink_1.size() < 5) || (region[1].edgeLink_2.size() < 5))
|
||||
{
|
||||
@ -439,8 +459,18 @@ SSX_BQworkpieceResult sx_BQ_getWorkpieceCorners(
|
||||
firstPt = region[2].edge[0];
|
||||
lastPt = region[2].edge.back();
|
||||
idx0 = _getPointClosestContour(v_trees, true, firstPt, scanLines, false);
|
||||
if (idx0 < 0)
|
||||
{
|
||||
*errCode = SX_ERR_INVLD_CLOSES_PT;
|
||||
return;
|
||||
}
|
||||
_getEdgeLinkingContour(&v_trees[idx0], true, firstPt, region[2].edgeLink_1, scanLines, false, workpieceParam.lineLen);
|
||||
idx1 = _getPointClosestContour(v_trees, true, lastPt, scanLines, false);
|
||||
if (idx1 < 0)
|
||||
{
|
||||
*errCode = SX_ERR_INVLD_CLOSES_PT;
|
||||
return;
|
||||
}
|
||||
_getEdgeLinkingContour(&v_trees[idx1], true, lastPt, region[2].edgeLink_2, scanLines, false, workpieceParam.lineLen);
|
||||
if ((region[2].edgeLink_1.size() < 5) || (region[2].edgeLink_2.size() < 5))
|
||||
{
|
||||
@ -453,8 +483,18 @@ SSX_BQworkpieceResult sx_BQ_getWorkpieceCorners(
|
||||
firstPt = region[3].edge[0];
|
||||
lastPt = region[3].edge.back();
|
||||
idx0 = _getPointClosestContour(h_trees, false, firstPt, scanLines, true);
|
||||
if (idx0 < 0)
|
||||
{
|
||||
*errCode = SX_ERR_INVLD_CLOSES_PT;
|
||||
return;
|
||||
}
|
||||
_getEdgeLinkingContour(&h_trees[idx0], false, firstPt, region[3].edgeLink_1, scanLines, false, workpieceParam.lineLen);
|
||||
idx1 = _getPointClosestContour(h_trees, false, lastPt, scanLines, true);
|
||||
if (idx1 < 0)
|
||||
{
|
||||
*errCode = SX_ERR_INVLD_CLOSES_PT;
|
||||
return;
|
||||
}
|
||||
_getEdgeLinkingContour(&h_trees[idx1], false, lastPt, region[3].edgeLink_2, scanLines, false, workpieceParam.lineLen);
|
||||
if ((region[3].edgeLink_1.size() < 5) || (region[3].edgeLink_2.size() < 5))
|
||||
{
|
||||
|
||||
@ -11,3 +11,4 @@
|
||||
#define SX_ERR_INVLD_VTREE_NUM -2001
|
||||
#define SX_ERR_INVLD_HTREE_NUM -2002
|
||||
#define SX_ERR_INVLD_EDGE_LINK_NUM -2003
|
||||
#define SX_ERR_INVLD_CLOSES_PT -2004
|
||||
Loading…
x
Reference in New Issue
Block a user