Gathering detailed insights and metrics for deyihu-geometry-extrude
Gathering detailed insights and metrics for deyihu-geometry-extrude
Gathering detailed insights and metrics for deyihu-geometry-extrude
Gathering detailed insights and metrics for deyihu-geometry-extrude
poly-extrude
Extrude polygons/polylines. Born in [maptalks.three](https://github.com/maptalks/maptalks.three) project<br>
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.
extrude-polyline
triangulates a 2D polyline into a stroke
d3-geo
Shapes and calculators for spherical coordinates.
npm install deyihu-geometry-extrude
74.6
Supply Chain
98.6
Quality
75.4
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
183 Stars
52 Commits
40 Forks
9 Watching
2 Branches
3 Contributors
Updated on 14 Nov 2024
JavaScript (95.04%)
HTML (4.96%)
Cumulative downloads
Total Downloads
Last day
-70%
27
Compared to previous day
Last week
-30.8%
200
Compared to previous week
Last month
3,088.7%
12,149
Compared to previous month
Last year
95.6%
20,603
Compared to previous year
A small and fast JavaScript library for extruding 2D polygons and polylines to 3D meshes. It depends on earcut to do triangulation.
Extrude polygons with holes.
Extrude polylines with specific line thickness.
Generate position
/ uv
/ normal
/ indices
TypedArray.
Support bevel style.
Install with npm
npm i geometry-extrude
Extrude a simple square with hole
1import {extrudePolygon} from 'geometry-extrude'; 2const squareWithHole = [ 3 [[0, 0], [10, 0], [10, 10], [0, 10]], 4 // Hole 5 [[2, 2], [8, 2], [8, 8], [2, 8]] 6]; 7const {indices, position, uv, normal} = extrudePolygon([squareWithHole], { 8 depth: 2 9});
1const {indices, position, uv, normal} = extrudePolygon(squareWithHole); 2const geometry = new clay.Geometry(); 3geometry.attributes.position.value = position; 4geometry.attributes.texcoord0.value = uv; 5geometry.attributes.normal.value = normal; 6geometry.indices = indices;
1const {indices, position, uv, normal} = extrudePolygon(squareWithHole);
2const geometry = new THREE.BufferGeometry();
3geometry.addAttribute('position', new THREE.Float32BufferAttribute(position, 3));
4geometry.addAttribute('normal', new THREE.Float32BufferAttribute(normal, 3));
5geometry.setIndex(new THREE.Uint16BufferAttribute(indices, 1));
1const {indices, position, uv, normal} = extrudePolygon(squareWithHole); 2const draw = regl({ 3 frag: `...`, 4 vert: `...`, 5 6 attributes: { 7 position: position, 8 uv: uv, 9 normal: norma 10 }, 11 12 elements: indices 13});
1extrudePolygon( 2 // polygons same with coordinates of MultiPolygon type geometry in GeoJSON 3 // See http://wiki.geojson.org/GeoJSON_draft_version_6#MultiPolygon 4 polygons: GeoJSONMultiPolygonGeometry, 5 // Options of extrude 6 opts: { 7 // Can be a constant value, or a function. 8 // Default to be 1. 9 depth?: ((idx: number) => number) | number, 10 // Size of bevel, default to be 0, which is no bevel. 11 bevelSize?: number, 12 // Segments of bevel, default to be 2. Larger value will lead to smoother bevel. 13 bevelSegments?: number, 14 // Polygon or polyline simplification tolerance. Default to be 0. 15 // Use https://www.npmjs.com/package/simplify-js to do the simplification. Same with the tolerance parameter in it. The unit is same with depth and bevelSize 16 simplify?: number, 17 // If has smooth side, default to be false. 18 smoothSide?: boolean, 19 // If has smooth bevel, default to be false. 20 smoothBevel?: boolean, 21 // If exclude bottom faces, default to be false. 22 // Usefull when bottom side can't be seen. 23 excludeBottom?: boolean, 24 // Transform the polygon to fit this rect. 25 // Will keep polygon aspect if only width or height is given. 26 fitRect?: {x?: number, y?: number, width?: number: height?: number}, 27 // Translate the polygon. Default to be [0, 0] 28 // Will be ignored if fitRect is given. 29 translate?: ArrayLike<number>, 30 // Scale the polygon. Default to be [1, 1] 31 // Will be ignored if fitRect is given. 32 scale?: ArrayLike<number> 33 } 34) => { 35 indices: Uint16Array|Uint32Array, 36 position: Float32Array, 37 normal: Float32Array, 38 uv: Float32Array, 39 boundingRect: {x: number, y: number, width: number, height: number} 40}
1extrudePolyline( 2 // polylines same with coordinates of MultiLineString type geometry in GeoJSON 3 // See http://wiki.geojson.org/GeoJSON_draft_version_6#MultiLineString 4 polylines: GeoJSONMultiLineStringGeometry, 5 // Options of extrude 6 opts: { 7 ////// Extended from opts in extrudePolygon 8 9 // Thickness of line, default to be 1 10 lineWidth?: number, 11 // default to be 2 12 miterLimit?: number 13 } 14) => { 15 indices: Uint16Array|Uint32Array, 16 position: Float32Array, 17 normal: Float32Array, 18 uv: Float32Array, 19 boundingRect: {x: number, y: number, width: number, height: number} 20}
1extrudeGeoJSON( 2 // Extrude geojson with Polygon/LineString/MultiPolygon/MultiLineString geometries. 3 geojson: GeoJSON, 4 // Options of extrude 5 opts: { 6 ////// Extended from opts in extrudePolygon 7 8 // Can be a constant value, or a function with parameter of each feature in geojson. 9 // Default to be 1. 10 depth?: ((feature: GeoJSONFeature) => number) | number 11 // Thickness of line, default to be 1 12 lineWidth?: number, 13 // default to be 2 14 miterLimit?: number 15 } 16) => { 17 // Same result with extrudePolygon 18 polygon: Object, 19 // Same result with extrudePolyline 20 polyline: Object 21}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 3/27 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More