Hi hadri1,
For the case that you showed:
You can detect 3 corner points by this method:
code:
function CountCornerPoints( crv )
{
var num_corners = 0;
/* Count 1 for each segment after the first segment. */
var segment_list = crv.getSubObjects();
var num_segments = segment_list.length;
num_corners += (num_segments - 1);
if ( !crv.isClosed )
{
/* If the curve is open add one for start point and one for end point. */
num_corners += 2;
}
else
{
/* If the curve is closed add one if it is sharp at the start/end seam point. */
var seg = segment_list.item(0);
if ( !seg.getIsG1ToAdjacentSegment(0) )
{
num_corners++;
}
}
return num_corners;
}
- Michael
|