Select Page
Latest 1.0.1 https://github.com/SanyM/ConcaveHull MIT ios 8.0 SanyM

# ConcaveHull – A Swift Library that builds concave hull by set of points

## Usage

``````let points = [[162, 332], [182, 299], [141, 292], [158, 264], ... ];
let h = Hull(concavity: 50)
let hull = h.hull(points, nil)``````

## Params

public func hull( pointSet: [Any], concavity: Double?, _ format: [String]?) -> [Any] {

• 1st param – array of coordinates in format: `[Any]`, `[Any]` can be [[Int]], [[Double]], [[String: Int]], [[String: Double]];
• 2nd param – concavity. `1` – thin shape. `Infinity` – convex hull. By default `20`;
• 3rd param – the format of the array of coordinates For example: `["lng", "lat"]` if you have `["lng": x, "lat": y]` points. If your are using [[Int]] or [[Double]], the value can be nil

## How it works

This step by step guide was taken as the original code from https://github.com/AndriiHeonia/hull
Let’s see step by step what happens when you call `hull()` function:

1. Hull.js takes your source points of the shape:
2. Builds convex hull:
3. After that, the edges flex inward (according to the `concavity` param). For example:

`concavity = 80`

`concavity = 40`

`concavity = 20`

## Installation

ConcaveHull is available through CocoaPods. To install

``pod "ConcaveHull"``

### Latest podspec

```{
"name": "ConcaveHull",
"version": "1.0.1",
"summary": "A Swift Library that builds concave or convexe hull by set of points",
"description": "Concave hull is a simple library that generate the hull of a set of points, the points cannbe of any format, the concavity of the hull is defined by a parameter if the function. nTo create the Hull, just call Hull().hull(pointSet, Concavity, format or nil)",
"homepage": "https://github.com/SanyM/ConcaveHull",
"type": "MIT",
},
"authors": {
"SanyM": "[email protected]/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */"
},
"source": {
"git": "https://github.com/SanyM/ConcaveHull.git",
"tag": "1.0.1"
},
"platforms": {
"ios": "8.0"
},
"source_files": "ConcaveHull/Classes/**/*",
"pushed_with_swift_version": "3.0"
}```