poly-extrude 0.13.0 → 0.14.0

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.
Files changed (68) hide show
  1. package/dist/cylinder.d.ts +11 -0
  2. package/{src → dist}/cylinder.js +108 -111
  3. package/dist/cylinder.js.map +1 -0
  4. package/dist/index.d.ts +7 -0
  5. package/dist/index.js +8 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/math/Curve.d.ts +41 -0
  8. package/dist/math/Curve.js +142 -0
  9. package/dist/math/Curve.js.map +1 -0
  10. package/dist/math/Interpolations.d.ts +8 -0
  11. package/dist/math/Interpolations.js +48 -0
  12. package/dist/math/Interpolations.js.map +1 -0
  13. package/dist/math/Matrix4.d.ts +8 -0
  14. package/dist/math/Matrix4.js +582 -0
  15. package/dist/math/Matrix4.js.map +1 -0
  16. package/dist/math/QuadraticBezierCurve3.d.ts +10 -0
  17. package/dist/math/QuadraticBezierCurve3.js +22 -0
  18. package/dist/math/QuadraticBezierCurve3.js.map +1 -0
  19. package/dist/math/Quaternion.d.ts +46 -0
  20. package/dist/math/Quaternion.js +415 -0
  21. package/dist/math/Quaternion.js.map +1 -0
  22. package/dist/math/Vector3.d.ts +42 -0
  23. package/dist/math/Vector3.js +403 -0
  24. package/dist/math/Vector3.js.map +1 -0
  25. package/dist/path/PathPoint.d.ts +15 -0
  26. package/dist/path/PathPoint.js +35 -0
  27. package/dist/path/PathPoint.js.map +1 -0
  28. package/dist/path/PathPointList.d.ts +27 -0
  29. package/dist/path/PathPointList.js +212 -0
  30. package/dist/path/PathPointList.js.map +1 -0
  31. package/dist/path.d.ts +11 -0
  32. package/{src → dist}/path.js +334 -360
  33. package/dist/path.js.map +1 -0
  34. package/dist/plane.d.ts +2 -0
  35. package/{src → dist}/plane.js +57 -58
  36. package/dist/plane.js.map +1 -0
  37. package/dist/poly-extrude.js +1286 -1581
  38. package/dist/poly-extrude.js.map +1 -1
  39. package/dist/poly-extrude.min.js +2 -2
  40. package/dist/poly-extrude.mjs +1286 -1581
  41. package/dist/poly-extrude.mjs.map +1 -0
  42. package/dist/polygon.d.ts +9 -0
  43. package/{src → dist}/polygon.js +163 -179
  44. package/dist/polygon.js.map +1 -0
  45. package/dist/polyline.d.ts +24 -0
  46. package/{src → dist}/polyline.js +420 -456
  47. package/dist/polyline.js.map +1 -0
  48. package/dist/tube.d.ts +12 -0
  49. package/{src → dist}/tube.js +124 -142
  50. package/dist/tube.js.map +1 -0
  51. package/dist/type.d.ts +9 -0
  52. package/dist/type.js +2 -0
  53. package/dist/type.js.map +1 -0
  54. package/dist/util.d.ts +20 -0
  55. package/dist/util.js +217 -0
  56. package/dist/util.js.map +1 -0
  57. package/package.json +53 -48
  58. package/readme.md +12 -2
  59. package/src/cylinder.ts +124 -0
  60. package/src/index.ts +7 -0
  61. package/src/path.ts +385 -0
  62. package/src/plane.ts +60 -0
  63. package/src/polygon.ts +189 -0
  64. package/src/polyline.ts +473 -0
  65. package/src/tube.ts +155 -0
  66. package/src/type.ts +9 -0
  67. package/src/{util.js → util.ts} +1 -1
  68. package/index.js +0 -7
