Algorithm:
- Sorts points based on their X coordinate,
- Selects two points which contain minimum and maximum of X coordinate (P1, P2) from all points,
- Divides the set of points into two sub-sets (upper and lower hull) based on the line between point P1 and point P2,
- Processes points on per hull basis to detect points which have to be used to create a convex polygon.
Example of usage:
Source code: ConvexHullAlgorithm.zip
Useful links:
wtf is that weird video..
ReplyDelete