@antv/l7-layers 2.17.3 → 2.17.4
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/es/Geometry/index.js +31 -9
- package/es/Geometry/models/billboard.js +89 -51
- package/es/Geometry/models/plane.js +143 -81
- package/es/Geometry/models/sprite.js +118 -60
- package/es/canvas/index.js +33 -10
- package/es/canvas/models/canvas.js +97 -41
- package/es/citybuliding/building.js +27 -8
- package/es/citybuliding/models/build.js +82 -57
- package/es/core/BaseLayer.js +478 -313
- package/es/core/BaseModel.js +80 -51
- package/es/core/CommonStyleAttribute.js +5 -2
- package/es/core/LayerPickService.js +32 -21
- package/es/core/TextureService.js +13 -0
- package/es/core/interface.js +24 -17
- package/es/core/shape/Path.js +20 -13
- package/es/core/shape/extrude.js +39 -27
- package/es/core/triangulation.js +136 -99
- package/es/earth/index.js +33 -9
- package/es/earth/models/atmosphere.js +54 -30
- package/es/earth/models/base.js +85 -47
- package/es/earth/models/bloomsphere.js +54 -30
- package/es/earth/utils.js +13 -9
- package/es/heatmap/index.js +40 -10
- package/es/heatmap/models/grid.js +52 -28
- package/es/heatmap/models/grid3d.js +52 -28
- package/es/heatmap/models/heatmap.js +149 -92
- package/es/heatmap/models/hexagon.js +52 -28
- package/es/heatmap/triangulation.js +4 -0
- package/es/image/index.js +28 -9
- package/es/image/models/image.js +100 -66
- package/es/index.js +17 -9
- package/es/line/index.js +35 -9
- package/es/line/models/arc.js +112 -63
- package/es/line/models/arc_3d.js +102 -58
- package/es/line/models/earthArc_3d.js +105 -60
- package/es/line/models/flow.js +60 -36
- package/es/line/models/great_circle.js +94 -53
- package/es/line/models/line.js +136 -85
- package/es/line/models/linearline.js +74 -42
- package/es/line/models/simpleLine.js +67 -38
- package/es/line/models/wall.js +92 -52
- package/es/mask/index.js +28 -9
- package/es/mask/models/fill.js +54 -29
- package/es/plugins/DataMappingPlugin.js +114 -78
- package/es/plugins/DataSourcePlugin.js +68 -45
- package/es/plugins/FeatureScalePlugin.js +122 -67
- package/es/plugins/LayerAnimateStylePlugin.js +5 -0
- package/es/plugins/LayerMaskPlugin.js +11 -3
- package/es/plugins/LayerModelPlugin.js +108 -69
- package/es/plugins/LayerStylePlugin.js +9 -3
- package/es/plugins/LightingPlugin.js +18 -12
- package/es/plugins/MultiPassRendererPlugin.js +16 -11
- package/es/plugins/PixelPickingPlugin.js +21 -12
- package/es/plugins/RegisterStyleAttributePlugin.js +12 -5
- package/es/plugins/ShaderUniformPlugin.js +27 -13
- package/es/plugins/UpdateModelPlugin.js +5 -0
- package/es/plugins/UpdateStyleAttributePlugin.js +11 -5
- package/es/point/index.js +78 -26
- package/es/point/models/earthExtrude.js +95 -58
- package/es/point/models/earthFill.js +80 -52
- package/es/point/models/extrude.js +94 -57
- package/es/point/models/fill.js +81 -56
- package/es/point/models/fillmage.js +100 -60
- package/es/point/models/image.js +83 -47
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +54 -30
- package/es/point/models/radar.js +63 -38
- package/es/point/models/simplePoint.js +62 -38
- package/es/point/models/text.js +296 -199
- package/es/point/shape/extrude.js +13 -4
- package/es/polygon/index.js +41 -11
- package/es/polygon/models/extrude.js +135 -87
- package/es/polygon/models/fill.js +79 -50
- package/es/polygon/models/index.js +2 -3
- package/es/polygon/models/ocean.js +76 -42
- package/es/polygon/models/water.js +71 -37
- package/es/raster/buffers/triangulation.js +4 -2
- package/es/raster/index.js +32 -9
- package/es/raster/models/raster.js +116 -80
- package/es/raster/models/rasterRgb.js +127 -84
- package/es/raster/models/rasterTerrainRgb.js +84 -56
- package/es/tile/interaction/getRasterData.js +20 -14
- package/es/tile/interaction/utils.js +9 -7
- package/es/tile/manager/base.js +96 -63
- package/es/tile/service/TileLayerService.js +55 -33
- package/es/tile/service/TilePickService.js +40 -26
- package/es/tile/service/TileSourceService.js +7 -3
- package/es/tile/tileFactory/DebugTile.js +46 -29
- package/es/tile/tileFactory/ImageTile.js +38 -20
- package/es/tile/tileFactory/MaskTile.js +43 -22
- package/es/tile/tileFactory/RasterRGBTile.js +42 -22
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +38 -20
- package/es/tile/tileFactory/RasterTile.js +53 -30
- package/es/tile/tileFactory/Tile.js +97 -63
- package/es/tile/tileFactory/VectorTile.js +68 -41
- package/es/tile/tileFactory/index.js +11 -0
- package/es/tile/tileFactory/layers/TileDebugLayer.js +27 -6
- package/es/tile/tileFactory/util.js +3 -0
- package/es/tile/tileLayer/BaseLayer.js +146 -105
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +2 -0
- package/es/utils/collision-index.js +16 -9
- package/es/utils/extrude_polyline.js +149 -101
- package/es/utils/grid-index.js +27 -2
- package/es/utils/identityScale.js +8 -0
- package/es/utils/layerData.js +44 -30
- package/es/utils/multiPassRender.js +13 -11
- package/es/utils/polylineNormal.js +37 -31
- package/es/utils/simpleLine.js +16 -2
- package/es/utils/stencil.js +3 -2
- package/es/utils/symbol-layout.js +53 -27
- package/es/wind/index.js +29 -9
- package/es/wind/models/utils.js +51 -26
- package/es/wind/models/wind.js +147 -101
- package/es/wind/models/windRender.js +66 -53
- package/lib/Geometry/index.js +38 -9
- package/lib/Geometry/models/billboard.js +97 -51
- package/lib/Geometry/models/index.js +5 -0
- package/lib/Geometry/models/plane.js +151 -79
- package/lib/Geometry/models/sprite.js +127 -60
- package/lib/canvas/index.js +40 -10
- package/lib/canvas/models/canvas.js +101 -41
- package/lib/canvas/models/index.js +3 -0
- package/lib/citybuliding/building.js +35 -8
- package/lib/citybuliding/models/build.js +92 -57
- package/lib/core/BaseLayer.js +469 -313
- package/lib/core/BaseModel.js +90 -51
- package/lib/core/CommonStyleAttribute.js +7 -2
- package/lib/core/LayerPickService.js +37 -21
- package/lib/core/TextureService.js +16 -0
- package/lib/core/interface.js +31 -21
- package/lib/core/schema.js +1 -0
- package/lib/core/shape/Path.js +31 -14
- package/lib/core/shape/extrude.js +62 -27
- package/lib/core/triangulation.js +177 -98
- package/lib/earth/index.js +43 -9
- package/lib/earth/models/atmosphere.js +63 -30
- package/lib/earth/models/base.js +90 -47
- package/lib/earth/models/bloomsphere.js +63 -30
- package/lib/earth/utils.js +31 -7
- package/lib/heatmap/index.js +48 -10
- package/lib/heatmap/models/grid.js +60 -28
- package/lib/heatmap/models/grid3d.js +60 -28
- package/lib/heatmap/models/heatmap.js +166 -92
- package/lib/heatmap/models/hexagon.js +60 -28
- package/lib/heatmap/models/index.js +6 -0
- package/lib/heatmap/triangulation.js +5 -0
- package/lib/image/index.js +36 -9
- package/lib/image/models/image.js +109 -66
- package/lib/image/models/index.js +3 -0
- package/lib/index.js +61 -7
- package/lib/line/index.js +40 -9
- package/lib/line/models/arc.js +122 -61
- package/lib/line/models/arc_3d.js +113 -56
- package/lib/line/models/earthArc_3d.js +115 -58
- package/lib/line/models/flow.js +70 -36
- package/lib/line/models/great_circle.js +104 -53
- package/lib/line/models/index.js +11 -0
- package/lib/line/models/line.js +144 -83
- package/lib/line/models/linearline.js +86 -42
- package/lib/line/models/simpleLine.js +77 -38
- package/lib/line/models/wall.js +103 -52
- package/lib/mask/index.js +36 -9
- package/lib/mask/models/fill.js +63 -29
- package/lib/mask/models/index.js +3 -0
- package/lib/plugins/DataMappingPlugin.js +125 -78
- package/lib/plugins/DataSourcePlugin.js +76 -45
- package/lib/plugins/FeatureScalePlugin.js +138 -67
- package/lib/plugins/LayerAnimateStylePlugin.js +10 -0
- package/lib/plugins/LayerMaskPlugin.js +17 -4
- package/lib/plugins/LayerModelPlugin.js +117 -70
- package/lib/plugins/LayerStylePlugin.js +14 -4
- package/lib/plugins/LightingPlugin.js +25 -12
- package/lib/plugins/MultiPassRendererPlugin.js +22 -11
- package/lib/plugins/PixelPickingPlugin.js +27 -12
- package/lib/plugins/RegisterStyleAttributePlugin.js +19 -5
- package/lib/plugins/ShaderUniformPlugin.js +34 -13
- package/lib/plugins/UpdateModelPlugin.js +10 -1
- package/lib/plugins/UpdateStyleAttributePlugin.js +16 -5
- package/lib/point/index.js +83 -26
- package/lib/point/models/earthExtrude.js +106 -58
- package/lib/point/models/earthFill.js +110 -52
- package/lib/point/models/extrude.js +103 -57
- package/lib/point/models/fill.js +90 -54
- package/lib/point/models/fillmage.js +107 -58
- package/lib/point/models/image.js +92 -47
- package/lib/point/models/index.js +12 -1
- package/lib/point/models/normal.js +64 -30
- package/lib/point/models/radar.js +72 -38
- package/lib/point/models/simplePoint.js +72 -38
- package/lib/point/models/text.js +305 -199
- package/lib/point/shape/extrude.js +20 -4
- package/lib/polygon/index.js +48 -11
- package/lib/polygon/models/extrude.js +146 -87
- package/lib/polygon/models/fill.js +89 -50
- package/lib/polygon/models/index.js +14 -2
- package/lib/polygon/models/ocean.js +88 -42
- package/lib/polygon/models/water.js +82 -37
- package/lib/raster/buffers/triangulation.js +7 -3
- package/lib/raster/index.js +40 -9
- package/lib/raster/models/index.js +5 -0
- package/lib/raster/models/raster.js +125 -80
- package/lib/raster/models/rasterRgb.js +139 -84
- package/lib/raster/models/rasterTerrainRgb.js +93 -56
- package/lib/tile/interaction/getRasterData.js +25 -14
- package/lib/tile/interaction/utils.js +19 -7
- package/lib/tile/manager/base.js +104 -63
- package/lib/tile/service/TileLayerService.js +60 -33
- package/lib/tile/service/TilePickService.js +48 -26
- package/lib/tile/service/TileSourceService.js +16 -2
- package/lib/tile/style/utils.js +3 -0
- package/lib/tile/tileFactory/DebugTile.js +54 -29
- package/lib/tile/tileFactory/ImageTile.js +46 -20
- package/lib/tile/tileFactory/MaskTile.js +51 -22
- package/lib/tile/tileFactory/RasterRGBTile.js +50 -22
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +46 -20
- package/lib/tile/tileFactory/RasterTile.js +63 -30
- package/lib/tile/tileFactory/Tile.js +102 -63
- package/lib/tile/tileFactory/VectorTile.js +76 -41
- package/lib/tile/tileFactory/index.js +25 -0
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +32 -6
- package/lib/tile/tileFactory/util.js +9 -0
- package/lib/tile/tileLayer/BaseLayer.js +153 -105
- package/lib/tile/utils.js +5 -1
- package/lib/utils/blend.js +5 -0
- package/lib/utils/collision-index.js +25 -9
- package/lib/utils/extrude_polyline.js +181 -101
- package/lib/utils/grid-index.js +28 -2
- package/lib/utils/identityScale.js +9 -0
- package/lib/utils/layerData.js +49 -30
- package/lib/utils/multiPassRender.js +16 -11
- package/lib/utils/polylineNormal.js +66 -31
- package/lib/utils/simpleLine.js +21 -2
- package/lib/utils/stencil.js +4 -0
- package/lib/utils/symbol-layout.js +55 -27
- package/lib/wind/index.js +37 -9
- package/lib/wind/models/index.js +3 -0
- package/lib/wind/models/utils.js +62 -26
- package/lib/wind/models/wind.js +157 -101
- package/lib/wind/models/windRender.js +71 -53
- package/lib/wind/models/windShader.js +1 -0
- package/package.json +7 -7
|
@@ -5,8 +5,8 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
6
|
import { aProjectFlat } from '@antv/l7-utils';
|
|
7
7
|
import { vec2 } from 'gl-matrix';
|
|
8
|
-
var tmp = vec2.create();
|
|
9
|
-
|
|
8
|
+
var tmp = vec2.create(); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
|
+
|
|
10
10
|
var capEnd = vec2.create();
|
|
11
11
|
var lineA = vec2.create();
|
|
12
12
|
var lineB = vec2.create();
|
|
@@ -26,13 +26,17 @@ export function direction(out, a, b) {
|
|
|
26
26
|
vec2.normalize(out, out);
|
|
27
27
|
return out;
|
|
28
28
|
}
|
|
29
|
+
|
|
29
30
|
function isPointEqual(a, b) {
|
|
30
31
|
return a[0] === b[0] && a[1] === b[1];
|
|
31
32
|
}
|
|
33
|
+
|
|
32
34
|
export function getArrayUnique(matrix) {
|
|
33
35
|
var map = new Map();
|
|
36
|
+
|
|
34
37
|
for (var i = 0; i < matrix.length; i++) {
|
|
35
38
|
var key = matrix[0].toString() + '-' + matrix[1].toString();
|
|
39
|
+
|
|
36
40
|
if (map.get(key)) {
|
|
37
41
|
matrix.splice(i, 1);
|
|
38
42
|
i++;
|
|
@@ -40,18 +44,28 @@ export function getArrayUnique(matrix) {
|
|
|
40
44
|
map.set(key, key);
|
|
41
45
|
}
|
|
42
46
|
}
|
|
47
|
+
|
|
43
48
|
return matrix;
|
|
44
49
|
}
|
|
50
|
+
|
|
45
51
|
var ExtrudePolyline = /*#__PURE__*/function () {
|
|
46
52
|
function ExtrudePolyline() {
|
|
47
53
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
54
|
+
|
|
48
55
|
_classCallCheck(this, ExtrudePolyline);
|
|
56
|
+
|
|
49
57
|
_defineProperty(this, "lastFlip", -1);
|
|
58
|
+
|
|
50
59
|
_defineProperty(this, "miter", vec2.fromValues(0, 0));
|
|
60
|
+
|
|
51
61
|
_defineProperty(this, "started", false);
|
|
62
|
+
|
|
52
63
|
_defineProperty(this, "dash", false);
|
|
64
|
+
|
|
53
65
|
_defineProperty(this, "totalDistance", 0);
|
|
66
|
+
|
|
54
67
|
_defineProperty(this, "currentIndex", 0);
|
|
68
|
+
|
|
55
69
|
this.join = opts.join || 'miter';
|
|
56
70
|
this.cap = opts.cap || 'butt';
|
|
57
71
|
this.miterLimit = opts.miterLimit || 10;
|
|
@@ -65,19 +79,23 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
65
79
|
indexes: []
|
|
66
80
|
};
|
|
67
81
|
}
|
|
82
|
+
|
|
68
83
|
_createClass(ExtrudePolyline, [{
|
|
69
84
|
key: "simpleExtrude",
|
|
70
85
|
value: function simpleExtrude(points) {
|
|
71
86
|
var complex = this.complex;
|
|
87
|
+
|
|
72
88
|
if (points.length <= 1) {
|
|
73
89
|
return complex;
|
|
74
90
|
}
|
|
91
|
+
|
|
75
92
|
this.lastFlip = -1;
|
|
76
93
|
this.started = false;
|
|
77
94
|
this.normal = null;
|
|
78
95
|
this.totalDistance = 0;
|
|
79
96
|
var total = points.length;
|
|
80
97
|
var count = complex.startIndex;
|
|
98
|
+
|
|
81
99
|
for (var i = 1; i < total; i++) {
|
|
82
100
|
var last = points[i - 1];
|
|
83
101
|
var cur = points[i];
|
|
@@ -85,11 +103,13 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
85
103
|
var amt = this.simpleSegment(complex, count, last, cur, next);
|
|
86
104
|
count += amt;
|
|
87
105
|
}
|
|
106
|
+
|
|
88
107
|
if (this.dash) {
|
|
89
108
|
for (var _i = 0; _i < complex.positions.length / 6; _i++) {
|
|
90
109
|
complex.positions[_i * 6 + 5] = this.totalDistance;
|
|
91
110
|
}
|
|
92
111
|
}
|
|
112
|
+
|
|
93
113
|
complex.startIndex = complex.positions.length / 6;
|
|
94
114
|
return complex;
|
|
95
115
|
}
|
|
@@ -97,47 +117,48 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
97
117
|
key: "simpleExtrude_gaode2",
|
|
98
118
|
value: function simpleExtrude_gaode2(points, originPoints) {
|
|
99
119
|
var complex = this.complex;
|
|
120
|
+
|
|
100
121
|
if (points.length <= 1) {
|
|
101
122
|
return complex;
|
|
102
123
|
}
|
|
124
|
+
|
|
103
125
|
this.lastFlip = -1;
|
|
104
126
|
this.started = false;
|
|
105
127
|
this.normal = null;
|
|
106
|
-
this.totalDistance = 0;
|
|
107
|
-
// 去除数组里重复的点
|
|
128
|
+
this.totalDistance = 0; // 去除数组里重复的点
|
|
108
129
|
// points = getArrayUnique(points);
|
|
130
|
+
|
|
109
131
|
var total = points.length;
|
|
110
132
|
var count = complex.startIndex;
|
|
133
|
+
|
|
111
134
|
for (var i = 1; i < total; i++) {
|
|
112
135
|
var _originPoints$, _originPoints$i$, _originPoints$2;
|
|
136
|
+
|
|
113
137
|
var last = points[i - 1];
|
|
114
|
-
last.push((_originPoints$ = originPoints[i - 1][2]) !== null && _originPoints$ !== void 0 ? _originPoints$ : 0);
|
|
115
|
-
|
|
138
|
+
last.push((_originPoints$ = originPoints[i - 1][2]) !== null && _originPoints$ !== void 0 ? _originPoints$ : 0); // @ts-ignore
|
|
139
|
+
|
|
116
140
|
var originLast = originPoints[i - 1];
|
|
117
141
|
var cur = points[i];
|
|
118
|
-
cur.push((_originPoints$i$ = originPoints[i][2]) !== null && _originPoints$i$ !== void 0 ? _originPoints$i$ : 0);
|
|
119
|
-
|
|
142
|
+
cur.push((_originPoints$i$ = originPoints[i][2]) !== null && _originPoints$i$ !== void 0 ? _originPoints$i$ : 0); // @ts-ignore
|
|
143
|
+
|
|
120
144
|
var originCur = originPoints[i];
|
|
121
145
|
var next = i < points.length - 1 ? [].concat(_toConsumableArray(points[i + 1]), [(_originPoints$2 = originPoints[i + 1][2]) !== null && _originPoints$2 !== void 0 ? _originPoints$2 : 0]) : null;
|
|
122
146
|
var originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
|
|
123
|
-
var amt = this.simpleSegment(complex, count,
|
|
124
|
-
// @ts-ignore
|
|
125
|
-
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
|
|
128
|
-
// @ts-ignore
|
|
129
|
-
next,
|
|
130
|
-
// @ts-ignore
|
|
131
|
-
originLast, originCur,
|
|
132
|
-
// @ts-ignore
|
|
147
|
+
var amt = this.simpleSegment(complex, count, // @ts-ignore
|
|
148
|
+
last, // @ts-ignore
|
|
149
|
+
cur, // @ts-ignore
|
|
150
|
+
next, // @ts-ignore
|
|
151
|
+
originLast, originCur, // @ts-ignore
|
|
133
152
|
originNext);
|
|
134
153
|
count += amt;
|
|
135
154
|
}
|
|
155
|
+
|
|
136
156
|
if (this.dash) {
|
|
137
157
|
for (var _i2 = 0; _i2 < complex.positions.length / 6; _i2++) {
|
|
138
158
|
complex.positions[_i2 * 6 + 5] = this.totalDistance;
|
|
139
159
|
}
|
|
140
160
|
}
|
|
161
|
+
|
|
141
162
|
complex.startIndex = complex.positions.length / 6;
|
|
142
163
|
return complex;
|
|
143
164
|
}
|
|
@@ -145,47 +166,48 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
145
166
|
key: "extrude_gaode2",
|
|
146
167
|
value: function extrude_gaode2(points, originPoints) {
|
|
147
168
|
var complex = this.complex;
|
|
169
|
+
|
|
148
170
|
if (points.length <= 1) {
|
|
149
171
|
return complex;
|
|
150
172
|
}
|
|
173
|
+
|
|
151
174
|
this.lastFlip = -1;
|
|
152
175
|
this.started = false;
|
|
153
176
|
this.normal = null;
|
|
154
|
-
this.totalDistance = 0;
|
|
155
|
-
// 去除数组里重复的点
|
|
177
|
+
this.totalDistance = 0; // 去除数组里重复的点
|
|
156
178
|
// points = getArrayUnique(points);
|
|
179
|
+
|
|
157
180
|
var total = points.length;
|
|
158
181
|
var count = complex.startIndex;
|
|
182
|
+
|
|
159
183
|
for (var i = 1; i < total; i++) {
|
|
160
184
|
var _originPoints$3, _originPoints$i$2, _originPoints$4;
|
|
185
|
+
|
|
161
186
|
var last = points[i - 1];
|
|
162
|
-
last.push((_originPoints$3 = originPoints[i - 1][2]) !== null && _originPoints$3 !== void 0 ? _originPoints$3 : 0);
|
|
163
|
-
|
|
187
|
+
last.push((_originPoints$3 = originPoints[i - 1][2]) !== null && _originPoints$3 !== void 0 ? _originPoints$3 : 0); // @ts-ignore
|
|
188
|
+
|
|
164
189
|
var originLast = originPoints[i - 1];
|
|
165
190
|
var cur = points[i];
|
|
166
|
-
cur.push((_originPoints$i$2 = originPoints[i][2]) !== null && _originPoints$i$2 !== void 0 ? _originPoints$i$2 : 0);
|
|
167
|
-
|
|
191
|
+
cur.push((_originPoints$i$2 = originPoints[i][2]) !== null && _originPoints$i$2 !== void 0 ? _originPoints$i$2 : 0); // @ts-ignore
|
|
192
|
+
|
|
168
193
|
var originCur = originPoints[i];
|
|
169
194
|
var next = i < points.length - 1 ? [].concat(_toConsumableArray(points[i + 1]), [(_originPoints$4 = originPoints[i + 1][2]) !== null && _originPoints$4 !== void 0 ? _originPoints$4 : 0]) : null;
|
|
170
195
|
var originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
|
|
171
|
-
var amt = this.segment_gaode2(complex, count,
|
|
172
|
-
// @ts-ignore
|
|
173
|
-
|
|
174
|
-
// @ts-ignore
|
|
175
|
-
|
|
176
|
-
// @ts-ignore
|
|
177
|
-
next,
|
|
178
|
-
// @ts-ignore
|
|
179
|
-
originLast, originCur,
|
|
180
|
-
// @ts-ignore
|
|
196
|
+
var amt = this.segment_gaode2(complex, count, // @ts-ignore
|
|
197
|
+
last, // @ts-ignore
|
|
198
|
+
cur, // @ts-ignore
|
|
199
|
+
next, // @ts-ignore
|
|
200
|
+
originLast, originCur, // @ts-ignore
|
|
181
201
|
originNext);
|
|
182
202
|
count += amt;
|
|
183
203
|
}
|
|
204
|
+
|
|
184
205
|
if (this.dash) {
|
|
185
206
|
for (var _i3 = 0; _i3 < complex.positions.length / 6; _i3++) {
|
|
186
207
|
complex.positions[_i3 * 6 + 5] = this.totalDistance;
|
|
187
208
|
}
|
|
188
209
|
}
|
|
210
|
+
|
|
189
211
|
complex.startIndex = complex.positions.length / 6;
|
|
190
212
|
return complex;
|
|
191
213
|
}
|
|
@@ -193,17 +215,20 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
193
215
|
key: "extrude",
|
|
194
216
|
value: function extrude(points) {
|
|
195
217
|
var complex = this.complex;
|
|
218
|
+
|
|
196
219
|
if (points.length <= 1) {
|
|
197
220
|
return complex;
|
|
198
221
|
}
|
|
222
|
+
|
|
199
223
|
this.lastFlip = -1;
|
|
200
224
|
this.started = false;
|
|
201
225
|
this.normal = null;
|
|
202
|
-
this.totalDistance = 0;
|
|
203
|
-
// 去除数组里重复的点
|
|
226
|
+
this.totalDistance = 0; // 去除数组里重复的点
|
|
204
227
|
// points = getArrayUnique(points);
|
|
228
|
+
|
|
205
229
|
var total = points.length;
|
|
206
230
|
var count = complex.startIndex;
|
|
231
|
+
|
|
207
232
|
for (var i = 1; i < total; i++) {
|
|
208
233
|
var last = points[i - 1];
|
|
209
234
|
var cur = points[i];
|
|
@@ -211,11 +236,13 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
211
236
|
var amt = this.segment(complex, count, last, cur, next);
|
|
212
237
|
count += amt;
|
|
213
238
|
}
|
|
239
|
+
|
|
214
240
|
if (this.dash) {
|
|
215
241
|
for (var _i4 = 0; _i4 < complex.positions.length / 6; _i4++) {
|
|
216
242
|
complex.positions[_i4 * 6 + 5] = this.totalDistance;
|
|
217
243
|
}
|
|
218
244
|
}
|
|
245
|
+
|
|
219
246
|
complex.startIndex = complex.positions.length / 6;
|
|
220
247
|
return complex;
|
|
221
248
|
}
|
|
@@ -227,24 +254,29 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
227
254
|
var positions = complex.positions;
|
|
228
255
|
var normals = complex.normals;
|
|
229
256
|
var flatCur = aProjectFlat([cur[0], cur[1]]);
|
|
230
|
-
var flatLast = aProjectFlat([last[0], last[1]]);
|
|
231
|
-
|
|
257
|
+
var flatLast = aProjectFlat([last[0], last[1]]); // @ts-ignore
|
|
258
|
+
|
|
232
259
|
direction(lineA, flatCur, flatLast);
|
|
233
260
|
var segmentDistance = 0;
|
|
261
|
+
|
|
234
262
|
if (this.dash) {
|
|
235
263
|
// @ts-ignore
|
|
236
264
|
segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
|
|
237
265
|
this.totalDistance += segmentDistance;
|
|
238
266
|
}
|
|
267
|
+
|
|
239
268
|
if (!this.normal) {
|
|
240
269
|
this.normal = vec2.create();
|
|
241
270
|
computeNormal(this.normal, lineA);
|
|
242
271
|
}
|
|
272
|
+
|
|
243
273
|
if (!this.started) {
|
|
244
274
|
this.started = true;
|
|
245
275
|
this.extrusions(positions, normals, last, this.normal, this.thickness, this.totalDistance - segmentDistance);
|
|
246
276
|
}
|
|
277
|
+
|
|
247
278
|
indices.push(index + 0, index + 1, index + 2);
|
|
279
|
+
|
|
248
280
|
if (!next) {
|
|
249
281
|
computeNormal(this.normal, lineA);
|
|
250
282
|
this.extrusions(positions, normals, cur, this.normal, this.thickness, this.totalDistance);
|
|
@@ -252,36 +284,35 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
252
284
|
count += 2;
|
|
253
285
|
} else {
|
|
254
286
|
var flatNext = aProjectFlat([next[0], next[1]]);
|
|
287
|
+
|
|
255
288
|
if (isPointEqual(flatCur, flatNext)) {
|
|
256
289
|
vec2.add(flatNext, flatCur, vec2.normalize(flatNext, vec2.subtract(flatNext, flatCur, flatLast)));
|
|
257
290
|
}
|
|
258
|
-
direction(lineB, flatNext, flatCur);
|
|
259
291
|
|
|
260
|
-
// stores tangent & miter
|
|
292
|
+
direction(lineB, flatNext, flatCur); // stores tangent & miter
|
|
261
293
|
|
|
262
294
|
var _computeMiter = computeMiter(tangent, vec2.create(), lineA, lineB, this.thickness),
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
// normal(tmp, lineA)
|
|
267
|
-
|
|
295
|
+
_computeMiter2 = _slicedToArray(_computeMiter, 2),
|
|
296
|
+
miterLen = _computeMiter2[0],
|
|
297
|
+
miter = _computeMiter2[1]; // normal(tmp, lineA)
|
|
268
298
|
// get orientation
|
|
299
|
+
|
|
300
|
+
|
|
269
301
|
var flip = vec2.dot(tangent, this.normal) < 0 ? -1 : 1;
|
|
270
302
|
this.extrusions(positions, normals, cur, miter, miterLen, this.totalDistance);
|
|
271
303
|
indices.push.apply(indices, _toConsumableArray(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
272
|
-
flip = -1;
|
|
304
|
+
flip = -1; // the miter is now the normal for our next join
|
|
273
305
|
|
|
274
|
-
// the miter is now the normal for our next join
|
|
275
306
|
vec2.copy(this.normal, miter);
|
|
276
307
|
count += 2;
|
|
277
308
|
this.lastFlip = flip;
|
|
278
309
|
}
|
|
310
|
+
|
|
279
311
|
return count;
|
|
280
312
|
}
|
|
281
313
|
}, {
|
|
282
314
|
key: "segment_gaode2",
|
|
283
|
-
value: function segment_gaode2(complex, index, last, cur, next, originLast, originCur,
|
|
284
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
315
|
+
value: function segment_gaode2(complex, index, last, cur, next, originLast, originCur, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
285
316
|
originNext) {
|
|
286
317
|
var count = 0;
|
|
287
318
|
var indices = complex.indices;
|
|
@@ -290,23 +321,25 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
290
321
|
var capSquare = this.cap === 'square';
|
|
291
322
|
var joinBevel = this.join === 'bevel';
|
|
292
323
|
var flatCur = aProjectFlat([originCur[0], originCur[1]]);
|
|
293
|
-
var flatLast = aProjectFlat([originLast[0], originLast[1]]);
|
|
294
|
-
|
|
324
|
+
var flatLast = aProjectFlat([originLast[0], originLast[1]]); // @ts-ignore
|
|
325
|
+
|
|
295
326
|
direction(lineA, cur, last);
|
|
296
327
|
var segmentDistance = 0;
|
|
328
|
+
|
|
297
329
|
if (this.dash) {
|
|
298
330
|
// @ts-ignore
|
|
299
331
|
segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
|
|
300
332
|
this.totalDistance += segmentDistance;
|
|
301
333
|
}
|
|
334
|
+
|
|
302
335
|
if (!this.normal) {
|
|
303
336
|
this.normal = vec2.create();
|
|
304
337
|
computeNormal(this.normal, lineA);
|
|
305
338
|
}
|
|
339
|
+
|
|
306
340
|
if (!this.started) {
|
|
307
|
-
this.started = true;
|
|
341
|
+
this.started = true; // if the end cap is type square, we can just push the verts out a bit
|
|
308
342
|
|
|
309
|
-
// if the end cap is type square, we can just push the verts out a bit
|
|
310
343
|
if (capSquare) {
|
|
311
344
|
// vec2.scaleAndAdd(capEnd, last, lineA, -this.thickness);
|
|
312
345
|
var out1 = vec2.create();
|
|
@@ -324,12 +357,17 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
324
357
|
this.extrusions(positions, normals, last, this.normal, this.thickness, this.totalDistance - segmentDistance);
|
|
325
358
|
}
|
|
326
359
|
}
|
|
360
|
+
|
|
327
361
|
indices.push(index + 0, index + 1, index + 2);
|
|
362
|
+
|
|
328
363
|
if (!next) {
|
|
329
364
|
computeNormal(this.normal, lineA);
|
|
365
|
+
|
|
330
366
|
if (capSquare) {
|
|
331
367
|
var _out = vec2.create();
|
|
368
|
+
|
|
332
369
|
var _out2 = vec2.create();
|
|
370
|
+
|
|
333
371
|
vec2.sub(_out2, lineA, this.normal);
|
|
334
372
|
vec2.add(_out, lineA, this.normal);
|
|
335
373
|
normals.push(_out2[0], _out2[1], 0);
|
|
@@ -342,40 +380,40 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
342
380
|
} else {
|
|
343
381
|
this.extrusions(positions, normals, cur, this.normal, this.thickness, this.totalDistance);
|
|
344
382
|
}
|
|
383
|
+
|
|
345
384
|
indices.push.apply(indices, _toConsumableArray(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
346
385
|
count += 2;
|
|
347
386
|
} else {
|
|
348
387
|
// @ts-ignore
|
|
349
388
|
if (isPointEqual(cur, next)) {
|
|
350
|
-
vec2.add(
|
|
351
|
-
// @ts-ignore
|
|
352
|
-
|
|
353
|
-
// @ts-ignore
|
|
354
|
-
cur, vec2.normalize(
|
|
355
|
-
// @ts-ignore
|
|
356
|
-
next,
|
|
357
|
-
// @ts-ignore
|
|
389
|
+
vec2.add( // @ts-ignore
|
|
390
|
+
next, // @ts-ignore
|
|
391
|
+
cur, vec2.normalize( // @ts-ignore
|
|
392
|
+
next, // @ts-ignore
|
|
358
393
|
vec2.subtract(next, cur, last)));
|
|
359
|
-
}
|
|
360
|
-
// @ts-ignore
|
|
361
|
-
direction(lineB, next, cur);
|
|
362
|
-
// stores tangent & miter
|
|
394
|
+
} // @ts-ignore
|
|
363
395
|
|
|
364
|
-
var _computeMiter3 = computeMiter(tangent, vec2.create(), lineA, lineB, this.thickness),
|
|
365
|
-
_computeMiter4 = _slicedToArray(_computeMiter3, 2),
|
|
366
|
-
miterLen = _computeMiter4[0],
|
|
367
|
-
miter = _computeMiter4[1];
|
|
368
|
-
// normal(tmp, lineA)
|
|
369
396
|
|
|
397
|
+
direction(lineB, next, cur); // stores tangent & miter
|
|
398
|
+
|
|
399
|
+
var _computeMiter3 = computeMiter(tangent, vec2.create(), lineA, lineB, this.thickness),
|
|
400
|
+
_computeMiter4 = _slicedToArray(_computeMiter3, 2),
|
|
401
|
+
miterLen = _computeMiter4[0],
|
|
402
|
+
miter = _computeMiter4[1]; // normal(tmp, lineA)
|
|
370
403
|
// get orientation
|
|
404
|
+
|
|
405
|
+
|
|
371
406
|
var flip = vec2.dot(tangent, this.normal) < 0 ? -1 : 1;
|
|
372
407
|
var bevel = joinBevel;
|
|
408
|
+
|
|
373
409
|
if (!bevel && this.join === 'miter') {
|
|
374
410
|
var limit = miterLen;
|
|
411
|
+
|
|
375
412
|
if (limit > this.miterLimit) {
|
|
376
413
|
bevel = true;
|
|
377
414
|
}
|
|
378
415
|
}
|
|
416
|
+
|
|
379
417
|
if (bevel) {
|
|
380
418
|
normals.push(this.normal[0], this.normal[1], 0);
|
|
381
419
|
normals.push(miter[0], miter[1], 0);
|
|
@@ -384,12 +422,12 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
384
422
|
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness * flip, cur[2] | 0);
|
|
385
423
|
this.complex.indexes.push(this.currentIndex);
|
|
386
424
|
this.currentIndex++;
|
|
387
|
-
indices.push.apply(indices, _toConsumableArray(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
425
|
+
indices.push.apply(indices, _toConsumableArray(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3])); // now add the bevel triangle
|
|
388
426
|
|
|
389
|
-
// now add the bevel triangle
|
|
390
427
|
indices.push(index + 2, index + 3, index + 4);
|
|
391
428
|
computeNormal(tmp, lineB);
|
|
392
429
|
vec2.copy(this.normal, tmp); // store normal for next round
|
|
430
|
+
|
|
393
431
|
normals.push(this.normal[0], this.normal[1], 0);
|
|
394
432
|
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
|
|
395
433
|
this.complex.indexes.push(this.currentIndex);
|
|
@@ -398,14 +436,15 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
398
436
|
} else {
|
|
399
437
|
this.extrusions(positions, normals, cur, miter, miterLen, this.totalDistance);
|
|
400
438
|
indices.push.apply(indices, _toConsumableArray(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
401
|
-
flip = -1;
|
|
439
|
+
flip = -1; // the miter is now the normal for our next join
|
|
402
440
|
|
|
403
|
-
// the miter is now the normal for our next join
|
|
404
441
|
vec2.copy(this.normal, miter);
|
|
405
442
|
count += 2;
|
|
406
443
|
}
|
|
444
|
+
|
|
407
445
|
this.lastFlip = flip;
|
|
408
446
|
}
|
|
447
|
+
|
|
409
448
|
return count;
|
|
410
449
|
}
|
|
411
450
|
}, {
|
|
@@ -418,23 +457,25 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
418
457
|
var capSquare = this.cap === 'square';
|
|
419
458
|
var joinBevel = this.join === 'bevel';
|
|
420
459
|
var flatCur = aProjectFlat([cur[0], cur[1]]);
|
|
421
|
-
var flatLast = aProjectFlat([last[0], last[1]]);
|
|
422
|
-
|
|
460
|
+
var flatLast = aProjectFlat([last[0], last[1]]); // @ts-ignore
|
|
461
|
+
|
|
423
462
|
direction(lineA, flatCur, flatLast);
|
|
424
463
|
var segmentDistance = 0;
|
|
464
|
+
|
|
425
465
|
if (this.dash) {
|
|
426
466
|
// @ts-ignore
|
|
427
467
|
segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
|
|
428
468
|
this.totalDistance += segmentDistance;
|
|
429
469
|
}
|
|
470
|
+
|
|
430
471
|
if (!this.normal) {
|
|
431
472
|
this.normal = vec2.create();
|
|
432
473
|
computeNormal(this.normal, lineA);
|
|
433
474
|
}
|
|
475
|
+
|
|
434
476
|
if (!this.started) {
|
|
435
|
-
this.started = true;
|
|
477
|
+
this.started = true; // if the end cap is type square, we can just push the verts out a bit
|
|
436
478
|
|
|
437
|
-
// if the end cap is type square, we can just push the verts out a bit
|
|
438
479
|
if (capSquare) {
|
|
439
480
|
// vec2.scaleAndAdd(capEnd, last, lineA, -this.thickness);
|
|
440
481
|
var out1 = vec2.create();
|
|
@@ -447,24 +488,28 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
447
488
|
this.complex.indexes.push(this.currentIndex);
|
|
448
489
|
positions.push(last[0], last[1], last[2] | 0, this.totalDistance - segmentDistance, this.thickness, last[2] | 0);
|
|
449
490
|
this.complex.indexes.push(this.currentIndex);
|
|
450
|
-
this.currentIndex++;
|
|
451
|
-
// this.extrusions(positions, normals, last, out, this.thickness);
|
|
491
|
+
this.currentIndex++; // this.extrusions(positions, normals, last, out, this.thickness);
|
|
452
492
|
// last = capEnd;
|
|
453
493
|
} else {
|
|
454
494
|
this.extrusions(positions, normals, last, this.normal, this.thickness, this.totalDistance - segmentDistance);
|
|
455
495
|
}
|
|
456
496
|
}
|
|
497
|
+
|
|
457
498
|
indices.push(index + 0, index + 1, index + 2);
|
|
499
|
+
|
|
458
500
|
if (!next) {
|
|
459
501
|
computeNormal(this.normal, lineA);
|
|
502
|
+
|
|
460
503
|
if (capSquare) {
|
|
461
504
|
// vec2.scaleAndAdd(capEnd, cur, lineA, this.thickness);
|
|
462
505
|
// cur = capEnd;
|
|
463
506
|
var _out3 = vec2.create();
|
|
507
|
+
|
|
464
508
|
var _out4 = vec2.create();
|
|
509
|
+
|
|
465
510
|
vec2.sub(_out4, lineA, this.normal);
|
|
466
|
-
vec2.add(_out3, lineA, this.normal);
|
|
467
|
-
|
|
511
|
+
vec2.add(_out3, lineA, this.normal); // this.extrusions(positions, normals, cur, out, this.thickness);
|
|
512
|
+
|
|
468
513
|
normals.push(_out4[0], _out4[1], 0);
|
|
469
514
|
normals.push(_out3[0], _out3[1], 0);
|
|
470
515
|
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness, cur[2] | 0);
|
|
@@ -474,35 +519,38 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
474
519
|
this.currentIndex++;
|
|
475
520
|
} else {
|
|
476
521
|
this.extrusions(positions, normals, cur, this.normal, this.thickness, this.totalDistance);
|
|
477
|
-
}
|
|
522
|
+
} // this.extrusions(positions, normals, cur, this.normal, this.thickness);
|
|
523
|
+
|
|
478
524
|
|
|
479
|
-
// this.extrusions(positions, normals, cur, this.normal, this.thickness);
|
|
480
525
|
indices.push.apply(indices, _toConsumableArray(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
481
526
|
count += 2;
|
|
482
527
|
} else {
|
|
483
528
|
var flatNext = aProjectFlat([next[0], next[1]]);
|
|
529
|
+
|
|
484
530
|
if (isPointEqual(flatCur, flatNext)) {
|
|
485
531
|
vec2.add(flatNext, flatCur, vec2.normalize(flatNext, vec2.subtract(flatNext, flatCur, flatLast)));
|
|
486
532
|
}
|
|
487
|
-
direction(lineB, flatNext, flatCur);
|
|
488
533
|
|
|
489
|
-
// stores tangent & miter
|
|
534
|
+
direction(lineB, flatNext, flatCur); // stores tangent & miter
|
|
490
535
|
|
|
491
536
|
var _computeMiter5 = computeMiter(tangent, vec2.create(), lineA, lineB, this.thickness),
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
// normal(tmp, lineA)
|
|
496
|
-
|
|
537
|
+
_computeMiter6 = _slicedToArray(_computeMiter5, 2),
|
|
538
|
+
miterLen = _computeMiter6[0],
|
|
539
|
+
miter = _computeMiter6[1]; // normal(tmp, lineA)
|
|
497
540
|
// get orientation
|
|
541
|
+
|
|
542
|
+
|
|
498
543
|
var flip = vec2.dot(tangent, this.normal) < 0 ? -1 : 1;
|
|
499
544
|
var bevel = joinBevel;
|
|
545
|
+
|
|
500
546
|
if (!bevel && this.join === 'miter') {
|
|
501
547
|
var limit = miterLen;
|
|
548
|
+
|
|
502
549
|
if (limit > this.miterLimit) {
|
|
503
550
|
bevel = true;
|
|
504
551
|
}
|
|
505
552
|
}
|
|
553
|
+
|
|
506
554
|
if (bevel) {
|
|
507
555
|
normals.push(this.normal[0], this.normal[1], 0);
|
|
508
556
|
normals.push(miter[0], miter[1], 0);
|
|
@@ -511,12 +559,12 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
511
559
|
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness * flip, cur[2] | 0);
|
|
512
560
|
this.complex.indexes.push(this.currentIndex);
|
|
513
561
|
this.currentIndex++;
|
|
514
|
-
indices.push.apply(indices, _toConsumableArray(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
562
|
+
indices.push.apply(indices, _toConsumableArray(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3])); // now add the bevel triangle
|
|
515
563
|
|
|
516
|
-
// now add the bevel triangle
|
|
517
564
|
indices.push(index + 2, index + 3, index + 4);
|
|
518
565
|
computeNormal(tmp, lineB);
|
|
519
566
|
vec2.copy(this.normal, tmp); // store normal for next round
|
|
567
|
+
|
|
520
568
|
normals.push(this.normal[0], this.normal[1], 0);
|
|
521
569
|
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
|
|
522
570
|
this.complex.indexes.push(this.currentIndex);
|
|
@@ -525,24 +573,22 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
525
573
|
} else {
|
|
526
574
|
this.extrusions(positions, normals, cur, miter, miterLen, this.totalDistance);
|
|
527
575
|
indices.push.apply(indices, _toConsumableArray(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
528
|
-
flip = -1;
|
|
576
|
+
flip = -1; // the miter is now the normal for our next join
|
|
529
577
|
|
|
530
|
-
// the miter is now the normal for our next join
|
|
531
578
|
vec2.copy(this.normal, miter);
|
|
532
579
|
count += 2;
|
|
533
580
|
}
|
|
581
|
+
|
|
534
582
|
this.lastFlip = flip;
|
|
535
583
|
}
|
|
584
|
+
|
|
536
585
|
return count;
|
|
537
586
|
}
|
|
538
587
|
}, {
|
|
539
588
|
key: "extrusions",
|
|
540
|
-
value: function extrusions(positions, normals, point,
|
|
541
|
-
//
|
|
542
|
-
|
|
543
|
-
// 法向量
|
|
544
|
-
thickness,
|
|
545
|
-
// 高度
|
|
589
|
+
value: function extrusions(positions, normals, point, // 顶点
|
|
590
|
+
normal, // 法向量
|
|
591
|
+
thickness, // 高度
|
|
546
592
|
distanceRadio) {
|
|
547
593
|
normals.push(normal[0], normal[1], 0);
|
|
548
594
|
normals.push(normal[0], normal[1], 0);
|
|
@@ -560,6 +606,8 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
560
606
|
return Math.sqrt(dx * dx + dy * dy);
|
|
561
607
|
}
|
|
562
608
|
}]);
|
|
609
|
+
|
|
563
610
|
return ExtrudePolyline;
|
|
564
611
|
}();
|
|
612
|
+
|
|
565
613
|
export { ExtrudePolyline as default };
|