How to use concaveman - 2 common examples

To help you get started, we’ve selected a few concaveman examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Turfjs / turf / packages / turf-convex / index.ts View on Github external
concavity?: number,
    properties?: P,
} = {}): Feature | null {
    // Default parameters
    options.concavity = options.concavity || Infinity;

    // Container
    const points: number[][] = [];

    // Convert all points to flat 2D coordinate Array
    coordEach(geojson, (coord) => {
        points.push([coord[0], coord[1]]);
    });
    if (!points.length) { return null; }

    const convexHull = concaveman(points, options.concavity);

    // Convex hull should have at least 3 different vertices in order to create a valid polygon
    if (convexHull.length > 3) {
        return polygon([convexHull]);
    }
    return null;
}

concaveman

Fast 2D concave hull algorithm in JavaScript (generates an outline of a point set)

ISC
Latest version published 3 years ago

Package Health Score

71 / 100
Full package analysis

Popular concaveman functions