Git Product home page Git Product logo

concavehull's Introduction

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

Determining an appropriate concavity parameter value

Concavity determines the hull's maximum edge length.

  • Calculate the diameter of your dataset.
  • Start experimenting with: concavity = diameter / 5.

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"

concavehull's People

Contributors

gerdc avatar sanym avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.