Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

three-conic-polygon-geometry

Package Overview
Dependencies
Maintainers
0
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three-conic-polygon-geometry - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

8

dist/three-conic-polygon-geometry.d.ts

@@ -7,4 +7,4 @@ import { BufferGeometry } from 'three';

polygonGeoJson: PolygonCoords,
startHeight: number,
endHeight: number,
bottomHeight: number | ((lng: number, lat: number) => number),
topHeight: number | ((lng: number, lat: number) => number),
closedBottom: boolean,

@@ -19,4 +19,4 @@ closedTop: boolean,

polygonGeoJson: PolygonCoords,
startHeight?: number,
endHeight?: number,
bottomHeight?: number | ((lng: number, lat: number) => number),
topHeight?: number | ((lng: number, lat: number) => number),
closedBottom?: boolean,

@@ -23,0 +23,0 @@ closedTop?: boolean,

{
"name": "three-conic-polygon-geometry",
"version": "2.0.2",
"version": "2.1.0",
"description": "ThreeJS geometry for drawing polygons on a sphere",

@@ -48,3 +48,3 @@ "type": "module",

"dependencies": {
"@turf/boolean-point-in-polygon": "^7.1",
"@turf/boolean-point-in-polygon": "^7.2",
"d3-array": "1 - 3",

@@ -64,10 +64,10 @@ "d3-geo": "1 - 3",

"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-terser": "^0.4.4",
"@types/three": ">=0.72.0",
"rimraf": "^6.0.1",
"rollup": "^4.28.1",
"rollup": "^4.30.1",
"rollup-plugin-dts": "^6.1.1",
"typescript": "^5.7.2"
"typescript": "^5.7.3"
},

@@ -74,0 +74,0 @@ "engines": {

@@ -43,4 +43,4 @@ ThreeJS Conic Polygon Geometry

* <b>polygonGeoJson</b>: Coordinates array as specified in GeoJson `geometry.coordinates` for `type: Polygon`. The first item is the polygon contour, additional items are the inner holes. It's recommended to split the geometries at the [anti-meridian](https://en.wikipedia.org/wiki/180th_meridian).
* <b>bottomHeight</b>: Starting height of the cone. Default is `0`.
* <b>topHeight</b>: Ending height of the cone. Default is `1`.
* <b>bottomHeight</b>: Starting height of the cone. Can be either a constant or `(lng, lat) => height` accessor function that is invoked for every vertex in the bottom surface. Default is `0`.
* <b>topHeight</b>: Ending height of the cone. Can be either a constant or `(lng, lat) => height` accessor function that is invoked for every vertex in the top surface. Default is `1`.
* <b>closedBottom</b>: Whether to add a cap surface on the cone bottom. Default is `true`.

@@ -47,0 +47,0 @@ * <b>closedTop</b>: Whether to add a cap surface on the cone top. Default is `true`.

@@ -7,4 +7,4 @@ import { BufferGeometry } from 'three';

polygonGeoJson: PolygonCoords,
startHeight: number,
endHeight: number,
bottomHeight: number | ((lng: number, lat: number) => number),
topHeight: number | ((lng: number, lat: number) => number),
closedBottom: boolean,

@@ -19,4 +19,4 @@ closedTop: boolean,

polygonGeoJson: PolygonCoords,
startHeight?: number,
endHeight?: number,
bottomHeight?: number | ((lng: number, lat: number) => number),
topHeight?: number | ((lng: number, lat: number) => number),
closedBottom?: boolean,

@@ -23,0 +23,0 @@ closedTop?: boolean,

@@ -22,3 +22,3 @@ import {

class ConicPolygonGeometry extends THREE.BufferGeometry {
constructor(polygonGeoJson, startHeight, endHeight, closedBottom, closedTop, includeSides, curvatureResolution) {
constructor(polygonGeoJson, bottomHeight, topHeight, closedBottom, closedTop, includeSides, curvatureResolution) {
super();

@@ -30,4 +30,4 @@

polygonGeoJson,
startHeight,
endHeight,
bottomHeight,
topHeight,
closedBottom,

@@ -40,4 +40,4 @@ closedTop,

// defaults
startHeight = startHeight || 0;
endHeight = endHeight || 1;
bottomHeight = bottomHeight || 0;
topHeight = topHeight || 1;
closedBottom = closedBottom !== undefined ? closedBottom : true;

@@ -69,4 +69,4 @@ closedTop = closedTop !== undefined ? closedTop : true;

includeSides && addGroup(generateTorso());
closedBottom && addGroup(generateCap(startHeight, false));
closedTop && addGroup(generateCap(endHeight, true));
closedBottom && addGroup(generateCap(bottomHeight, false));
closedTop && addGroup(generateCap(topHeight, true));

@@ -84,3 +84,4 @@ // build geometry

function generateVertices(polygon, altitude) {
const coords3d = polygon.map(coords => coords.map(([lng, lat]) => polar2Cartesian(lat, lng, altitude)));
const altFn = typeof altitude === 'function' ? altitude : () => altitude;
const coords3d = polygon.map(coords => coords.map(([lng, lat]) => polar2Cartesian(lat, lng, altFn(lng, lat))));
// returns { vertices, holes, coordinates }. Each point generates 3 vertice items (x,y,z).

@@ -91,4 +92,4 @@ return earcutFlatten(coords3d);

function generateTorso() {
const {vertices: bottomVerts, holes} = generateVertices(contour, startHeight);
const {vertices: topVerts} = generateVertices(contour, endHeight);
const {vertices: bottomVerts, holes} = generateVertices(contour, bottomHeight);
const {vertices: topVerts} = generateVertices(contour, topHeight);

@@ -95,0 +96,0 @@ const vertices = flatten([topVerts, bottomVerts]);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc