hey
does anyone know how to create a polygon from points? i tried googling and looking through my graphics programming books but found nothing.... I can't use any library to do this need the algorithm it self.
thanks
Point To Polygon
What does "a polygon from points" mean? You have the corners of the polygon? Also in what context?
Typically a polygon IS given by its vertices ("corners"). So mathematically speaking you already have a polygon. Without further context you question doesn't make much sense.
A simple polygon you can make from a collection of points is a convex hull. The advantage of this is there is a unique solution for the set of input points, but it discards any points that are internal to the polygon. There are quite a few different algorithms for calculating a convex hull (of varying complexity and performance), so have a quick google and find an algorithm that is up to your level of expertise.
[attachment=11038:points1.png]
If you need to include all vertices, the polygon is going to be a concave hull, and you start to run into problems. Unless you know there are definite constraints on the way the vertices link up, like say a maximum distance or angle between vertices, you quickly discover there are many solutions for even a small number of vertices, doubly so if you allow self-intersection.
[attachment=11039:points2.png]
[attachment=11038:points1.png]
If you need to include all vertices, the polygon is going to be a concave hull, and you start to run into problems. Unless you know there are definite constraints on the way the vertices link up, like say a maximum distance or angle between vertices, you quickly discover there are many solutions for even a small number of vertices, doubly so if you allow self-intersection.
[attachment=11039:points2.png]
If you need to include all vertices, the polygon is going to be a concave hull, and you start to run into problems. Unless you know there are definite constraints on the way the vertices link up, like say a maximum distance or angle between vertices, you quickly discover there are many solutions for even a small number of vertices, doubly so if you allow self-intersection.
this is what i need "concave hull". is there any algorithms..?
can anyone recommend math book or game programming book that teaches these things? thanks.
or answer to this post will do as well
or answer to this post will do as well
can anyone recommend math book or game programming book that teaches these things? thanks.
or answer to this post will do as well
Well, it depends on how you want them connected. Does it matter?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement