How to use the geometry-extrude.extrudePolygon function in geometry-extrude

To help you get started, we’ve selected a few geometry-extrude 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 maptalks / maptalks.three / src / worker / index.js View on Github external
function extrudePolygons(d) {
    const { data, height } = d;
    const { position, normal, uv, indices } = extrudePolygon(
        // polygons same with coordinates of MultiPolygon type geometry in GeoJSON
        // See http://wiki.geojson.org/GeoJSON_draft_version_6#MultiPolygon
        data,
        // Options of extrude
        {
            // Can be a constant value, or a function.
            // Default to be 1.
            depth: height
        }
    );
    return { position, normal, uv, indices };
}
github maptalks / maptalks.three / src / util / ExtrudeUtil.js View on Github external
export function getExtrudeGeometryParams(polygon, height, layer, center) {
    const datas = getPolygonPositions(polygon, layer, center);
    const shapes = datas;
    //Possible later use of geojson
    if (!shapes) return null;
    height = layer.distanceToVector3(height, height).x;
    const { position, normal, uv, indices } = extrudePolygon(shapes, {
        depth: height
    });
    return {
        position, normal, uv, indices
    };
}

geometry-extrude

A small and fast JavaScript library for extruding 2D polygons and polylines to 3D meshes. It depends on [earcut](https://github.com/mapbox/earcut) to do triangulation.

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis

Similar packages