Convex hull area
Description:
Let's say you have a bunch of points, and you want to round them all up and calculate the area of the smallest polygon containing all of the points (nevermind why, you just want a challenge). What you're looking for is the area of the convex hull of these points. Here is an example, delimited in blue :
Your task
Implement a function that will compute the area covered by the convex hull that can be formed from an array of points, the area being rounded to two decimal places. The points are given as (x,y)
, like in an orthonormal coordinates system.
points = [(0, 0), (0, 3), (4, 0)]
convex_hull_area(points) == 6.00
Note : In Python, the scipy module has a ready made solution for this. Of course, if you use it here, you are lame.
P. S. : If you enjoy this kata, you may also like this one, which asks you to compute a convex hull, without finding its area.
Similar Kata:
Stats:
Created | Sep 20, 2017 |
Published | Sep 25, 2017 |
Warriors Trained | 958 |
Total Skips | 444 |
Total Code Submissions | 906 |
Total Times Completed | 177 |
Python Completions | 134 |
Java Completions | 46 |
Total Stars | 35 |
% of votes with a positive feedback rating | 93% of 69 |
Total "Very Satisfied" Votes | 62 |
Total "Somewhat Satisfied" Votes | 4 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 3 |
Average Assessed Rank | 4 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 5 kyu |