poly-extrude 0.22.0 → 0.22.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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/poly-extrude.js +15 -8
- package/dist/poly-extrude.js.map +1 -1
- package/dist/poly-extrude.min.js +2 -2
- package/dist/poly-extrude.mjs +15 -8
- package/dist/poly-extrude.mjs.map +1 -1
- package/dist/{polylineoffset.js → polylinehelper.js} +15 -8
- package/dist/{polylineoffset.js.map → polylinehelper.js.map} +1 -1
- package/package.json +53 -53
- package/src/index.ts +1 -1
- package/src/{polylineoffset.ts → polylinehelper.ts} +14 -7
- /package/dist/{polylineoffset.d.ts → polylinehelper.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
@@ -5,6 +5,6 @@ import { expandPaths } from './path';
|
|
5
5
|
import { expandTubes } from './tube';
|
6
6
|
import { plane } from './plane';
|
7
7
|
import { extrudePolygonsOnPath } from './polygonpath';
|
8
|
-
import { polylineOffset, polylineRound } from './
|
8
|
+
import { polylineOffset, polylineRound } from './polylinehelper';
|
9
9
|
import { isClockwise, merge } from './util';
|
10
10
|
export { isClockwise, merge, extrudePolygons, extrudePolylines, extrudeSlopes, expandLine, leftOnLine, cylinder, expandPaths, expandTubes, plane, extrudePolygonsOnPath, polygons, polylineOffset, polylineRound };
|
package/dist/index.js
CHANGED
@@ -5,7 +5,7 @@ import { expandPaths } from './path';
|
|
5
5
|
import { expandTubes } from './tube';
|
6
6
|
import { plane } from './plane';
|
7
7
|
import { extrudePolygonsOnPath } from './polygonpath';
|
8
|
-
import { polylineOffset, polylineRound } from './
|
8
|
+
import { polylineOffset, polylineRound } from './polylinehelper';
|
9
9
|
import { isClockwise, merge } from './util';
|
10
10
|
export { isClockwise, merge, extrudePolygons, extrudePolylines, extrudeSlopes, expandLine, leftOnLine, cylinder, expandPaths, expandTubes, plane, extrudePolygonsOnPath, polygons, polylineOffset, polylineRound };
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/dist/poly-extrude.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* poly-extrude v0.22.
|
2
|
+
* poly-extrude v0.22.1
|
3
3
|
*/
|
4
4
|
(function (global, factory) {
|
5
5
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
@@ -7069,20 +7069,21 @@
|
|
7069
7069
|
}
|
7070
7070
|
const len = line.length;
|
7071
7071
|
const { roundSize, steps } = options;
|
7072
|
-
const
|
7072
|
+
const points = [line[0]];
|
7073
7073
|
let pre = line[0];
|
7074
|
+
let idx = 0;
|
7074
7075
|
for (let i = 1; i < len; i++) {
|
7075
7076
|
const p1 = line[i - 1], p2 = line[i], p3 = line[i + 1];
|
7076
|
-
if (
|
7077
|
+
if (!p3 || !p1 || !p2) {
|
7077
7078
|
continue;
|
7078
7079
|
}
|
7079
|
-
if (
|
7080
|
+
if (pointEqual(pre, p2)) {
|
7080
7081
|
continue;
|
7081
7082
|
}
|
7082
7083
|
const d1 = pointDistance(p2, p1), d2 = pointDistance(p2, p3);
|
7083
7084
|
if (d1 < roundSize || d2 < roundSize) {
|
7084
7085
|
pre = p2;
|
7085
|
-
|
7086
|
+
points[++idx] = p2;
|
7086
7087
|
continue;
|
7087
7088
|
}
|
7088
7089
|
const dx1 = p2[0] - p1[0], dy1 = p2[1] - p1[1];
|
@@ -7097,16 +7098,22 @@
|
|
7097
7098
|
x: p2[0] + percent2 * dx2,
|
7098
7099
|
y: p2[1] + percent2 * dy2
|
7099
7100
|
};
|
7101
|
+
const d3 = pointDistance([c1.x, c1.y], [c2.x, c2.y]);
|
7102
|
+
if (d3 < roundSize / 10) {
|
7103
|
+
pre = p2;
|
7104
|
+
points[++idx] = p2;
|
7105
|
+
continue;
|
7106
|
+
}
|
7100
7107
|
const be = new bezier.Bezier([c1, { x: p2[0], y: p2[1] }, c2]);
|
7101
7108
|
const path = be.getLUT(steps);
|
7102
7109
|
for (let j = 0, len1 = path.length; j < len1; j++) {
|
7103
7110
|
const p = path[j];
|
7104
|
-
|
7111
|
+
points[++idx] = [p.x, p.y];
|
7105
7112
|
}
|
7106
7113
|
pre = p2;
|
7107
7114
|
}
|
7108
|
-
|
7109
|
-
return
|
7115
|
+
points.push(line[len - 1]);
|
7116
|
+
return points;
|
7110
7117
|
}
|
7111
7118
|
|
7112
7119
|
exports.cylinder = cylinder;
|