@thi.ng/geom-sdf 0.2.0 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2022-06-23T12:16:18Z
3
+ - **Last updated**: 2022-06-28T13:48:51Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/README.md CHANGED
@@ -158,7 +158,7 @@ Package sizes (gzipped, pre-treeshake): ESM: 3.87 KB
158
158
  [Generated API docs](https://docs.thi.ng/umbrella/geom-sdf/)
159
159
 
160
160
  ```js
161
- import { asSvg, bounds, circle, group, simplify, svgDoc } from "@thi.ng/geom";
161
+ import { asSvg, bounds, circle, group, svgDoc } from "@thi.ng/geom";
162
162
  import { asPolygons, asSDF, sample2d } from "@thi.ng/geom-sdf";
163
163
  import { range, repeatedly } from "@thi.ng/transducers";
164
164
  import { randMinMax2 } from "@thi.ng/vectors";
@@ -196,11 +196,10 @@ const image = sample2d(sdf, sceneBounds, RES);
196
196
 
197
197
  // extract contour polygons from given image
198
198
  // in this case the contours extracted are at distances in the [0..32) interval
199
- // afterwards we also simplify the resulting polygons using the Douglas-Peucker algorithm
199
+ // the function also simplifies the resulting polygons using the Douglas-Peucker algorithm
200
+ // with the given threshold (0.25) - the default setting only removes co-linear vertices...
200
201
  // see: https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm
201
- const contours = asPolygons(image, sceneBounds, RES, range(0, 32, 4)).map(
202
- (p) => simplify(p, 0.25)
203
- );
202
+ const contours = asPolygons(image, sceneBounds, RES, range(0, 32, 4), 0.25);
204
203
 
205
204
  // convert to SVG and output as file
206
205
  writeFileSync(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/geom-sdf",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "2D Signed Distance Field creation from @thi.ng/geom shapes, conversions, sampling, combinators",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -38,11 +38,11 @@
38
38
  "@thi.ng/checks": "^3.2.1",
39
39
  "@thi.ng/defmulti": "^2.1.7",
40
40
  "@thi.ng/errors": "^2.1.7",
41
- "@thi.ng/geom": "^3.3.1",
42
- "@thi.ng/geom-api": "^3.2.1",
41
+ "@thi.ng/geom": "^3.4.0",
42
+ "@thi.ng/geom-api": "^3.3.0",
43
43
  "@thi.ng/geom-isoline": "^2.1.14",
44
- "@thi.ng/geom-poly-utils": "^2.3.0",
45
- "@thi.ng/geom-resample": "^2.1.16",
44
+ "@thi.ng/geom-poly-utils": "^2.3.1",
45
+ "@thi.ng/geom-resample": "^2.1.17",
46
46
  "@thi.ng/math": "^5.3.3",
47
47
  "@thi.ng/transducers": "^8.3.5",
48
48
  "@thi.ng/vectors": "^7.5.6"
@@ -127,5 +127,5 @@
127
127
  "status": "alpha",
128
128
  "year": 2022
129
129
  },
130
- "gitHead": "73139849c7b46c0451693d994e14a34bc2434280\n"
130
+ "gitHead": "207404f1e1fcfd3596780322d9218156aeaac3dd\n"
131
131
  }