Latest 1.0.1
Homepage https://github.com/SanyM/ConcaveHull
License MIT
Platforms ios 8.0
Authors

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

CI Status
Version
License
Platform

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
it, simply add the following line to your Podfile:

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",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "SanyM": "[email protected]"
    },
    "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"
}

Pin It on Pinterest

Share This