I am trying to implement “add point” and “remove segment” features for a GoPolygon object using a context menu.For this , I need to determine the points(their indexes) which defines the closest polygon segment to a specific point inside the polygon bounds.
Do you have any suggestion on this ?
Thanks a lot
Well, I was about to suggest that GetSegmentNearPoint might be useful, until I checked and was surprised to find that that method doesn’t exist on GoPolygon, but only on GoStroke.
I suppose for true polygons, you can implement this yourself pretty easily by using the static method GoStroke.NearestPointOnLine. If you have “polyBeziers”, then it would be easiest to construct a Bezier-style GoStroke, copy all the points over, and then call GoStroke.GetSegmentNearPoint.
Thanks for pointing out that missing little feature.
Thanks for your reply. I solved this by adding a dummy GoStroke over the polygon’s segments and using the GoStroke’s methods.