Jump to content

How To Find Edges of a Group of Points?


MrFish

Recommended Posts

You don't need any java programming knowledge for this but it's written in java so I'll post it here.unledczf.jpgI have a 2 dimensional array of point objects. Each contains a row and column variable and a list of properties for that point. Points share property lists and can be grouped by their "PointPropertyList" id. So seen above is a group of points (green points surrounded by grey) surrounded by a second group (blue points). I want to draw a polygon around these points so I need to find the edges. I can easily find the edges by just checking to see if it has a neighboring point of the same group on each side. If it doesn't then it must be an edge.The issue I have is that after finding the edges and adding it to an array of other edge points- it is unordered. So I need to order the points so I can use Graphics2D to draw a polygon around them.tl;dr:Given an array of edge pointsHow can I determine the correct order of points from an unordered array of points?How can I determine if the shape is concave or convex?

0,0,0,0,0,0,0,0,0,00,1,1,0,0,0,0,0,0,00,0,1,1,0,0,0,0,0,00,0,1,1,0,0,0,0,0,00,0,0,0,0,0,0,0,0,00,0,0,0,0,0,0,0,0,00,0,0,0,0,0,0,0,0,00,0,0,0,0,0,0,0,0,00,0,0,0,0,0,0,0,0,00,0,0,0,0,0,0,0,0,0

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...