@wcardinal/wcardinal-ui 0.469.0-beta.0 → 0.469.0-beta.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/types/wcardinal/ui/shape/variant/e-shape-fan-triangulated-impl.d.ts +11 -9
- package/dist/wcardinal/ui/shape/variant/e-shape-fan-triangulated-impl.js +71 -42
- package/dist/wcardinal/ui/shape/variant/e-shape-fan-triangulated-impl.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +72 -43
- package/dist/wcardinal-ui.js +72 -43
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
package/dist/wcardinal-ui.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Winter Cardinal UI v0.469.0-beta.
|
|
2
|
+
Winter Cardinal UI v0.469.0-beta.1
|
|
3
3
|
Copyright (C) 2019-2026 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -70274,8 +70274,8 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
|
70274
70274
|
// The number of the arc segments is 2n and the number of the points on the arc is m.
|
|
70275
70275
|
var n = EShapeDefaults.CIRCLE_SEGMENT_COUNT >> 2;
|
|
70276
70276
|
var m = 2 * n + 1;
|
|
70277
|
-
var nv =
|
|
70278
|
-
var ni = 4 * n + 2 * (n +
|
|
70277
|
+
var nv = 4 * (m - 1) + 2 * (n + 4);
|
|
70278
|
+
var ni = 4 * n + 2 * (n + 2);
|
|
70279
70279
|
this._nvertices = nv;
|
|
70280
70280
|
this._nindices = ni;
|
|
70281
70281
|
this._id += 1;
|
|
@@ -70335,7 +70335,7 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
|
70335
70335
|
var capped = !sided && !isExact;
|
|
70336
70336
|
var chained = sided || capped;
|
|
70337
70337
|
this.computeArcPoints(w, h, n, ea, sea, cea);
|
|
70338
|
-
this.computeArcNormals(w, h, n
|
|
70338
|
+
this.computeArcNormals(w, h, n);
|
|
70339
70339
|
var dmax = this.computeMedialPoints(w, h, n, st, ct, chained);
|
|
70340
70340
|
if (capped) {
|
|
70341
70341
|
// The distance field of the arc must cover O, which is the farthest point from the arc,
|
|
@@ -70353,10 +70353,10 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
|
70353
70353
|
boundary[3] = 0;
|
|
70354
70354
|
var fd = 1 / dmax;
|
|
70355
70355
|
var fs = (EShapeFanTriangulatedImpl.SCALE - 1) * dmax;
|
|
70356
|
-
this.computeRimPoints(
|
|
70357
|
-
// Strip:
|
|
70356
|
+
this.computeRimPoints(n, fs, st, ct, sided);
|
|
70357
|
+
// Strip: 4 * (m - 1) vertices and 2 * 3 * (m - 1) indices
|
|
70358
70358
|
this.writeStrip(m, fd, fx, fy, gx, gy);
|
|
70359
|
-
var iv =
|
|
70359
|
+
var iv = 4 * (m - 1);
|
|
70360
70360
|
var ii = 6 * (m - 1);
|
|
70361
70361
|
// Polygons at the bottom: left (sign = -1) and right (sign = +1)
|
|
70362
70362
|
if (sided) {
|
|
@@ -70411,12 +70411,12 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
|
70411
70411
|
}
|
|
70412
70412
|
};
|
|
70413
70413
|
/**
|
|
70414
|
-
* Computes the unit inward normals of the arc, the speeds of the arc, and the
|
|
70414
|
+
* Computes the unit inward normals of the arc, the speeds of the arc, and the lengths of the polyline at P[k].
|
|
70415
70415
|
*
|
|
70416
70416
|
* The normal at P is Np = (-h x / w, -w y / h), whose magnitude is the speed of the arc.
|
|
70417
|
-
* The
|
|
70417
|
+
* The lengths are the ones of the polyline, which is the actual outline, so that they are exact at clipping = 1.
|
|
70418
70418
|
*/
|
|
70419
|
-
EShapeFanTriangulatedImpl.prototype.computeArcNormals = function (w, h, n
|
|
70419
|
+
EShapeFanTriangulatedImpl.prototype.computeArcNormals = function (w, h, n) {
|
|
70420
70420
|
var m = 2 * n + 1;
|
|
70421
70421
|
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
70422
70422
|
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
@@ -70424,11 +70424,9 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
|
70424
70424
|
var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
|
|
70425
70425
|
var speeds = EShapeFanTriangulatedImpl.WORK_SPEED;
|
|
70426
70426
|
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
70427
|
-
var da = ea / n;
|
|
70428
70427
|
var hw = h / w;
|
|
70429
70428
|
var wh = w / h;
|
|
70430
70429
|
var l = 0;
|
|
70431
|
-
var previous = 0;
|
|
70432
70430
|
for (var k = 0; k <= n; ++k) {
|
|
70433
70431
|
var dx = -hw * px[k];
|
|
70434
70432
|
var dy = -wh * py[k];
|
|
@@ -70437,9 +70435,10 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
|
70437
70435
|
ny[k] = dy / speed;
|
|
70438
70436
|
speeds[k] = speed;
|
|
70439
70437
|
if (0 < k) {
|
|
70440
|
-
|
|
70438
|
+
var ex = px[k] - px[k - 1];
|
|
70439
|
+
var ey = py[k] - py[k - 1];
|
|
70440
|
+
l += Math.sqrt(ex * ex + ey * ey);
|
|
70441
70441
|
}
|
|
70442
|
-
previous = speed;
|
|
70443
70442
|
ls[k] = l;
|
|
70444
70443
|
}
|
|
70445
70444
|
for (var k = 0; k < n; ++k) {
|
|
@@ -70516,24 +70515,21 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
|
70516
70515
|
return dmax;
|
|
70517
70516
|
};
|
|
70518
70517
|
/**
|
|
70519
|
-
* Computes R[k], the points on the arc shifted outward by fs
|
|
70518
|
+
* Computes R[k], the points on the arc shifted outward by fs.
|
|
70520
70519
|
* If the straight sides are the outline, the end points are shifted
|
|
70521
70520
|
* to the intersections of the shifted arc and the shifted straight sides.
|
|
70522
70521
|
*/
|
|
70523
|
-
EShapeFanTriangulatedImpl.prototype.computeRimPoints = function (
|
|
70522
|
+
EShapeFanTriangulatedImpl.prototype.computeRimPoints = function (n, fs, st, ct, sided) {
|
|
70524
70523
|
var m = 2 * n + 1;
|
|
70525
70524
|
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
70526
70525
|
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
70527
70526
|
var nx = EShapeFanTriangulatedImpl.WORK_NORMAL_X;
|
|
70528
70527
|
var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
|
|
70529
|
-
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
70530
70528
|
var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
|
|
70531
70529
|
var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
|
|
70532
|
-
var rl = EShapeFanTriangulatedImpl.WORK_RIM_L;
|
|
70533
70530
|
for (var k = 0; k < m; ++k) {
|
|
70534
70531
|
var x = px[k] - fs * nx[k];
|
|
70535
70532
|
var y = py[k] - fs * ny[k];
|
|
70536
|
-
var l = ls[k];
|
|
70537
70533
|
if (sided && (k === 0 || k === m - 1)) {
|
|
70538
70534
|
var sign = k === 0 ? -1 : +1;
|
|
70539
70535
|
// The miter of the outward normal of the arc (n1) and that of the straight side (n2)
|
|
@@ -70544,44 +70540,63 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
|
70544
70540
|
var miter = fs / Math.max(1 + n1x * n2x + n1y * n2y, 0.05);
|
|
70545
70541
|
x = px[k] + miter * (n1x + n2x);
|
|
70546
70542
|
y = py[k] + miter * (n1y + n2y);
|
|
70547
|
-
// The length is shifted along the tangent (tx, ty) / speed
|
|
70548
|
-
var tx = w * cea;
|
|
70549
|
-
var ty = sign * h * sea;
|
|
70550
|
-
l +=
|
|
70551
|
-
((x - px[k]) * tx + (y - py[k]) * ty) / EShapeFanTriangulatedImpl.WORK_SPEED[0];
|
|
70552
70543
|
}
|
|
70553
70544
|
rx[k] = x;
|
|
70554
70545
|
ry[k] = y;
|
|
70555
|
-
rl[k] = l;
|
|
70556
70546
|
}
|
|
70557
70547
|
};
|
|
70558
70548
|
/**
|
|
70559
|
-
* Writes the strip P[k], P[k + 1], Q[k + 1], Q[k] with the vertices R[k] and Q[k].
|
|
70549
|
+
* Writes the strip P[k], P[k + 1], Q[k + 1], Q[k] with the vertices R[k], Q[k], R[k + 1] and Q[k + 1].
|
|
70550
|
+
*
|
|
70551
|
+
* Each quad owns its vertices. The length in a quad is the length at P[k] plus the projection
|
|
70552
|
+
* to the chord P[k]P[k + 1], which is exact at clipping = 1 where the chord is the outline.
|
|
70560
70553
|
*/
|
|
70561
70554
|
EShapeFanTriangulatedImpl.prototype.writeStrip = function (m, fd, fx, fy, gx, gy) {
|
|
70555
|
+
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
70556
|
+
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
70562
70557
|
var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
|
|
70563
70558
|
var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
|
|
70564
70559
|
var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
|
|
70565
70560
|
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
70566
70561
|
var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
|
|
70567
70562
|
var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
|
|
70568
|
-
var rl = EShapeFanTriangulatedImpl.WORK_RIM_L;
|
|
70569
70563
|
var scale = EShapeFanTriangulatedImpl.SCALE;
|
|
70570
70564
|
var indices = this._indices;
|
|
70571
70565
|
var iv = 0;
|
|
70572
70566
|
var ii = 0;
|
|
70573
|
-
for (var k = 0; k < m; ++k) {
|
|
70574
|
-
|
|
70575
|
-
|
|
70576
|
-
|
|
70577
|
-
|
|
70578
|
-
|
|
70579
|
-
|
|
70580
|
-
|
|
70581
|
-
|
|
70582
|
-
|
|
70583
|
-
|
|
70584
|
-
|
|
70567
|
+
for (var k = 0; k < m - 1; ++k) {
|
|
70568
|
+
var x0 = px[k];
|
|
70569
|
+
var y0 = py[k];
|
|
70570
|
+
var l0 = ls[k];
|
|
70571
|
+
var dl = ls[k + 1] - l0;
|
|
70572
|
+
var fl = 0 < dl ? 1 / dl : 0;
|
|
70573
|
+
var ex = (px[k + 1] - x0) * fl;
|
|
70574
|
+
var ey = (py[k + 1] - y0) * fl;
|
|
70575
|
+
var r0x = rx[k];
|
|
70576
|
+
var r0y = ry[k];
|
|
70577
|
+
var q0x = qx[k];
|
|
70578
|
+
var q0y = qy[k];
|
|
70579
|
+
var r1x = rx[k + 1];
|
|
70580
|
+
var r1y = ry[k + 1];
|
|
70581
|
+
var q1x = qx[k + 1];
|
|
70582
|
+
var q1y = qy[k + 1];
|
|
70583
|
+
var lr0 = l0 + (r0x - x0) * ex + (r0y - y0) * ey;
|
|
70584
|
+
var lq0 = l0 + (q0x - x0) * ex + (q0y - y0) * ey;
|
|
70585
|
+
var lr1 = l0 + (r1x - x0) * ex + (r1y - y0) * ey;
|
|
70586
|
+
var lq1 = l0 + (q1x - x0) * ex + (q1y - y0) * ey;
|
|
70587
|
+
var cq0 = 1 - qd[k] * fd;
|
|
70588
|
+
var cq1 = 1 - qd[k + 1] * fd;
|
|
70589
|
+
this.writeVertex(iv, r0x, r0y, lr0, scale, fd, fx, fy, gx, gy);
|
|
70590
|
+
this.writeVertex(iv + 1, q0x, q0y, lq0, cq0, fd, fx, fy, gx, gy);
|
|
70591
|
+
this.writeVertex(iv + 2, r1x, r1y, lr1, scale, fd, fx, fy, gx, gy);
|
|
70592
|
+
this.writeVertex(iv + 3, q1x, q1y, lq1, cq1, fd, fx, fy, gx, gy);
|
|
70593
|
+
indices[ii++] = iv;
|
|
70594
|
+
indices[ii++] = iv + 2;
|
|
70595
|
+
indices[ii++] = iv + 3;
|
|
70596
|
+
indices[ii++] = iv;
|
|
70597
|
+
indices[ii++] = iv + 3;
|
|
70598
|
+
indices[ii++] = iv + 1;
|
|
70599
|
+
iv += 4;
|
|
70585
70600
|
}
|
|
70586
70601
|
};
|
|
70587
70602
|
/**
|
|
@@ -70614,8 +70629,23 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
|
70614
70629
|
for (var j = 0; j <= n; ++j) {
|
|
70615
70630
|
var k = sign < 0 ? j : m - 1 - j;
|
|
70616
70631
|
var floor = 1 - qd[k] * fd;
|
|
70632
|
+
var isOnAxis = Math.abs(qx[k]) <= eps;
|
|
70633
|
+
// Where Q is clamped, the clipping of the side reaches the floor at T on the axis before Q.
|
|
70634
|
+
// Without T, the clipping on the axis is not linear and a dent appears at O.
|
|
70635
|
+
var ty = -qd[k] / st;
|
|
70636
|
+
if (isOnAxis && qy[k] < ty - eps) {
|
|
70637
|
+
this.writeSideVertex(iv + count++, 0, ty, floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
70638
|
+
this.writeFan(ii, iv, count);
|
|
70639
|
+
this.writeSideVertex(iv + count, qx[k], qy[k], floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
70640
|
+
var indices = this._indices;
|
|
70641
|
+
var i = ii + 3 * (count - 2);
|
|
70642
|
+
indices[i] = iv + count - 2;
|
|
70643
|
+
indices[i + 1] = iv + count;
|
|
70644
|
+
indices[i + 2] = iv + count - 1;
|
|
70645
|
+
return count + 1;
|
|
70646
|
+
}
|
|
70617
70647
|
this.writeSideVertex(iv + count++, qx[k], qy[k], floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
70618
|
-
if (
|
|
70648
|
+
if (isOnAxis) {
|
|
70619
70649
|
break;
|
|
70620
70650
|
}
|
|
70621
70651
|
}
|
|
@@ -70794,7 +70824,7 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
|
70794
70824
|
/** P: the points on the arc */
|
|
70795
70825
|
EShapeFanTriangulatedImpl.WORK_ARC_X = [];
|
|
70796
70826
|
EShapeFanTriangulatedImpl.WORK_ARC_Y = [];
|
|
70797
|
-
/** The
|
|
70827
|
+
/** The lengths of the polyline P[0], ..., P[k] */
|
|
70798
70828
|
EShapeFanTriangulatedImpl.WORK_ARC_L = [];
|
|
70799
70829
|
/** The unit inward normals of the arc */
|
|
70800
70830
|
EShapeFanTriangulatedImpl.WORK_NORMAL_X = [];
|
|
@@ -70806,10 +70836,9 @@ var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
|
70806
70836
|
EShapeFanTriangulatedImpl.WORK_MEDIAL_Y = [];
|
|
70807
70837
|
/** The distances from P to Q */
|
|
70808
70838
|
EShapeFanTriangulatedImpl.WORK_MEDIAL_D = [];
|
|
70809
|
-
/** R: the points on the arc shifted outward
|
|
70839
|
+
/** R: the points on the arc shifted outward */
|
|
70810
70840
|
EShapeFanTriangulatedImpl.WORK_RIM_X = [];
|
|
70811
70841
|
EShapeFanTriangulatedImpl.WORK_RIM_Y = [];
|
|
70812
|
-
EShapeFanTriangulatedImpl.WORK_RIM_L = [];
|
|
70813
70842
|
return EShapeFanTriangulatedImpl;
|
|
70814
70843
|
}());
|
|
70815
70844
|
|
package/dist/wcardinal-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Winter Cardinal UI v0.469.0-beta.
|
|
2
|
+
Winter Cardinal UI v0.469.0-beta.1
|
|
3
3
|
Copyright (C) 2019-2026 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -48165,8 +48165,8 @@
|
|
|
48165
48165
|
// The number of the arc segments is 2n and the number of the points on the arc is m.
|
|
48166
48166
|
var n = EShapeDefaults.CIRCLE_SEGMENT_COUNT >> 2;
|
|
48167
48167
|
var m = 2 * n + 1;
|
|
48168
|
-
var nv =
|
|
48169
|
-
var ni = 4 * n + 2 * (n +
|
|
48168
|
+
var nv = 4 * (m - 1) + 2 * (n + 4);
|
|
48169
|
+
var ni = 4 * n + 2 * (n + 2);
|
|
48170
48170
|
this._nvertices = nv;
|
|
48171
48171
|
this._nindices = ni;
|
|
48172
48172
|
this._id += 1;
|
|
@@ -48226,7 +48226,7 @@
|
|
|
48226
48226
|
var capped = !sided && !isExact;
|
|
48227
48227
|
var chained = sided || capped;
|
|
48228
48228
|
this.computeArcPoints(w, h, n, ea, sea, cea);
|
|
48229
|
-
this.computeArcNormals(w, h, n
|
|
48229
|
+
this.computeArcNormals(w, h, n);
|
|
48230
48230
|
var dmax = this.computeMedialPoints(w, h, n, st, ct, chained);
|
|
48231
48231
|
if (capped) {
|
|
48232
48232
|
// The distance field of the arc must cover O, which is the farthest point from the arc,
|
|
@@ -48244,10 +48244,10 @@
|
|
|
48244
48244
|
boundary[3] = 0;
|
|
48245
48245
|
var fd = 1 / dmax;
|
|
48246
48246
|
var fs = (EShapeFanTriangulatedImpl.SCALE - 1) * dmax;
|
|
48247
|
-
this.computeRimPoints(
|
|
48248
|
-
// Strip:
|
|
48247
|
+
this.computeRimPoints(n, fs, st, ct, sided);
|
|
48248
|
+
// Strip: 4 * (m - 1) vertices and 2 * 3 * (m - 1) indices
|
|
48249
48249
|
this.writeStrip(m, fd, fx, fy, gx, gy);
|
|
48250
|
-
var iv =
|
|
48250
|
+
var iv = 4 * (m - 1);
|
|
48251
48251
|
var ii = 6 * (m - 1);
|
|
48252
48252
|
// Polygons at the bottom: left (sign = -1) and right (sign = +1)
|
|
48253
48253
|
if (sided) {
|
|
@@ -48302,12 +48302,12 @@
|
|
|
48302
48302
|
}
|
|
48303
48303
|
};
|
|
48304
48304
|
/**
|
|
48305
|
-
* Computes the unit inward normals of the arc, the speeds of the arc, and the
|
|
48305
|
+
* Computes the unit inward normals of the arc, the speeds of the arc, and the lengths of the polyline at P[k].
|
|
48306
48306
|
*
|
|
48307
48307
|
* The normal at P is Np = (-h x / w, -w y / h), whose magnitude is the speed of the arc.
|
|
48308
|
-
* The
|
|
48308
|
+
* The lengths are the ones of the polyline, which is the actual outline, so that they are exact at clipping = 1.
|
|
48309
48309
|
*/
|
|
48310
|
-
EShapeFanTriangulatedImpl.prototype.computeArcNormals = function (w, h, n
|
|
48310
|
+
EShapeFanTriangulatedImpl.prototype.computeArcNormals = function (w, h, n) {
|
|
48311
48311
|
var m = 2 * n + 1;
|
|
48312
48312
|
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48313
48313
|
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
@@ -48315,11 +48315,9 @@
|
|
|
48315
48315
|
var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
|
|
48316
48316
|
var speeds = EShapeFanTriangulatedImpl.WORK_SPEED;
|
|
48317
48317
|
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
48318
|
-
var da = ea / n;
|
|
48319
48318
|
var hw = h / w;
|
|
48320
48319
|
var wh = w / h;
|
|
48321
48320
|
var l = 0;
|
|
48322
|
-
var previous = 0;
|
|
48323
48321
|
for (var k = 0; k <= n; ++k) {
|
|
48324
48322
|
var dx = -hw * px[k];
|
|
48325
48323
|
var dy = -wh * py[k];
|
|
@@ -48328,9 +48326,10 @@
|
|
|
48328
48326
|
ny[k] = dy / speed;
|
|
48329
48327
|
speeds[k] = speed;
|
|
48330
48328
|
if (0 < k) {
|
|
48331
|
-
|
|
48329
|
+
var ex = px[k] - px[k - 1];
|
|
48330
|
+
var ey = py[k] - py[k - 1];
|
|
48331
|
+
l += Math.sqrt(ex * ex + ey * ey);
|
|
48332
48332
|
}
|
|
48333
|
-
previous = speed;
|
|
48334
48333
|
ls[k] = l;
|
|
48335
48334
|
}
|
|
48336
48335
|
for (var k = 0; k < n; ++k) {
|
|
@@ -48407,24 +48406,21 @@
|
|
|
48407
48406
|
return dmax;
|
|
48408
48407
|
};
|
|
48409
48408
|
/**
|
|
48410
|
-
* Computes R[k], the points on the arc shifted outward by fs
|
|
48409
|
+
* Computes R[k], the points on the arc shifted outward by fs.
|
|
48411
48410
|
* If the straight sides are the outline, the end points are shifted
|
|
48412
48411
|
* to the intersections of the shifted arc and the shifted straight sides.
|
|
48413
48412
|
*/
|
|
48414
|
-
EShapeFanTriangulatedImpl.prototype.computeRimPoints = function (
|
|
48413
|
+
EShapeFanTriangulatedImpl.prototype.computeRimPoints = function (n, fs, st, ct, sided) {
|
|
48415
48414
|
var m = 2 * n + 1;
|
|
48416
48415
|
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48417
48416
|
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
48418
48417
|
var nx = EShapeFanTriangulatedImpl.WORK_NORMAL_X;
|
|
48419
48418
|
var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
|
|
48420
|
-
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
48421
48419
|
var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
|
|
48422
48420
|
var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
|
|
48423
|
-
var rl = EShapeFanTriangulatedImpl.WORK_RIM_L;
|
|
48424
48421
|
for (var k = 0; k < m; ++k) {
|
|
48425
48422
|
var x = px[k] - fs * nx[k];
|
|
48426
48423
|
var y = py[k] - fs * ny[k];
|
|
48427
|
-
var l = ls[k];
|
|
48428
48424
|
if (sided && (k === 0 || k === m - 1)) {
|
|
48429
48425
|
var sign = k === 0 ? -1 : +1;
|
|
48430
48426
|
// The miter of the outward normal of the arc (n1) and that of the straight side (n2)
|
|
@@ -48435,44 +48431,63 @@
|
|
|
48435
48431
|
var miter = fs / Math.max(1 + n1x * n2x + n1y * n2y, 0.05);
|
|
48436
48432
|
x = px[k] + miter * (n1x + n2x);
|
|
48437
48433
|
y = py[k] + miter * (n1y + n2y);
|
|
48438
|
-
// The length is shifted along the tangent (tx, ty) / speed
|
|
48439
|
-
var tx = w * cea;
|
|
48440
|
-
var ty = sign * h * sea;
|
|
48441
|
-
l +=
|
|
48442
|
-
((x - px[k]) * tx + (y - py[k]) * ty) / EShapeFanTriangulatedImpl.WORK_SPEED[0];
|
|
48443
48434
|
}
|
|
48444
48435
|
rx[k] = x;
|
|
48445
48436
|
ry[k] = y;
|
|
48446
|
-
rl[k] = l;
|
|
48447
48437
|
}
|
|
48448
48438
|
};
|
|
48449
48439
|
/**
|
|
48450
|
-
* Writes the strip P[k], P[k + 1], Q[k + 1], Q[k] with the vertices R[k] and Q[k].
|
|
48440
|
+
* Writes the strip P[k], P[k + 1], Q[k + 1], Q[k] with the vertices R[k], Q[k], R[k + 1] and Q[k + 1].
|
|
48441
|
+
*
|
|
48442
|
+
* Each quad owns its vertices. The length in a quad is the length at P[k] plus the projection
|
|
48443
|
+
* to the chord P[k]P[k + 1], which is exact at clipping = 1 where the chord is the outline.
|
|
48451
48444
|
*/
|
|
48452
48445
|
EShapeFanTriangulatedImpl.prototype.writeStrip = function (m, fd, fx, fy, gx, gy) {
|
|
48446
|
+
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48447
|
+
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
48453
48448
|
var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
|
|
48454
48449
|
var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48455
48450
|
var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
|
|
48456
48451
|
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
48457
48452
|
var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
|
|
48458
48453
|
var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
|
|
48459
|
-
var rl = EShapeFanTriangulatedImpl.WORK_RIM_L;
|
|
48460
48454
|
var scale = EShapeFanTriangulatedImpl.SCALE;
|
|
48461
48455
|
var indices = this._indices;
|
|
48462
48456
|
var iv = 0;
|
|
48463
48457
|
var ii = 0;
|
|
48464
|
-
for (var k = 0; k < m; ++k) {
|
|
48465
|
-
|
|
48466
|
-
|
|
48467
|
-
|
|
48468
|
-
|
|
48469
|
-
|
|
48470
|
-
|
|
48471
|
-
|
|
48472
|
-
|
|
48473
|
-
|
|
48474
|
-
|
|
48475
|
-
|
|
48458
|
+
for (var k = 0; k < m - 1; ++k) {
|
|
48459
|
+
var x0 = px[k];
|
|
48460
|
+
var y0 = py[k];
|
|
48461
|
+
var l0 = ls[k];
|
|
48462
|
+
var dl = ls[k + 1] - l0;
|
|
48463
|
+
var fl = 0 < dl ? 1 / dl : 0;
|
|
48464
|
+
var ex = (px[k + 1] - x0) * fl;
|
|
48465
|
+
var ey = (py[k + 1] - y0) * fl;
|
|
48466
|
+
var r0x = rx[k];
|
|
48467
|
+
var r0y = ry[k];
|
|
48468
|
+
var q0x = qx[k];
|
|
48469
|
+
var q0y = qy[k];
|
|
48470
|
+
var r1x = rx[k + 1];
|
|
48471
|
+
var r1y = ry[k + 1];
|
|
48472
|
+
var q1x = qx[k + 1];
|
|
48473
|
+
var q1y = qy[k + 1];
|
|
48474
|
+
var lr0 = l0 + (r0x - x0) * ex + (r0y - y0) * ey;
|
|
48475
|
+
var lq0 = l0 + (q0x - x0) * ex + (q0y - y0) * ey;
|
|
48476
|
+
var lr1 = l0 + (r1x - x0) * ex + (r1y - y0) * ey;
|
|
48477
|
+
var lq1 = l0 + (q1x - x0) * ex + (q1y - y0) * ey;
|
|
48478
|
+
var cq0 = 1 - qd[k] * fd;
|
|
48479
|
+
var cq1 = 1 - qd[k + 1] * fd;
|
|
48480
|
+
this.writeVertex(iv, r0x, r0y, lr0, scale, fd, fx, fy, gx, gy);
|
|
48481
|
+
this.writeVertex(iv + 1, q0x, q0y, lq0, cq0, fd, fx, fy, gx, gy);
|
|
48482
|
+
this.writeVertex(iv + 2, r1x, r1y, lr1, scale, fd, fx, fy, gx, gy);
|
|
48483
|
+
this.writeVertex(iv + 3, q1x, q1y, lq1, cq1, fd, fx, fy, gx, gy);
|
|
48484
|
+
indices[ii++] = iv;
|
|
48485
|
+
indices[ii++] = iv + 2;
|
|
48486
|
+
indices[ii++] = iv + 3;
|
|
48487
|
+
indices[ii++] = iv;
|
|
48488
|
+
indices[ii++] = iv + 3;
|
|
48489
|
+
indices[ii++] = iv + 1;
|
|
48490
|
+
iv += 4;
|
|
48476
48491
|
}
|
|
48477
48492
|
};
|
|
48478
48493
|
/**
|
|
@@ -48505,8 +48520,23 @@
|
|
|
48505
48520
|
for (var j = 0; j <= n; ++j) {
|
|
48506
48521
|
var k = sign < 0 ? j : m - 1 - j;
|
|
48507
48522
|
var floor = 1 - qd[k] * fd;
|
|
48523
|
+
var isOnAxis = Math.abs(qx[k]) <= eps;
|
|
48524
|
+
// Where Q is clamped, the clipping of the side reaches the floor at T on the axis before Q.
|
|
48525
|
+
// Without T, the clipping on the axis is not linear and a dent appears at O.
|
|
48526
|
+
var ty = -qd[k] / st;
|
|
48527
|
+
if (isOnAxis && qy[k] < ty - eps) {
|
|
48528
|
+
this.writeSideVertex(iv + count++, 0, ty, floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
48529
|
+
this.writeFan(ii, iv, count);
|
|
48530
|
+
this.writeSideVertex(iv + count, qx[k], qy[k], floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
48531
|
+
var indices = this._indices;
|
|
48532
|
+
var i = ii + 3 * (count - 2);
|
|
48533
|
+
indices[i] = iv + count - 2;
|
|
48534
|
+
indices[i + 1] = iv + count;
|
|
48535
|
+
indices[i + 2] = iv + count - 1;
|
|
48536
|
+
return count + 1;
|
|
48537
|
+
}
|
|
48508
48538
|
this.writeSideVertex(iv + count++, qx[k], qy[k], floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
48509
|
-
if (
|
|
48539
|
+
if (isOnAxis) {
|
|
48510
48540
|
break;
|
|
48511
48541
|
}
|
|
48512
48542
|
}
|
|
@@ -48685,7 +48715,7 @@
|
|
|
48685
48715
|
/** P: the points on the arc */
|
|
48686
48716
|
EShapeFanTriangulatedImpl.WORK_ARC_X = [];
|
|
48687
48717
|
EShapeFanTriangulatedImpl.WORK_ARC_Y = [];
|
|
48688
|
-
/** The
|
|
48718
|
+
/** The lengths of the polyline P[0], ..., P[k] */
|
|
48689
48719
|
EShapeFanTriangulatedImpl.WORK_ARC_L = [];
|
|
48690
48720
|
/** The unit inward normals of the arc */
|
|
48691
48721
|
EShapeFanTriangulatedImpl.WORK_NORMAL_X = [];
|
|
@@ -48697,10 +48727,9 @@
|
|
|
48697
48727
|
EShapeFanTriangulatedImpl.WORK_MEDIAL_Y = [];
|
|
48698
48728
|
/** The distances from P to Q */
|
|
48699
48729
|
EShapeFanTriangulatedImpl.WORK_MEDIAL_D = [];
|
|
48700
|
-
/** R: the points on the arc shifted outward
|
|
48730
|
+
/** R: the points on the arc shifted outward */
|
|
48701
48731
|
EShapeFanTriangulatedImpl.WORK_RIM_X = [];
|
|
48702
48732
|
EShapeFanTriangulatedImpl.WORK_RIM_Y = [];
|
|
48703
|
-
EShapeFanTriangulatedImpl.WORK_RIM_L = [];
|
|
48704
48733
|
return EShapeFanTriangulatedImpl;
|
|
48705
48734
|
}());
|
|
48706
48735
|
|