landxml 0.4.0 → 0.4.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,5 +1,11 @@
1
1
  # landxml
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 4edb0de: Contour elevations from surface min/max elevations and increment are now calculated correctly.
8
+
3
9
  ## 0.4.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.js CHANGED
@@ -280,12 +280,15 @@ var linesToPolyLines = (lineSegments) => {
280
280
  }
281
281
  return polylines;
282
282
  };
283
- var contourElevations = (minElevation, maxElevation, increment) => {
283
+ var contourElevations = (minElevation, maxElevation, interval) => {
284
+ if (maxElevation >= Infinity) {
285
+ throw new Error("Contour elevations have to be finite numbers");
286
+ }
284
287
  const elevations = [];
285
- const start = Math.ceil(minElevation * 2) / 2;
286
- const end = Math.floor(maxElevation * 2) / 2;
287
- for (let elevation = start; elevation <= end; elevation += increment) {
288
+ let elevation = Math.ceil(minElevation * interval) / interval;
289
+ while (elevation < maxElevation) {
288
290
  elevations.push(elevation);
291
+ elevation += interval;
289
292
  }
290
293
  return elevations;
291
294
  };
package/dist/index.mjs CHANGED
@@ -245,12 +245,15 @@ var linesToPolyLines = (lineSegments) => {
245
245
  }
246
246
  return polylines;
247
247
  };
248
- var contourElevations = (minElevation, maxElevation, increment) => {
248
+ var contourElevations = (minElevation, maxElevation, interval) => {
249
+ if (maxElevation >= Infinity) {
250
+ throw new Error("Contour elevations have to be finite numbers");
251
+ }
249
252
  const elevations = [];
250
- const start = Math.ceil(minElevation * 2) / 2;
251
- const end = Math.floor(maxElevation * 2) / 2;
252
- for (let elevation = start; elevation <= end; elevation += increment) {
253
+ let elevation = Math.ceil(minElevation * interval) / interval;
254
+ while (elevation < maxElevation) {
253
255
  elevations.push(elevation);
256
+ elevation += interval;
254
257
  }
255
258
  return elevations;
256
259
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "landxml",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Parse LandXML surfaces on the modern web.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",