本文整理汇总了C++中PointSet::extractShape方法的典型用法代码示例。如果您正苦于以下问题:C++ PointSet::extractShape方法的具体用法?C++ PointSet::extractShape怎么用?C++ PointSet::extractShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointSet
的用法示例。
在下文中一共展示了PointSet::extractShape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: splitPolygons
//.........这里部分代码省略.........
//error - it should intersect the line
}
}
isValid = true;
double pointX, pointY;
if ( ps == pe )
{
pointX = x[pe];
pointY = y[pe];
}
else
{
pointX = ptx;
pointY = pty;
}
for ( k = cHull[holeS]; k != cHull[holeE]; k = ( k + 1 ) % nbp )
{
l = ( k + 1 ) % nbp;
if ( GeomFunction::isSegIntersects( x[retainedPt], y[retainedPt], pointX, pointY, x[k], y[k], x[l], y[l] ) )
{
isValid = false;
break;
}
}
if ( isValid && b < c )
{
c = b;
fps = ps;
fpe = pe;
fptx = ptx;
fpty = pty;
}
} // for point which are not in hole
// we will cut the shapeu in two new shapes, one from [retainedPoint] to [newPoint] and one form [newPoint] to [retainedPoint]
int imin = retainedPt;
int imax = ( ( ( fps < retainedPt && fpe < retainedPt ) || ( fps > retainedPt && fpe > retainedPt ) ) ? std::min( fps, fpe ) : std::max( fps, fpe ) );
int nbPtSh1, nbPtSh2; // how many points in new shapes ?
if ( imax > imin )
nbPtSh1 = imax - imin + 1 + ( fpe != fps );
else
nbPtSh1 = imax + nbp - imin + 1 + ( fpe != fps );
if ( ( imax == fps ? fpe : fps ) < imin )
nbPtSh2 = imin - ( imax == fps ? fpe : fps ) + 1 + ( fpe != fps );
else
nbPtSh2 = imin + nbp - ( imax == fps ? fpe : fps ) + 1 + ( fpe != fps );
if ( retainedPt == -1 || fps == -1 || fpe == -1 )
{
if ( shape->parent )
delete shape;
}
// check for useless spliting
else if ( imax == imin || nbPtSh1 <= 2 || nbPtSh2 <= 2 || nbPtSh1 == nbp || nbPtSh2 == nbp )
{
shapes_final.append( shape );
}
else
{
PointSet *newShape = shape->extractShape( nbPtSh1, imin, imax, fps, fpe, fptx, fpty );
if ( shape->parent )
newShape->parent = shape->parent;
else
newShape->parent = shape;
shapes_toProcess.append( newShape );
if ( imax == fps )
imax = fpe;
else
imax = fps;
newShape = shape->extractShape( nbPtSh2, imax, imin, fps, fpe, fptx, fpty );
if ( shape->parent )
newShape->parent = shape->parent;
else
newShape->parent = shape;
shapes_toProcess.append( newShape );
if ( shape->parent )
delete shape;
}
}
else
{
shapes_final.append( shape );
}
delete[] pts;
}
}