@@ -0,0 +1,9 @@
1
+ import { PolygonType, ResultType } from './type';
2
+ type PolygonsOptions = {
3
+ depth?: number;
4
+ };
5
+ type PolygonsResult = ResultType & {
6
+ polygons: Array<PolygonType>;
7
+ };
8
+ export declare function extrudePolygons(polygons: Array<PolygonType>, options?: PolygonsOptions): PolygonsResult;
9
+ export {};
@@ -1,179 +1,163 @@
1
-
2
- import earcut from 'earcut';
3
- import { generateNormal, generateSideWallUV, isClockwise, merge } from './util';
4
-
5
- export function extrudePolygons(polygons, options) {
6
- options = Object.assign({}, { depth: 2 }, options);
7
- const results = polygons.map(polygon => {
8
- for (let i = 0, len = polygon.length; i < len; i++) {
9
- const ring = polygon[i];
10
- validateRing(ring);
11
- if (i === 0) {
12
- if (!isClockwise(ring)) {
13
- polygon[i] = ring.reverse();
14
- }
15
- } else if (isClockwise(ring)) {
16
- polygon[i] = ring.reverse();
17
- }
18
- if (isClosedRing(ring)) {
19
- ring.splice(ring.length - 1, 1);
20
- }
21
- }
22
- const result = flatVertices(polygon, options);
23
- result.polygon = polygon;
24
- const triangles = earcut(result.flatVertices, result.holes, 2);
25
- generateTopAndBottom(result, triangles);
26
- generateSides(result, options);
27
- result.position = new Float32Array(result.points);
28
- result.indices = new Uint32Array(result.indices);
29
- result.uv = new Float32Array(result.uv);
30
- result.normal = generateNormal(result.indices, result.position);
31
- return result;
32
- });
33
- const result = merge(results);
34
- result.polygons = polygons;
35
- return result;
36
-
37
- }
38
-
39
- function generateTopAndBottom(result, triangles) {
40
- const indices = [];
41
- const { count } = result;
42
- for (let i = 0, len = triangles.length; i < len; i += 3) {
43
- // top
44
- const a = triangles[i], b = triangles[i + 1], c = triangles[i + 2];
45
- indices[i] = a;
46
- indices[i + 1] = b;
47
- indices[i + 2] = c;
48
- // bottom
49
- const idx = len + i;
50
- const a1 = count + a, b1 = count + b, c1 = count + c;
51
- indices[idx] = a1;
52
- indices[idx + 1] = b1;
53
- indices[idx + 2] = c1;
54
- }
55
- result.indices = indices;
56
- }
57
-
58
- function generateSides(result, options) {
59
- const { points, indices, polygon, uv } = result;
60
- const depth = options.depth;
61
- let pIndex = points.length - 1;
62
- let iIndex = indices.length - 1;
63
- for (let i = 0, len = polygon.length; i < len; i++) {
64
- const ring = polygon[i];
65
- let j = 0;
66
- const len1 = ring.length;
67
- while (j < len1) {
68
- const v1 = ring[j];
69
- let v2 = ring[j + 1];
70
- if (j === len1 - 1) {
71
- v2 = ring[0];
72
- }
73
- const idx = points.length / 3;
74
- const x1 = v1[0], y1 = v1[1], z1 = v1[2] || 0, x2 = v2[0], y2 = v2[1], z2 = v2[2] || 0;
75
- points[++pIndex] = x1;
76
- points[++pIndex] = y1;
77
- points[++pIndex] = z1 + depth;
78
- points[++pIndex] = x2;
79
- points[++pIndex] = y2;
80
- points[++pIndex] = z2 + depth;
81
- points[++pIndex] = x1;
82
- points[++pIndex] = y1;
83
- points[++pIndex] = z1;
84
- points[++pIndex] = x2;
85
- points[++pIndex] = y2;
86
- points[++pIndex] = z2;
87
- // points.push(x1, y1, z, x2, y2, z, x1, y1, 0, x2, y2, 0);
88
- const a = idx + 2, b = idx + 3, c = idx, d = idx + 1;
89
- // points.push(p3, p4, p1, p2);
90
- // index.push(a, c, b, c, d, b);
91
- indices[++iIndex] = a;
92
- indices[++iIndex] = c;
93
- indices[++iIndex] = b;
94
- indices[++iIndex] = c;
95
- indices[++iIndex] = d;
96
- indices[++iIndex] = b;
97
- // index.push(c, d, b);
98
-
99
- generateSideWallUV(uv, points, a, b, c, d);
100
- j++;
101
- }
102
- }
103
- }
104
-
105
- function calPolygonPointsCount(polygon) {
106
- let count = 0;
107
- let i = 0;
108
- const len = polygon.length;
109
- while (i < len) {
110
- count += (polygon[i].length);
111
- i++;
112
- }
113
- return count;
114
- }
115
-
116
- function flatVertices(polygon, options) {
117
- const count = calPolygonPointsCount(polygon);
118
- const len = polygon.length;
119
- const holes = [], flatVertices = new Float32Array(count * 2), points = [], uv = [];
120
- const pOffset = count * 3, uOffset = count * 2;
121
- const depth = options.depth;
122
-
123
- let idx0 = 0, idx1 = 0, idx2 = 0;
124
- for (let i = 0; i < len; i++) {
125
- const ring = polygon[i];
126
- if (i > 0) {
127
- holes.push(idx0 / 2);
128
- }
129
- let j = 0;
130
- const len1 = ring.length;
131
- while (j < len1) {
132
- const c = ring[j];
133
- const x = c[0], y = c[1], z = c[2] || 0;
134
-
135
- flatVertices[idx0++] = x;
136
- flatVertices[idx0++] = y;
137
-
138
- // top vertices
139
- points[idx1] = x;
140
- points[idx1 + 1] = y;
141
- points[idx1 + 2] = depth + z;
142
-
143
- // bottom vertices
144
- points[pOffset + idx1] = x;
145
- points[pOffset + idx1 + 1] = y;
146
- points[pOffset + idx1 + 2] = z;
147
-
148
- uv[idx2] = x;
149
- uv[idx2 + 1] = y;
150
-
151
- uv[uOffset + idx2] = x;
152
- uv[uOffset + idx2 + 1] = y;
153
-
154
- idx1 += 3;
155
- idx2 += 2;
156
- j++;
157
- }
158
- }
159
- return {
160
- flatVertices,
161
- holes,
162
- points,
163
- count,
164
- uv
165
- };
166
-
167
- }
168
-
169
- function validateRing(ring) {
170
- if (!isClosedRing(ring)) {
171
- ring.push(ring[0]);
172
- }
173
- }
174
-
175
- function isClosedRing(ring) {
176
- const len = ring.length;
177
- const [x1, y1] = ring[0], [x2, y2] = ring[len - 1];
178
- return (x1 === x2 && y1 === y2);
179
- }
1
+ import earcut from 'earcut';
2
+ import { generateNormal, generateSideWallUV, isClockwise, merge } from './util';
3
+ export function extrudePolygons(polygons, options) {
4
+ options = Object.assign({}, { depth: 2 }, options);
5
+ const results = polygons.map(polygon => {
6
+ for (let i = 0, len = polygon.length; i < len; i++) {
7
+ const ring = polygon[i];
8
+ validateRing(ring);
9
+ if (i === 0) {
10
+ if (!isClockwise(ring)) {
11
+ polygon[i] = ring.reverse();
12
+ }
13
+ }
14
+ else if (isClockwise(ring)) {
15
+ polygon[i] = ring.reverse();
16
+ }
17
+ if (isClosedRing(ring)) {
18
+ ring.splice(ring.length - 1, 1);
19
+ }
20
+ }
21
+ const result = flatVertices(polygon, options);
22
+ result.polygon = polygon;
23
+ const triangles = earcut(result.flatVertices, result.holes, 2);
24
+ generateTopAndBottom(result, triangles);
25
+ generateSides(result, options);
26
+ result.position = new Float32Array(result.points);
27
+ result.indices = new Uint32Array(result.indices);
28
+ result.uv = new Float32Array(result.uv);
29
+ result.normal = generateNormal(result.indices, result.position);
30
+ return result;
31
+ });
32
+ const result = merge(results);
33
+ result.polygons = polygons;
34
+ return result;
35
+ }
36
+ function generateTopAndBottom(result, triangles) {
37
+ const indices = [];
38
+ const { count } = result;
39
+ for (let i = 0, len = triangles.length; i < len; i += 3) {
40
+ // top
41
+ const a = triangles[i], b = triangles[i + 1], c = triangles[i + 2];
42
+ indices[i] = a;
43
+ indices[i + 1] = b;
44
+ indices[i + 2] = c;
45
+ // bottom
46
+ const idx = len + i;
47
+ const a1 = count + a, b1 = count + b, c1 = count + c;
48
+ indices[idx] = a1;
49
+ indices[idx + 1] = b1;
50
+ indices[idx + 2] = c1;
51
+ }
52
+ result.indices = indices;
53
+ }
54
+ function generateSides(result, options) {
55
+ const { points, indices, polygon, uv } = result;
56
+ const depth = options.depth;
57
+ let pIndex = points.length - 1;
58
+ let iIndex = indices.length - 1;
59
+ for (let i = 0, len = polygon.length; i < len; i++) {
60
+ const ring = polygon[i];
61
+ let j = 0;
62
+ const len1 = ring.length;
63
+ while (j < len1) {
64
+ const v1 = ring[j];
65
+ let v2 = ring[j + 1];
66
+ if (j === len1 - 1) {
67
+ v2 = ring[0];
68
+ }
69
+ const idx = points.length / 3;
70
+ const x1 = v1[0], y1 = v1[1], z1 = v1[2] || 0, x2 = v2[0], y2 = v2[1], z2 = v2[2] || 0;
71
+ points[++pIndex] = x1;
72
+ points[++pIndex] = y1;
73
+ points[++pIndex] = z1 + depth;
74
+ points[++pIndex] = x2;
75
+ points[++pIndex] = y2;
76
+ points[++pIndex] = z2 + depth;
77
+ points[++pIndex] = x1;
78
+ points[++pIndex] = y1;
79
+ points[++pIndex] = z1;
80
+ points[++pIndex] = x2;
81
+ points[++pIndex] = y2;
82
+ points[++pIndex] = z2;
83
+ // points.push(x1, y1, z, x2, y2, z, x1, y1, 0, x2, y2, 0);
84
+ const a = idx + 2, b = idx + 3, c = idx, d = idx + 1;
85
+ // points.push(p3, p4, p1, p2);
86
+ // index.push(a, c, b, c, d, b);
87
+ indices[++iIndex] = a;
88
+ indices[++iIndex] = c;
89
+ indices[++iIndex] = b;
90
+ indices[++iIndex] = c;
91
+ indices[++iIndex] = d;
92
+ indices[++iIndex] = b;
93
+ // index.push(c, d, b);
94
+ generateSideWallUV(uv, points, a, b, c, d);
95
+ j++;
96
+ }
97
+ }
98
+ }
99
+ function calPolygonPointsCount(polygon) {
100
+ let count = 0;
101
+ let i = 0;
102
+ const len = polygon.length;
103
+ while (i < len) {
104
+ count += (polygon[i].length);
105
+ i++;
106
+ }
107
+ return count;
108
+ }
109
+ function flatVertices(polygon, options) {
110
+ const count = calPolygonPointsCount(polygon);
111
+ const len = polygon.length;
112
+ const holes = [], flatVertices = new Float32Array(count * 2), points = [], uv = [];
113
+ const pOffset = count * 3, uOffset = count * 2;
114
+ const depth = options.depth;
115
+ let idx0 = 0, idx1 = 0, idx2 = 0;
116
+ for (let i = 0; i < len; i++) {
117
+ const ring = polygon[i];
118
+ if (i > 0) {
119
+ holes.push(idx0 / 2);
120
+ }
121
+ let j = 0;
122
+ const len1 = ring.length;
123
+ while (j < len1) {
124
+ const c = ring[j];
125
+ const x = c[0], y = c[1], z = c[2] || 0;
126
+ flatVertices[idx0++] = x;
127
+ flatVertices[idx0++] = y;
128
+ // top vertices
129
+ points[idx1] = x;
130
+ points[idx1 + 1] = y;
131
+ points[idx1 + 2] = depth + z;
132
+ // bottom vertices
133
+ points[pOffset + idx1] = x;
134
+ points[pOffset + idx1 + 1] = y;
135
+ points[pOffset + idx1 + 2] = z;
136
+ uv[idx2] = x;
137
+ uv[idx2 + 1] = y;
138
+ uv[uOffset + idx2] = x;
139
+ uv[uOffset + idx2 + 1] = y;
140
+ idx1 += 3;
141
+ idx2 += 2;
142
+ j++;
143
+ }
144
+ }
145
+ return {
146
+ flatVertices,
147
+ holes,
148
+ points,
149
+ count,
150
+ uv
151
+ };
152
+ }
153
+ function validateRing(ring) {
154
+ if (!isClosedRing(ring)) {
155
+ ring.push(ring[0]);
156
+ }
157
+ }
158
+ function isClosedRing(ring) {
159
+ const len = ring.length;
160
+ const [x1, y1] = ring[0], [x2, y2] = ring[len - 1];
161
+ return (x1 === x2 && y1 === y2);
162
+ }
163
+ //# sourceMappingURL=polygon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon.js","sourceRoot":"","sources":["../src/polygon.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,WAAW,EAA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AAG,CAAC,CAAC;YAEjB,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YACvB,EAAE,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YAE3B,IAAI,IAAI,CAAC,CAAC;YACV,IAAI,IAAI,CAAC,CAAC;YACV,CAAC,EAAE,CAAC;QACR,CAAC;IACL,CAAC;IACD,OAAO;QACH,YAAY;QACZ,KAAK;QACL,MAAM;QACN,KAAK;QACL,EAAE;KACL,CAAC;AAEN,CAAC;AAED,SAAS,YAAY,CAAC,IAAkB;IACpC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;AACL,CAAC;AAED,SAAS,YAAY,CAAC,IAAkB;IACpC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { PolylineType, ResultType } from './type';
2
+ type PolylinesOptions = {
3
+ depth?: number;
4
+ lineWidth?: number;
5
+ bottomStickGround?: boolean;
6
+ pathUV?: boolean;
7
+ };
8
+ type PolylinesResult = ResultType & {
9
+ lines: Array<PolylineType>;
10
+ };
11
+ export declare function extrudePolylines(lines: Array<PolylineType>, options?: PolylinesOptions): PolylinesResult;
12
+ type SlopesOptions = PolylinesOptions & {
13
+ side?: 'left' | 'right';
14
+ sideDepth?: number;
15
+ };
16
+ export declare function extrudeSlopes(lines: Array<PolylineType>, options?: SlopesOptions): PolylinesResult;
17
+ export declare function expandLine(line: any, options: any): {
18
+ offsetPoints: number[][];
19
+ leftPoints: number[][];
20
+ rightPoints: number[][];
21
+ line: any;
22
+ };
23
+ export declare function leftOnLine(p: any, p1: any, p2: any): boolean;
24
+ export {};