npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

poly-extrude

v0.22.2

Published

extrude polyline/polygon etc

Readme

poly-extrude

Extrude polygons/polylines. Born in maptalks.three project

Install

NPM

npm i poly-extrude

CDN

<script type="text/javascript" src="https://unpkg.com/poly-extrude/dist/poly-extrude.js"></script>

Use

  import {
      polygons,
      extrudePolygons,
      extrudePolygonsOnPath,
      extrudePolylines,
      cylinder,
      expandPaths,
      extrudeSlopes,
      expandTubes,
      plane
  } from 'poly-extrude';

  //if you use cdn,the namespace is polyextrude

  //   const {
  //       extrudePolygons,
  //       extrudePolylines
  //   } = window.polyextrude;

  const polygons = [
      //polygon
      [
          //outring
          [
              [x, y],
              [x, y],
              ...........
          ],
          //holes
          [
              [x, y],
              [x, y], ...........
          ],
          ........

      ],
      //other polygons
      ......
  ];

  const polylines = [
      // polyline
      [
          [x, y],
          [x, y],
          ...........
      ],
      //polyline
      [
          [x, y],
          [x, y],
          ...........
      ],
  ];

  const result = extrudePolygons(polygons, {
      depth: 2
  });
  const {
      positon,
      normal,
      uv,
      indices
  } = result;
  //do something

API

extrudePolygons(polygons, options)

  • polygons
  • options.depth
  • options.top Whether to display the top
  const result = extrudePolygons(polygons, {
      depth: 2
  });
  const {
      positon,
      normal,
      uv,
      indices
  } = result;
  //do something

building
buildings
china
muti polygon
ny buildings
custom shape


extrudePolygonsOnPath(polygons, options)

  • polygons
  • options.extrudePath is line
  • options.openEnd
  • options.openEndUV
  • options.polygonRotation
  const result = extrudePolygonsOnPath(polygons, {
      extrudePath: [
          [0, 0],
          [100, 0]
      ]
  });
  const {
      positon,
      normal,
      uv,
      indices
  } = result;
  //do something

base demo
wireframe demo
with holes
with holes by custom shape
polygonRotation
extrude along spring
extrude taihu lake
extrude by curve


extrudePolylines(lines, options)

  • lines
  • options.depth
  • options.lineWidth
  • options.bottomStickGround Is the bottom attached to the ground
  • options.pathUV generate Path UV
   const result = extrudePolylines(polylines, {
       depth: 2,
       lineWidth: 2
   });
   const {
       positon,
       normal,
       uv,
       indices
   } = result;
   //do something

line
line uv
line pathUV
line cutcorner
brige
brige bottomStickGround
extrude brige
spring
wall
street


cylinder(center, options)

  • center
  • options.radius
  • options.height
  • options.radialSegments
const center = [0, 0];
const result = cylinder(center, {

    radius: 1,
    height: 2,
    radialSegments: 6

});
const {
    positon,
    normal,
    uv,
    indices

} = result;
//do something

cylinder


expandPaths(lines, options)

  • lines
  • options.lineWidth
const result = expandPaths(polylines, {

    cornerRadius: 0.5,
    lineWidth: 2

});
const {

    positon,
    normal,
    uv,
    indices

} = result;
//do something

paths
street paths
brige paths


extrudeSlopes(lines, options)

  • lines
  • options.depth
  • options.lineWidth
  • options.side Which side serves as the slope, 'left' or 'right'
  • options.sideDepth slope depth
  • options.bottomStickGround Is the bottom attached to the ground
  • options.pathUV generate Path UV
const result = extrudeSlopes(polylines, {

    depth: 1,
    side: 'left',
    sideDepth: 0,
    lineWidth: 2

});
const {

    positon,
    normal,
    uv,
    indices

} = result;
//do something

slope
extrudeSlopes pathUV demo


expandTubes(lines, options)

  • lines
  • options.radius
  • options.radialSegments
const result = expandTubes(polylines, {

    radius: 1,
    radialSegments: 8

});
const {

    positon,
    normal,
    uv,
    indices

} = result;
//do something

tube


plane(width, height,devideW,devideH)

  • width
  • height
  • devideW
  • devideH
const result = plane(100, 100, 10, 10);
const {

    positon,
    normal,
    uv,
    indices

} = result;
//do something

plane demo
custom terrain demo


polygons(polygons, options)

  • polygons
  const result = polygons(polygons, {

  });
  const {
      positon,
      normal,
      uv,
      indices
  } = result;
  //do something

polygons demo