delaunay.js 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delaunay.js",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Delaunay triangulation using the Bowyer-Watson algorithm, in JavaScript ",
5
5
  "keywords": [
6
6
  "triangulation",
@@ -21,9 +21,12 @@
21
21
  "license": "MIT",
22
22
  "author": "Johan Karlsson (DonKarlssonSan)",
23
23
  "type": "module",
24
- "main": "bowyer-watson.js",
24
+ "main": "src/bowyer-watson.js",
25
+ "files": [
26
+ "src/"
27
+ ],
25
28
  "scripts": {
26
- "test": "node test.js"
29
+ "test": "node test/test.js"
27
30
  },
28
31
  "dependencies": {
29
32
  "vectory-lib": "^0.0.7"
package/readme.md CHANGED
@@ -1,9 +1,12 @@
1
+ ![alt text](doc/image.png)
2
+
1
3
  # About
2
4
  This is a JavaScript library for performing Delaunay triangulation for a set of points. It is implemented using the Bowyer-Watson algorithm.
3
5
 
4
6
  ## Live demos
5
7
 
6
8
  - Colorful Triangle Pattern Generator, draws a pattern using canvas in the browser: [live demo](https://donkarlssonsan.github.io/colorful-triangle-pattern/), [(source code)](https://github.com/DonKarlssonSan/colorful-triangle-pattern)
9
+ - Striped Triangles Pattern Generator, draws striped triangles using SVG in the browser: [live demo](https://donkarlssonsan.github.io/striped-triangles-pattern/), [(source code)](https://github.com/DonKarlssonSan/striped-triangles-pattern)
7
10
 
8
11
  # Installation
9
12
 
@@ -10,6 +10,10 @@ export default class Triangle {
10
10
  vertexes() {
11
11
  return [this.a, this.b, this.c];
12
12
  }
13
+
14
+ vertexesAsString() {
15
+ return this.vertexes().map(vertex => `${vertex.x}, ${vertex.y}`).join(", ");
16
+ }
13
17
 
14
18
  edges() {
15
19
  return [
@@ -1,37 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to npm when a release is created
2
- # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
-
4
- name: Publish Package to npmjs.com
5
-
6
- on:
7
- release:
8
- types: [created]
9
-
10
- permissions:
11
- id-token: write # Required for OIDC
12
- contents: read
13
-
14
- jobs:
15
- build:
16
- runs-on: ubuntu-latest
17
- steps:
18
- - uses: actions/checkout@v6
19
- - uses: actions/setup-node@v6
20
- with:
21
- node-version: 24
22
- - run: npm ci
23
- - run: npm test
24
-
25
- publish-npm:
26
- needs: build
27
- runs-on: ubuntu-latest
28
- steps:
29
- - uses: actions/checkout@v6
30
- - uses: actions/setup-node@v6
31
- with:
32
- node-version: 24
33
- registry-url: https://registry.npmjs.org/
34
- - run: npm ci
35
- - run: npm publish
36
- env:
37
- NODE_AUTH_TOKEN: ${{secrets.npm_token}}
package/test.js DELETED
@@ -1,29 +0,0 @@
1
- import bowyerWatson from './bowyer-watson.js';
2
- import Triangle from './triangle.js';
3
- import Vector from 'vectory-lib';
4
-
5
- function getRandomPoints() {
6
- let points = [];
7
- let nrOfPoints = 10;
8
- for(let i = 0; i < nrOfPoints; i++) {
9
- points.push(new Vector(
10
- Math.random() * 100,
11
- Math.random() * 100
12
- ));
13
- }
14
- return points;
15
- }
16
-
17
- let pointList = getRandomPoints();
18
-
19
- let superTriangle = new Triangle(
20
- new Vector(-1000, 1000),
21
- new Vector(1000, 1000),
22
- new Vector(0, -1000)
23
- );
24
-
25
- let triangles = bowyerWatson(superTriangle, pointList);
26
-
27
- triangles.forEach(triangle => {
28
- console.log(triangle.vertexes());
29
- });
File without changes