4 kyu

Compute a convex hull

297 of 433dustryder

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 Trained2682
Total Skips954
Total Code Submissions6995
Total Times Completed433
Python Completions297
JavaScript Completions94
Ruby Completions28
Haskell Completions27
Elixir Completions14
Total Stars125
% of votes with a positive feedback rating98% of 116
Total "Very Satisfied" Votes112
Total "Somewhat Satisfied" Votes3
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