Jump to content
Sign in to follow this  

How To Find Edges of a Group of Points?

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?


  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...