extract information regarding an object (Details)
All  1-6  7-8

Previous
Next
 From:  Michael Gibson
12081.7 In reply to 12081.6 
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
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Zooen
12081.8 In reply to 12081.6 
Hi hadri1,
That’s because you’re selecting the curve and the points at the same time. If you only select the curve, you’ll see other information, including the segments.
The end points are not corner points, which makes sense to me. Furthermore, if, for a selected curve, the Properties panel shows you 2 segments (even if you can’t see them visually), this indicates that you have 1 corner point on your curve.

I’m adding a curve with 3 segments, so 2 corner points (and 2 end points that are not corner points).

- Zooen

EDITED: 24 Aug 8:13 by ZOOEN

Image Attachments:
Size: 358.8 KB, Downloaded: 7 times, Dimensions: 2560x1437px
Size: 392.8 KB, Downloaded: 7 times, Dimensions: 2560x1437px
Size: 375.8 KB, Downloaded: 8 times, Dimensions: 2560x1437px
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-6  7-8