/Jarvis-March-Algorithm

Jarvis' March or Gift Wrapping algorithm to calculate convex hull.

Primary LanguagePython

Jarvis March or Gift Wrapping Algorithm

Given a set of points in the plane. the convex hull of the set is the smallest convex polygon that contains all the points of it. Jarvis March is one of many algorithm to compute a convex hull.

Below are some examples of how the algorithm works.

Demonstration

10 points 30 points 50 points

10 points                                 30 points                                    50 points

Usage

python3 jarvis.py

Optional Parameters --save : Writes the final image on disk. --visualize : Shows the process of the algorithm through a series of images. num_of_points : Define the number of points that should be generated. Minimum value is 3. img_height : Define the height of the image. img_width : Define the width of the image. padding : Define the padding value. Padding is used to control the how close the generated points should be to the borders of the image.

License

MIT