4 kyu

Compute a convex hull

301 of 439dustryder

Description:

The Problem

Consider a flat board with pegs sticking out of one side. If you stretched a rubber band across the outermost pegs what is the set of pegs such that all other pegs are contained within the shape formed by the rubber band?

alt text

More specifically, for this kata you will be given a list of points represented as [x,y] co-ordinates. Your aim will be to return a sublist containing points that form the perimeter of a polygon that encloses all other points contained within the original list.

Notes:

The tests may include duplicate and/or co-linear points. Co-linear points are a set of points which fall on the same straight line. Neither should be included in your returned sublist

For simplicity, there will always be at least 3 points

Help:

Check out wikipedia's page on convex hulls

Note for python users: scipy module has been disabled.

Algorithms
Geometry

Stats:

CreatedNov 27, 2015
PublishedDec 3, 2015
Warriors Trained2691
Total Skips956
Total Code Submissions7021
Total Times Completed439
Python Completions301
JavaScript Completions95
Ruby Completions29
Haskell Completions27
Elixir Completions14
Total Stars126
% of votes with a positive feedback rating97% of 117
Total "Very Satisfied" Votes112
Total "Somewhat Satisfied" Votes4
Total "Not Satisfied" Votes1
Total Rank Assessments6
Average Assessed Rank
3 kyu
Highest Assessed Rank
3 kyu
Lowest Assessed Rank
5 kyu
Ad
Contributors
  • dustryder Avatar
  • smile67 Avatar
  • narayanswa30663 Avatar
  • JohanWiltink Avatar
  • Blind4Basics Avatar
  • Voile Avatar
  • FArekkusu Avatar
  • MobulaKuhlii Avatar
  • saudiGuy Avatar
Ad