@escapace/minimum-perimeter-triangle 0.2.0 → 0.2.2
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/README.md +6 -1
- package/lib/esm/index.mjs +101 -269
- package/lib/esm/index.mjs.map +1 -1
- package/package.json +22 -25
package/README.md
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @escapace/minimum-perimeter-triangle
|
|
2
|
+
|
|
3
|
+
A light adaptation of Victor Ermolaev's
|
|
4
|
+
[implementation](https://github.com/vnermolaev/minimal-perimeter-triangle) of an
|
|
5
|
+
algorithm that computes the minimum perimeter triangle enclosing a convex
|
|
6
|
+
polygon.
|
package/lib/esm/index.mjs
CHANGED
|
@@ -4,9 +4,7 @@ var Line = class {
|
|
|
4
4
|
end;
|
|
5
5
|
delta;
|
|
6
6
|
constructor(start, end) {
|
|
7
|
-
this.start = start;
|
|
8
|
-
this.end = end;
|
|
9
|
-
this.delta = end.minus(start);
|
|
7
|
+
this.start = start, this.end = end, this.delta = end.minus(start);
|
|
10
8
|
}
|
|
11
9
|
/**
|
|
12
10
|
* Length of a line is the length between its two defining points
|
|
@@ -21,11 +19,8 @@ var Line = class {
|
|
|
21
19
|
return Math.abs(p.cross(this.delta) - this.start.cross(this.end)) / this.delta.norm;
|
|
22
20
|
}
|
|
23
21
|
pointOnSide(p, err = 0) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return 0 /* Top */;
|
|
27
|
-
}
|
|
28
|
-
return num > 0 ? 1 /* Left */ : -1 /* Right */;
|
|
22
|
+
let num = this.start.cross(this.end) - p.cross(this.delta);
|
|
23
|
+
return num === 0 || Math.abs(num) / this.delta.norm < err ? 0 /* Top */ : num > 0 ? 1 /* Left */ : -1 /* Right */;
|
|
29
24
|
}
|
|
30
25
|
pointOnTop(p, err) {
|
|
31
26
|
return this.pointOnSide(p, err) === 0 /* Top */;
|
|
@@ -43,15 +38,14 @@ var Line = class {
|
|
|
43
38
|
* /
|
|
44
39
|
*/
|
|
45
40
|
parallel(that, deviationFromZeroAngle) {
|
|
46
|
-
|
|
41
|
+
let d = Math.abs(this.delta.cross(that.delta));
|
|
47
42
|
return d === 0 || d < this.length * this.length * Math.sin(deviationFromZeroAngle);
|
|
48
43
|
}
|
|
49
44
|
intersectionParameter(that, err) {
|
|
50
|
-
|
|
51
|
-
if (d === 0 || Math.abs(d) < err)
|
|
45
|
+
let d = this.delta.cross(that.delta);
|
|
46
|
+
if (d === 0 || Math.abs(d) < err)
|
|
52
47
|
return null;
|
|
53
|
-
|
|
54
|
-
const dStart = this.start.minus(that.start);
|
|
48
|
+
let dStart = this.start.minus(that.start);
|
|
55
49
|
return that.delta.cross(dStart) / d;
|
|
56
50
|
}
|
|
57
51
|
closestPointParam(p) {
|
|
@@ -61,7 +55,7 @@ var Line = class {
|
|
|
61
55
|
return this.evaluate(this.closestPointParam(p));
|
|
62
56
|
}
|
|
63
57
|
intersectionPoint(that, err) {
|
|
64
|
-
|
|
58
|
+
let t = this.intersectionParameter(that, err);
|
|
65
59
|
return t === null ? null : this.evaluate(t);
|
|
66
60
|
}
|
|
67
61
|
};
|
|
@@ -74,8 +68,7 @@ var Vec2 = class {
|
|
|
74
68
|
_norm;
|
|
75
69
|
_normalized;
|
|
76
70
|
constructor(x, y) {
|
|
77
|
-
this._x = x;
|
|
78
|
-
this._y = y;
|
|
71
|
+
this._x = x, this._y = y;
|
|
79
72
|
}
|
|
80
73
|
times(s) {
|
|
81
74
|
return new Vec2(this._x * s, this._y * s);
|
|
@@ -111,10 +104,7 @@ var Vec2 = class {
|
|
|
111
104
|
return this._x * that._y - this._y * that._x;
|
|
112
105
|
}
|
|
113
106
|
equals(that, err) {
|
|
114
|
-
|
|
115
|
-
return this.x === that.x && this.y === that.y;
|
|
116
|
-
}
|
|
117
|
-
return this.minus(that).normSquared < err * err;
|
|
107
|
+
return err === 0 ? this.x === that.x && this.y === that.y : this.minus(that).normSquared < err * err;
|
|
118
108
|
}
|
|
119
109
|
normal() {
|
|
120
110
|
return new Vec2(this._y, -this._x);
|
|
@@ -129,64 +119,39 @@ var Wedge = class {
|
|
|
129
119
|
leftArm;
|
|
130
120
|
rightArm;
|
|
131
121
|
isDegenerate;
|
|
132
|
-
constructor(leftArm, rightArm, isDegenerate =
|
|
133
|
-
this.leftArm = leftArm;
|
|
134
|
-
this.rightArm = rightArm;
|
|
135
|
-
this.isDegenerate = isDegenerate;
|
|
122
|
+
constructor(leftArm, rightArm, isDegenerate = !1) {
|
|
123
|
+
this.leftArm = leftArm, this.rightArm = rightArm, this.isDegenerate = isDegenerate;
|
|
136
124
|
}
|
|
137
125
|
static new(leftArm, rightArm, err) {
|
|
138
|
-
if (leftArm === null || rightArm === null)
|
|
126
|
+
if (leftArm === null || rightArm === null || err !== 0 && leftArm.overlaps(rightArm, err))
|
|
139
127
|
return null;
|
|
140
|
-
|
|
141
|
-
if (err !== 0 && leftArm.overlaps(rightArm, err)) {
|
|
142
|
-
return null;
|
|
143
|
-
}
|
|
144
|
-
const deviationFromZeroAngle = 0.1 / (leftArm.length * rightArm.length);
|
|
128
|
+
let deviationFromZeroAngle = 0.1 / (leftArm.length * rightArm.length);
|
|
145
129
|
if (leftArm.parallel(rightArm, deviationFromZeroAngle)) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const sideLeft = leftArm.pointOnSide(p, err);
|
|
149
|
-
const sideRight = rightArm.pointOnSide(p, err);
|
|
150
|
-
if (sideLeft === 0 /* Top */ || sideRight === 0 /* Top */) {
|
|
130
|
+
let p = new Line(leftArm.evaluate(0.5), rightArm.evaluate(0.5)).evaluate(0.5), sideLeft = leftArm.pointOnSide(p, err), sideRight = rightArm.pointOnSide(p, err);
|
|
131
|
+
if (sideLeft === 0 /* Top */ || sideRight === 0 /* Top */)
|
|
151
132
|
throw new Error();
|
|
152
|
-
|
|
153
|
-
return sideLeft !== sideRight ? new Wedge(leftArm, rightArm, true) : new Wedge(leftArm, new Line(rightArm.end, rightArm.start));
|
|
133
|
+
return sideLeft !== sideRight ? new Wedge(leftArm, rightArm, !0) : new Wedge(leftArm, new Line(rightArm.end, rightArm.start));
|
|
154
134
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if (tLA === 0.5 || tRA === 0.5) {
|
|
135
|
+
let tLA = leftArm.intersectionParameter(rightArm, 0), tRA = rightArm.intersectionParameter(leftArm, 0);
|
|
136
|
+
if (tLA === 0.5 || tRA === 0.5)
|
|
158
137
|
return null;
|
|
159
|
-
|
|
160
|
-
const W = leftArm.evaluate(tLA);
|
|
161
|
-
const eLA = tLA < 1 - tLA ? leftArm.end : leftArm.start;
|
|
162
|
-
const eRA = tRA < 1 - tRA ? rightArm.end : rightArm.start;
|
|
138
|
+
let W = leftArm.evaluate(tLA), eLA = tLA < 1 - tLA ? leftArm.end : leftArm.start, eRA = tRA < 1 - tRA ? rightArm.end : rightArm.start;
|
|
163
139
|
return new Wedge(new Line(W, eLA), new Line(W, eRA));
|
|
164
140
|
}
|
|
165
141
|
formTriangle(line, err) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const A = line.intersectionPoint(this.leftArm, 0);
|
|
171
|
-
const B = line.intersectionPoint(this.rightArm, 0);
|
|
172
|
-
if (this.isDegenerate) {
|
|
142
|
+
if (this.leftArm.parallel(line, 0.1 / (this.leftArm.length * line.length)) || this.rightArm.parallel(line, 0.1 / (this.rightArm.length * line.length)))
|
|
143
|
+
return !1;
|
|
144
|
+
let A = line.intersectionPoint(this.leftArm, 0), B = line.intersectionPoint(this.rightArm, 0);
|
|
145
|
+
if (this.isDegenerate)
|
|
173
146
|
return !A.equals(B, err);
|
|
174
|
-
|
|
175
|
-
const C = this.leftArm.intersectionPoint(this.rightArm, 0);
|
|
147
|
+
let C = this.leftArm.intersectionPoint(this.rightArm, 0);
|
|
176
148
|
return !C.equals(A, err) && !C.equals(B, err) && !A.equals(B, err) && !new Line(A, B).pointOnTop(C, err);
|
|
177
149
|
}
|
|
178
150
|
looselyContains(p, err) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (pLeft === 0 /* Top */ || pRight === 0 /* Top */) {
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
if (pLeft === pRight) {
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
return this.isDegenerate ? (
|
|
151
|
+
let pLeft = this.leftArm.pointOnSide(p, err), pRight = this.rightArm.pointOnSide(p, err);
|
|
152
|
+
return pLeft === 0 /* Top */ || pRight === 0 /* Top */ ? !0 : pLeft === pRight ? !1 : this.isDegenerate ? (
|
|
188
153
|
// degenerate + different sides => true
|
|
189
|
-
|
|
154
|
+
!0
|
|
190
155
|
) : (
|
|
191
156
|
// 2. (Because the arms intersect)
|
|
192
157
|
// Projection params of the point onto the arms must be larger than 0
|
|
@@ -194,17 +159,10 @@ var Wedge = class {
|
|
|
194
159
|
);
|
|
195
160
|
}
|
|
196
161
|
strictlyContains(p, err) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (pLeft === 0 /* Top */ || pRight === 0 /* Top */) {
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
if (pLeft === pRight) {
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
return this.isDegenerate ? (
|
|
162
|
+
let pLeft = this.leftArm.pointOnSide(p, err), pRight = this.rightArm.pointOnSide(p, err);
|
|
163
|
+
return pLeft === 0 /* Top */ || pRight === 0 /* Top */ || pLeft === pRight ? !1 : this.isDegenerate ? (
|
|
206
164
|
// degenerate + different sides => true
|
|
207
|
-
|
|
165
|
+
!0
|
|
208
166
|
) : (
|
|
209
167
|
// 2. (Because the arms intersect)
|
|
210
168
|
// Projection params of the point onto the arms must be larger than 0
|
|
@@ -219,51 +177,26 @@ var Wedge = class {
|
|
|
219
177
|
// 4. Wedge is non-degenerate and additional element is a line
|
|
220
178
|
// according to these assumptions, the following methods are named
|
|
221
179
|
fit_Dp(p, err) {
|
|
222
|
-
if (!this.strictlyContains(p, err))
|
|
180
|
+
if (!this.strictlyContains(p, err))
|
|
223
181
|
return null;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
const Ap = this.leftArm.closestPoint(A);
|
|
227
|
-
const I = A.plus(Ap).over(2);
|
|
228
|
-
const r = A.minus(Ap).norm / 2;
|
|
229
|
-
const a = this.rightArm.delta.normSquared;
|
|
230
|
-
const b = I.minus(p).dot(this.rightArm.delta) * 2;
|
|
231
|
-
const c = I.minus(p).normSquared - r * r;
|
|
232
|
-
const discriminant = b * b - 4 * a * c;
|
|
233
|
-
if (discriminant < (-10) ** -5) {
|
|
182
|
+
let A = this.rightArm.closestPoint(p), Ap = this.leftArm.closestPoint(A), I = A.plus(Ap).over(2), r = A.minus(Ap).norm / 2, a = this.rightArm.delta.normSquared, b = I.minus(p).dot(this.rightArm.delta) * 2, c = I.minus(p).normSquared - r * r, discriminant = b * b - 4 * a * c;
|
|
183
|
+
if (discriminant < (-10) ** -5)
|
|
234
184
|
return null;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
t.push((-b + Math.sqrt(discriminant)) / (2 * a));
|
|
241
|
-
t.push((-b - Math.sqrt(discriminant)) / (2 * a));
|
|
242
|
-
}
|
|
243
|
-
const result = [];
|
|
244
|
-
t.forEach((t0) => {
|
|
245
|
-
const O = this.rightArm.delta.times(t0).plus(I);
|
|
185
|
+
let t = [];
|
|
186
|
+
Math.abs(discriminant) < 10 ** -5 ? t.push(-b / (2 * a)) : (t.push((-b + Math.sqrt(discriminant)) / (2 * a)), t.push((-b - Math.sqrt(discriminant)) / (2 * a)));
|
|
187
|
+
let result = [];
|
|
188
|
+
return t.forEach((t0) => {
|
|
189
|
+
let O = this.rightArm.delta.times(t0).plus(I);
|
|
246
190
|
result.push({
|
|
247
191
|
circle: { centre: O, r },
|
|
248
192
|
tangent: new Line(p, p.plus(O.minus(p).normal()))
|
|
249
193
|
});
|
|
250
|
-
});
|
|
251
|
-
return result;
|
|
194
|
+
}), result;
|
|
252
195
|
}
|
|
253
196
|
fit_Dl(l, err) {
|
|
254
|
-
if (!this.formTriangle(l, err))
|
|
197
|
+
if (!this.formTriangle(l, err))
|
|
255
198
|
return null;
|
|
256
|
-
|
|
257
|
-
const A = l.intersectionPoint(this.rightArm, 0);
|
|
258
|
-
const B = l.intersectionPoint(this.leftArm, 0);
|
|
259
|
-
const AB = new Line(A, B);
|
|
260
|
-
const Ap = this.leftArm.closestPoint(A);
|
|
261
|
-
const I = A.plus(Ap).over(2);
|
|
262
|
-
const r = A.minus(Ap).norm / 2;
|
|
263
|
-
const t1 = (AB.delta.cross(A.minus(I)) + r * AB.delta.norm) / AB.delta.cross(this.rightArm.delta);
|
|
264
|
-
const t2 = (AB.delta.cross(A.minus(I)) - r * AB.delta.norm) / AB.delta.cross(this.rightArm.delta);
|
|
265
|
-
const o1 = this.rightArm.delta.times(t1).plus(I);
|
|
266
|
-
const o2 = this.rightArm.delta.times(t2).plus(I);
|
|
199
|
+
let A = l.intersectionPoint(this.rightArm, 0), B = l.intersectionPoint(this.leftArm, 0), AB = new Line(A, B), Ap = this.leftArm.closestPoint(A), I = A.plus(Ap).over(2), r = A.minus(Ap).norm / 2, t1 = (AB.delta.cross(A.minus(I)) + r * AB.delta.norm) / AB.delta.cross(this.rightArm.delta), t2 = (AB.delta.cross(A.minus(I)) - r * AB.delta.norm) / AB.delta.cross(this.rightArm.delta), o1 = this.rightArm.delta.times(t1).plus(I), o2 = this.rightArm.delta.times(t2).plus(I);
|
|
267
200
|
return [
|
|
268
201
|
{
|
|
269
202
|
circle: { centre: o1, r },
|
|
@@ -276,38 +209,18 @@ var Wedge = class {
|
|
|
276
209
|
];
|
|
277
210
|
}
|
|
278
211
|
fit_NDp(p, err) {
|
|
279
|
-
if (!this.strictlyContains(p, err))
|
|
212
|
+
if (!this.strictlyContains(p, err))
|
|
280
213
|
return null;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const A = this.leftArm.end;
|
|
284
|
-
const B = this.rightArm.end;
|
|
285
|
-
const a = C.minus(B).norm;
|
|
286
|
-
const b = C.minus(A).norm;
|
|
287
|
-
const D = A.minus(B).times(a / (a + b)).plus(B);
|
|
288
|
-
const bisector = new Line(C, D);
|
|
289
|
-
const eA = D.minus(C).normSquared - (A.minus(C).cross(D.minus(C)) / b) ** 2;
|
|
290
|
-
const eB = D.minus(C).dot(C.minus(p)) * 2;
|
|
291
|
-
const eC = C.minus(p).normSquared;
|
|
292
|
-
const discriminant = eB * eB - 4 * eA * eC;
|
|
293
|
-
if (discriminant < (-10) ** -5) {
|
|
214
|
+
let C = this.leftArm.start, A = this.leftArm.end, B = this.rightArm.end, a = C.minus(B).norm, b = C.minus(A).norm, D = A.minus(B).times(a / (a + b)).plus(B), bisector = new Line(C, D), eA = D.minus(C).normSquared - (A.minus(C).cross(D.minus(C)) / b) ** 2, eB = D.minus(C).dot(C.minus(p)) * 2, eC = C.minus(p).normSquared, discriminant = eB * eB - 4 * eA * eC;
|
|
215
|
+
if (discriminant < (-10) ** -5)
|
|
294
216
|
return null;
|
|
295
|
-
}
|
|
296
217
|
let O, r;
|
|
297
218
|
if (Math.abs(discriminant) < 10 ** -5) {
|
|
298
|
-
|
|
299
|
-
O = bisector.evaluate(t);
|
|
300
|
-
r = O.minus(p).norm;
|
|
219
|
+
let t = -eB / (2 * eA);
|
|
220
|
+
O = bisector.evaluate(t), r = O.minus(p).norm;
|
|
301
221
|
} else {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if (bisector.evaluate(t1).minus(p).normSquared > bisector.evaluate(t2).minus(p).normSquared) {
|
|
305
|
-
O = bisector.evaluate(t1);
|
|
306
|
-
r = bisector.evaluate(t1).minus(p).norm;
|
|
307
|
-
} else {
|
|
308
|
-
O = bisector.evaluate(t2);
|
|
309
|
-
r = bisector.evaluate(t2).minus(p).norm;
|
|
310
|
-
}
|
|
222
|
+
let t1 = (-eB + Math.sqrt(discriminant)) / (2 * eA), t2 = (-eB - Math.sqrt(discriminant)) / (2 * eA);
|
|
223
|
+
bisector.evaluate(t1).minus(p).normSquared > bisector.evaluate(t2).minus(p).normSquared ? (O = bisector.evaluate(t1), r = bisector.evaluate(t1).minus(p).norm) : (O = bisector.evaluate(t2), r = bisector.evaluate(t2).minus(p).norm);
|
|
311
224
|
}
|
|
312
225
|
return [
|
|
313
226
|
{
|
|
@@ -317,31 +230,17 @@ var Wedge = class {
|
|
|
317
230
|
];
|
|
318
231
|
}
|
|
319
232
|
fit_NDl(l, err) {
|
|
320
|
-
if (!this.formTriangle(l, err))
|
|
233
|
+
if (!this.formTriangle(l, err))
|
|
321
234
|
return null;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const A = l.intersectionPoint(this.leftArm, 0);
|
|
325
|
-
const B = l.intersectionPoint(this.rightArm, 0);
|
|
326
|
-
const AC = new Line(A, C);
|
|
327
|
-
const BC = new Line(B, C);
|
|
328
|
-
const AB = new Line(A, B);
|
|
329
|
-
const a = AC.length;
|
|
330
|
-
const b = BC.length;
|
|
331
|
-
const c = AB.length;
|
|
332
|
-
const s = (a + b + c) / 2;
|
|
333
|
-
if (s * (s - a) * (s - b) / (s - c) < 0) {
|
|
235
|
+
let C = this.leftArm.start, A = l.intersectionPoint(this.leftArm, 0), B = l.intersectionPoint(this.rightArm, 0), AC = new Line(A, C), BC = new Line(B, C), AB = new Line(A, B), a = AC.length, b = BC.length, c = AB.length, s = (a + b + c) / 2;
|
|
236
|
+
if (s * (s - a) * (s - b) / (s - c) < 0)
|
|
334
237
|
return null;
|
|
335
|
-
|
|
336
|
-
const r = Math.sqrt(s * (s - a) * (s - b) / (s - c));
|
|
337
|
-
const det = AB.delta.cross(AC.delta);
|
|
338
|
-
const lhsAll = [
|
|
238
|
+
let r = Math.sqrt(s * (s - a) * (s - b) / (s - c)), det = AB.delta.cross(AC.delta), lhsAll = [
|
|
339
239
|
new Vec2(B.cross(A) + r * c, C.cross(A) + r * a),
|
|
340
240
|
new Vec2(B.cross(A) + r * c, C.cross(A) - r * a),
|
|
341
241
|
new Vec2(B.cross(A) - r * c, C.cross(A) + r * a),
|
|
342
242
|
new Vec2(B.cross(A) - r * c, C.cross(A) - r * a)
|
|
343
|
-
];
|
|
344
|
-
const OAll = [];
|
|
243
|
+
], OAll = [];
|
|
345
244
|
lhsAll.forEach((lhs) => {
|
|
346
245
|
OAll.push(
|
|
347
246
|
new Vec2(
|
|
@@ -350,15 +249,13 @@ var Wedge = class {
|
|
|
350
249
|
).over(-det)
|
|
351
250
|
);
|
|
352
251
|
});
|
|
353
|
-
let o = null;
|
|
354
|
-
|
|
355
|
-
for (const O of OAll) {
|
|
252
|
+
let o = null, dists = [];
|
|
253
|
+
for (let O of OAll) {
|
|
356
254
|
dists.push({
|
|
357
255
|
raw: Math.abs(BC.distanceToPoint(O) - r),
|
|
358
256
|
norm: Math.abs(BC.distanceToPoint(O) / r - 1)
|
|
359
257
|
});
|
|
360
|
-
|
|
361
|
-
const relativeError = Math.abs(BC.distanceToPoint(O) / r - 1);
|
|
258
|
+
let absoluteError = Math.abs(BC.distanceToPoint(O) - r), relativeError = Math.abs(BC.distanceToPoint(O) / r - 1);
|
|
362
259
|
if ((absoluteError < 10 ** -5 || relativeError < 10 ** -5) && AC.pointOnSide(O) !== BC.pointOnSide(O)) {
|
|
363
260
|
o = O;
|
|
364
261
|
break;
|
|
@@ -367,14 +264,12 @@ var Wedge = class {
|
|
|
367
264
|
let msg = "";
|
|
368
265
|
if (o === null) {
|
|
369
266
|
msg = "fit_NDl, centre is undefined";
|
|
370
|
-
for (let i = 0; i < OAll.length; i++)
|
|
267
|
+
for (let i = 0; i < OAll.length; i++)
|
|
371
268
|
msg += `centre: (${OAll[i].x}, ${OAll[i].y}), r: ${r}, dist raw: ${dists[i].raw}, dist norm: ${dists[i].norm}
|
|
372
269
|
`;
|
|
373
|
-
}
|
|
374
270
|
}
|
|
375
|
-
if (o === null)
|
|
271
|
+
if (o === null)
|
|
376
272
|
throw new Error(msg);
|
|
377
|
-
}
|
|
378
273
|
return [
|
|
379
274
|
{
|
|
380
275
|
circle: { centre: o, r },
|
|
@@ -383,13 +278,7 @@ var Wedge = class {
|
|
|
383
278
|
];
|
|
384
279
|
}
|
|
385
280
|
fitCircles(element, err) {
|
|
386
|
-
|
|
387
|
-
return this.isDegenerate ? this.fit_Dp(element, err) : this.fit_NDp(element, err);
|
|
388
|
-
}
|
|
389
|
-
if (element instanceof Line) {
|
|
390
|
-
return this.isDegenerate ? this.fit_Dl(element instanceof Line ? element : element, err) : this.fit_NDl(element instanceof Line ? element : element, err);
|
|
391
|
-
}
|
|
392
|
-
return null;
|
|
281
|
+
return element instanceof Vec2 ? this.isDegenerate ? this.fit_Dp(element, err) : this.fit_NDp(element, err) : element instanceof Line ? this.isDegenerate ? this.fit_Dl((element instanceof Line, element), err) : this.fit_NDl((element instanceof Line, element), err) : null;
|
|
393
282
|
}
|
|
394
283
|
toString() {
|
|
395
284
|
return `LA: ${this.leftArm.start.toString()} --> ${this.leftArm.end.toString()}
|
|
@@ -399,157 +288,100 @@ RA: ${this.rightArm.start.toString()} --> ${this.rightArm.end.toString()}`;
|
|
|
399
288
|
|
|
400
289
|
// src/index.ts
|
|
401
290
|
function lineTangentToHull(line, points, halo) {
|
|
402
|
-
let holds =
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
while (side === 0 /* Top */ && k < points.length) {
|
|
406
|
-
side = line.pointOnSide(points[k], halo);
|
|
407
|
-
k++;
|
|
408
|
-
}
|
|
291
|
+
let holds = !0, side = 0 /* Top */, k = 0;
|
|
292
|
+
for (; side === 0 /* Top */ && k < points.length; )
|
|
293
|
+
side = line.pointOnSide(points[k], halo), k++;
|
|
409
294
|
for (let i = k; i < points.length; i++) {
|
|
410
|
-
|
|
411
|
-
if (testSide
|
|
412
|
-
|
|
413
|
-
}
|
|
414
|
-
if (testSide !== side) {
|
|
415
|
-
holds = false;
|
|
295
|
+
let testSide = line.pointOnSide(points[i], halo);
|
|
296
|
+
if (testSide !== 0 /* Top */ && testSide !== side) {
|
|
297
|
+
holds = !1;
|
|
416
298
|
break;
|
|
417
299
|
}
|
|
418
300
|
}
|
|
419
301
|
return { holds, side };
|
|
420
302
|
}
|
|
421
303
|
function findEnclosingSide(wedge, startVertex, endVertex, points, halo) {
|
|
422
|
-
let side = null;
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
while (side === null && vertex > endVertex) {
|
|
426
|
-
const p1 = points[vertex];
|
|
427
|
-
const p2 = points[vertex - 1];
|
|
428
|
-
const edge = new Line(p1, p2);
|
|
429
|
-
const circlesEdge = wedge.fitCircles(edge, halo);
|
|
304
|
+
let side = null, stopVertex = startVertex, vertex = startVertex;
|
|
305
|
+
for (; side === null && vertex > endVertex; ) {
|
|
306
|
+
let p1 = points[vertex], p2 = points[vertex - 1], edge = new Line(p1, p2), circlesEdge = wedge.fitCircles(edge, halo);
|
|
430
307
|
if (circlesEdge !== null) {
|
|
431
308
|
let tangentParameter = 100;
|
|
432
309
|
if (wedge.isDegenerate) {
|
|
433
|
-
let sidedness = 0 /* Top
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
sidedness = edge.pointOnSide(points[k], halo);
|
|
437
|
-
k++;
|
|
438
|
-
}
|
|
310
|
+
let sidedness = 0 /* Top */, k = 0;
|
|
311
|
+
for (; sidedness === 0 /* Top */ && k < points.length; )
|
|
312
|
+
sidedness = edge.pointOnSide(points[k], halo), k++;
|
|
439
313
|
tangentParameter = edge.pointOnSide(circlesEdge[0].circle.centre) !== sidedness ? circlesEdge[0].tangentParameter : circlesEdge[1].tangentParameter;
|
|
440
|
-
} else
|
|
314
|
+
} else
|
|
441
315
|
tangentParameter = circlesEdge[0].tangentParameter;
|
|
442
|
-
}
|
|
443
316
|
if (tangentParameter > 0 && tangentParameter < 1) {
|
|
444
|
-
|
|
445
|
-
const joint = wedge.leftArm.intersectionPoint(edge, halo);
|
|
317
|
+
let Y = edge.evaluate(tangentParameter), joint = wedge.leftArm.intersectionPoint(edge, halo);
|
|
446
318
|
side = new Line(joint, Y);
|
|
447
319
|
}
|
|
448
320
|
}
|
|
449
321
|
if (side === null) {
|
|
450
|
-
|
|
322
|
+
let circlesPoint = wedge.fitCircles(p2, halo);
|
|
451
323
|
if (circlesPoint !== null) {
|
|
452
324
|
let tangent;
|
|
453
325
|
if (wedge.isDegenerate) {
|
|
454
|
-
let sidedness = 0 /* Top
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
sidedness = circlesPoint[0].tangent.pointOnSide(points[k], halo);
|
|
458
|
-
k++;
|
|
459
|
-
}
|
|
326
|
+
let sidedness = 0 /* Top */, k = 0;
|
|
327
|
+
for (; sidedness === 0 /* Top */ && k < points.length; )
|
|
328
|
+
sidedness = circlesPoint[0].tangent.pointOnSide(points[k], halo), k++;
|
|
460
329
|
tangent = circlesPoint[0].tangent.pointOnSide(
|
|
461
330
|
circlesPoint[0].circle.centre,
|
|
462
331
|
halo
|
|
463
332
|
) !== sidedness ? circlesPoint[0].tangent : circlesPoint[1].tangent;
|
|
464
|
-
} else
|
|
333
|
+
} else
|
|
465
334
|
tangent = circlesPoint[0].tangent;
|
|
466
|
-
}
|
|
467
335
|
if (lineTangentToHull(tangent, points, halo).holds) {
|
|
468
|
-
|
|
336
|
+
let joint = wedge.leftArm.intersectionPoint(tangent, halo);
|
|
469
337
|
side = new Line(joint, p2);
|
|
470
338
|
}
|
|
471
339
|
}
|
|
472
340
|
}
|
|
473
|
-
stopVertex = vertex
|
|
474
|
-
vertex--;
|
|
341
|
+
stopVertex = vertex, vertex--;
|
|
475
342
|
}
|
|
476
343
|
return side === null ? null : { side, stopVertex };
|
|
477
344
|
}
|
|
478
345
|
function findAntipode(points) {
|
|
479
|
-
let farthestIndex = 0;
|
|
480
|
-
let farthestDist = 0;
|
|
346
|
+
let farthestIndex = 0, farthestDist = 0;
|
|
481
347
|
for (let i = 0, n = points.length; i < n; i++) {
|
|
482
|
-
|
|
348
|
+
let testDist = new Line(points[0], points[n - 1]).distanceToPoint(
|
|
483
349
|
points[i]
|
|
484
350
|
);
|
|
485
|
-
|
|
486
|
-
farthestDist = testDist;
|
|
487
|
-
farthestIndex = i;
|
|
488
|
-
}
|
|
351
|
+
testDist > farthestDist && (farthestDist = testDist, farthestIndex = i);
|
|
489
352
|
}
|
|
490
353
|
return farthestIndex;
|
|
491
354
|
}
|
|
492
355
|
function minTriangleWithBase(convexHull, err, tol) {
|
|
493
|
-
let AB, AC
|
|
494
|
-
const n = convexHull.length;
|
|
495
|
-
const BC = new Line(convexHull[0], convexHull[n - 1]);
|
|
496
|
-
const antipodIndex = findAntipode(convexHull);
|
|
497
|
-
const baseParallel = new Line(
|
|
356
|
+
let AB, AC, n = convexHull.length, BC = new Line(convexHull[0], convexHull[n - 1]), antipodIndex = findAntipode(convexHull), baseParallel = new Line(
|
|
498
357
|
convexHull[antipodIndex],
|
|
499
358
|
convexHull[antipodIndex].plus(BC.delta)
|
|
500
|
-
);
|
|
501
|
-
let wedge = Wedge.new(BC, baseParallel, err);
|
|
502
|
-
let Pn = n - 1;
|
|
503
|
-
let Qn = antipodIndex;
|
|
359
|
+
), wedge = Wedge.new(BC, baseParallel, err), Pn = n - 1, Qn = antipodIndex;
|
|
504
360
|
do {
|
|
505
|
-
|
|
506
|
-
if (CQinfo === null)
|
|
361
|
+
let CQinfo = findEnclosingSide(wedge, Pn, antipodIndex, convexHull, err);
|
|
362
|
+
if (CQinfo === null)
|
|
507
363
|
return null;
|
|
508
|
-
}
|
|
509
|
-
;
|
|
510
|
-
(
|
|
511
|
-
wedge = Wedge.new(wedge.leftArm, AC, err);
|
|
512
|
-
const BPinfo = findEnclosingSide(wedge, Qn, 0, convexHull, err);
|
|
513
|
-
if (BPinfo === null) {
|
|
364
|
+
({ side: AC, stopVertex: Pn } = CQinfo), wedge = Wedge.new(wedge.leftArm, AC, err);
|
|
365
|
+
let BPinfo = findEnclosingSide(wedge, Qn, 0, convexHull, err);
|
|
366
|
+
if (BPinfo === null)
|
|
514
367
|
return null;
|
|
515
|
-
}
|
|
516
|
-
;
|
|
517
|
-
({ side: AB, stopVertex: Qn } = BPinfo);
|
|
518
|
-
wedge = Wedge.new(wedge.leftArm, AB, err);
|
|
368
|
+
({ side: AB, stopVertex: Qn } = BPinfo), wedge = Wedge.new(wedge.leftArm, AB, err);
|
|
519
369
|
} while (AB.length - AC.length > tol);
|
|
520
|
-
|
|
521
|
-
const B = AB.start;
|
|
522
|
-
const C = AC.start;
|
|
370
|
+
let A = AC.intersectionPoint(AB, 0), B = AB.start, C = AC.start;
|
|
523
371
|
return { A, B, C };
|
|
524
372
|
}
|
|
525
373
|
function minTriangle(convexHull, err, tol) {
|
|
526
|
-
if (convexHull.length < 3)
|
|
374
|
+
if (convexHull.length < 3)
|
|
527
375
|
return null;
|
|
528
|
-
|
|
529
|
-
if (convexHull.length === 3) {
|
|
376
|
+
if (convexHull.length === 3)
|
|
530
377
|
return { A: convexHull[0], B: convexHull[1], C: convexHull[2] };
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
let A = null;
|
|
536
|
-
let B = null;
|
|
537
|
-
let C = null;
|
|
538
|
-
let perimeter = -1;
|
|
539
|
-
let rotations = 0;
|
|
540
|
-
while (rotations < points.length) {
|
|
541
|
-
if (rotations > 0) {
|
|
542
|
-
points.push(points.shift());
|
|
543
|
-
}
|
|
544
|
-
const triangle = minTriangleWithBase(points, err, tol);
|
|
378
|
+
let points = convexHull.map((p) => new Vec2(p.x, p.y)), A = null, B = null, C = null, perimeter = -1, rotations = 0;
|
|
379
|
+
for (; rotations < points.length; ) {
|
|
380
|
+
rotations > 0 && points.push(points.shift());
|
|
381
|
+
let triangle = minTriangleWithBase(points, err, tol);
|
|
545
382
|
if (triangle !== null) {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
if (perimeter1 < perimeter || perimeter === -1) {
|
|
549
|
-
;
|
|
550
|
-
[A, B, C] = [A1, B1, C1];
|
|
551
|
-
perimeter = perimeter1;
|
|
552
|
-
}
|
|
383
|
+
let { A: A1, B: B1, C: C1 } = triangle, perimeter1 = A1.minus(B1).norm + B1.minus(C1).norm + C1.minus(A1).norm;
|
|
384
|
+
(perimeter1 < perimeter || perimeter === -1) && ([A, B, C] = [A1, B1, C1], perimeter = perimeter1);
|
|
553
385
|
}
|
|
554
386
|
rotations++;
|
|
555
387
|
}
|
package/lib/esm/index.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/line.ts", "../../src/vec2.ts", "../../src/inscribe.ts", "../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { Vec2 } from './vec2'\n\nexport enum Side {\n Right = -1,\n Top = 0,\n Left = 1\n}\n\nexport class Line {\n readonly start: Vec2\n readonly end: Vec2\n readonly delta: Vec2\n\n constructor(start: Vec2, end: Vec2) {\n this.start = start\n this.end = end\n this.delta = end.minus(start)\n }\n\n /**\n * Length of a line is the length between its two defining points\n */\n get length(): number {\n return this.delta.norm\n }\n\n evaluate(t: number): Vec2 {\n return this.start.plus(this.delta.times(t))\n }\n\n distanceToPoint(p: Vec2): number {\n return (\n Math.abs(p.cross(this.delta) - this.start.cross(this.end)) /\n this.delta.norm\n )\n }\n\n pointOnSide(p: Vec2, err = 0): number {\n const num = this.start.cross(this.end) - p.cross(this.delta)\n if (num === 0 || Math.abs(num) / this.delta.norm < err) {\n return Side.Top\n }\n return num > 0 ? Side.Left : Side.Right\n }\n\n pointOnTop(p: Vec2, err: number): boolean {\n return this.pointOnSide(p, err) === Side.Top\n }\n\n overlaps(that: Line, err: number): boolean {\n return this.pointOnTop(that.start, err) && this.pointOnTop(that.end, err)\n }\n\n /**\n * If alpha is less than deviationFromZeroAngle, the 2 lines are\n * considered parallel.\n * _______________________________\n * alpha (/\n * /\n * /\n * /\n */\n parallel(that: Line, deviationFromZeroAngle: number): boolean {\n const d: number = Math.abs(this.delta.cross(that.delta))\n //https://en.wikipedia.org/wiki/Cross_product#Geometric_meaning\n return (\n d === 0 ||\n d < this.length * this.length * Math.sin(deviationFromZeroAngle)\n )\n }\n\n intersectionParameter(that: Line, err: number): number | null {\n const d = this.delta.cross(that.delta)\n if (d === 0 || Math.abs(d) < err) {\n return null // lines are parallel\n }\n const dStart: Vec2 = this.start.minus(that.start)\n return that.delta.cross(dStart) / d\n }\n\n closestPointParam(p: Vec2): number {\n return this.delta.dot(p.minus(this.start)) / this.delta.normSquared\n }\n\n closestPoint(p: Vec2): Vec2 {\n return this.evaluate(this.closestPointParam(p))\n }\n\n intersectionPoint(that: Line, err: number): Vec2 | null {\n const t = this.intersectionParameter(that, err)\n return t === null ? null : this.evaluate(t)\n }\n}\n", "export class Vec2 {\n private readonly _x: number\n private readonly _y: number\n\n private _normSquared: number | undefined\n private _norm: number | undefined\n private _normalized: Vec2 | undefined\n\n constructor(x: number, y: number) {\n this._x = x\n this._y = y\n }\n\n times(s: number): Vec2 {\n return new Vec2(this._x * s, this._y * s)\n }\n\n over(s: number): Vec2 {\n return new Vec2(this._x / s, this._y / s)\n }\n\n get x(): number {\n return this._x\n }\n\n get y(): number {\n return this._y\n }\n\n plus(that: Vec2): Vec2 {\n return new Vec2(this._x + that._x, this._y + that._y)\n }\n\n minus(that: Vec2): Vec2 {\n return new Vec2(this._x - that._x, this._y - that._y)\n }\n\n get normSquared(): number {\n return this._normSquared === undefined\n ? (this._normSquared = this.dot(this))\n : this._normSquared\n }\n\n get norm(): number {\n return this._norm === undefined\n ? (this._norm = Math.sqrt(this.normSquared))\n : this._norm\n }\n\n get normalized(): Vec2 {\n return this._normalized === undefined\n ? (this._normalized = this.over(this.norm))\n : this._normalized\n }\n\n dot(that: Vec2): number {\n return this._x * that._x + this._y * that._y\n }\n\n cross(that: Vec2): number {\n return this._x * that._y - this._y * that._x\n }\n\n equals(that: Vec2, err: number): boolean {\n if (err === 0) {\n return this.x === that.x && this.y === that.y\n }\n return this.minus(that).normSquared < err * err\n }\n\n normal(): Vec2 {\n return new Vec2(this._y, -this._x)\n }\n\n toString(): string {\n return `(${this.x}, ${this.y})`\n }\n}\n", "import { Line, Side } from './line'\nimport { Vec2 } from './vec2'\n\nexport interface Circle {\n centre: Vec2\n r: number\n}\n\n/**\n * Class describing a wedge.\n * Wedge can be degenerate, i.e., its arms are parallel,\n * in this case they must point in the same direction\n */\nexport class Wedge {\n readonly leftArm: Line\n readonly rightArm: Line\n readonly isDegenerate: boolean\n\n private constructor(leftArm: Line, rightArm: Line, isDegenerate = false) {\n this.leftArm = leftArm\n this.rightArm = rightArm\n this.isDegenerate = isDegenerate\n }\n\n static new(leftArm: Line, rightArm: Line, err: number): Wedge | null {\n if (leftArm === null || rightArm === null) {\n return null\n }\n\n if (err !== 0 && leftArm.overlaps(rightArm, err)) {\n return null\n }\n\n // Check if they are parallel\n // Such value of deviation ensure that angle in between the Lines regardless\n // their lengths is 0.1 radians\n const deviationFromZeroAngle = 0.1 / (leftArm.length * rightArm.length)\n if (leftArm.parallel(rightArm, deviationFromZeroAngle)) {\n // Check if they point in the same direction\n // middle is non-null due to the overlap check\n const middle = new Line(leftArm.evaluate(0.5), rightArm.evaluate(0.5))\n const p = middle.evaluate(0.5)\n // Now p lies in between the arms\n // If arms point in the same direction p must be on the right of one and the left of another\n // --------*------------>\n // \\\n // \\\n // * p\n // \\\n // -------*----------->\n const sideLeft = leftArm.pointOnSide(p, err)\n const sideRight = rightArm.pointOnSide(p, err)\n if (sideLeft === Side.Top || sideRight === Side.Top) {\n throw new Error()\n }\n\n return sideLeft !== sideRight\n ? new Wedge(leftArm, rightArm, true)\n : new Wedge(leftArm, new Line(rightArm.end, rightArm.start))\n }\n\n // extensions of the wedge intersect, extend or cut the sides appropriately\n // err is set to 0 because we have already established that they intersect under appropriate angle\n const tLA = leftArm.intersectionParameter(rightArm, 0)!\n const tRA = rightArm.intersectionParameter(leftArm, 0)!\n\n // If it's impossible to tell the excess that need to be cut\n if (tLA === 0.5 || tRA === 0.5) {\n return null\n }\n\n // W will be the angle point of the wedge\n const W = leftArm.evaluate(tLA)\n\n // Arrange the arms in a way that they point away from W.\n // Make sure that after the cut, W and corresponding points are at least err distance apart\n const eLA = tLA < 1 - tLA ? leftArm.end : leftArm.start\n\n const eRA = tRA < 1 - tRA ? rightArm.end : rightArm.start\n\n return new Wedge(new Line(W, eLA), new Line(W, eRA))\n }\n\n formTriangle(line: Line, err: number): boolean {\n const thin =\n this.leftArm.parallel(line, 0.1 / (this.leftArm.length * line.length)) ||\n this.rightArm.parallel(line, 0.1 / (this.rightArm.length * line.length))\n if (thin) {\n return false\n }\n\n const A = line.intersectionPoint(this.leftArm, 0)!\n const B = line.intersectionPoint(this.rightArm, 0)!\n\n if (this.isDegenerate) {\n return !A.equals(B, err)\n }\n\n const C = this.leftArm.intersectionPoint(this.rightArm, 0)!\n\n return (\n !C.equals(A, err) &&\n !C.equals(B, err) &&\n !A.equals(B, err) &&\n !new Line(A, B).pointOnTop(C, err)\n )\n }\n\n looselyContains(p: Vec2, err: number): boolean {\n const pLeft = this.leftArm.pointOnSide(p, err)\n const pRight = this.rightArm.pointOnSide(p, err)\n\n if (pLeft === Side.Top || pRight === Side.Top) {\n return true\n }\n\n // Point is on neither arms; To be within the wedge it:\n // 1. must lie on different sides w.r.t. the arms\n if (pLeft === pRight) {\n return false\n }\n\n return this.isDegenerate\n ? // degenerate + different sides => true\n true\n : // 2. (Because the arms intersect)\n // Projection params of the point onto the arms must be larger than 0\n this.leftArm.closestPointParam(p) >= 0 &&\n this.rightArm.closestPointParam(p) >= 0\n }\n\n strictlyContains(p: Vec2, err: number): boolean {\n const pLeft = this.leftArm.pointOnSide(p, err)\n const pRight = this.rightArm.pointOnSide(p, err)\n\n if (pLeft === Side.Top || pRight === Side.Top) {\n return false\n }\n\n // Point is on neither arms; To be within the wedge it:\n // 1. must lie on different sides w.r.t. the arms\n if (pLeft === pRight) {\n return false\n }\n\n return this.isDegenerate\n ? // degenerate + different sides => true\n true\n : // 2. (Because the arms intersect)\n // Projection params of the point onto the arms must be larger than 0\n this.leftArm.closestPointParam(p) >= 0 &&\n this.rightArm.closestPointParam(p) >= 0\n }\n\n // While fitting circles into a wedge\n // There are four distinct cases:\n // 1. Wedge is degenerate and additional element is a point\n // 2. Wedge is degenerate and additional element is a line\n // 3. Wedge is non-degenerate and additional element is a point\n // 4. Wedge is non-degenerate and additional element is a line\n // according to these assumptions, the following methods are named\n\n private fit_Dp(\n p: Vec2,\n err: number\n ): Array<{ circle: Circle; tangent: Line }> | null {\n if (!this.strictlyContains(p, err)) {\n // point is not within the wedge\n return null\n }\n // Intersection are ensured by the previous check\n // => A and B are non-null-s\n // -----------------------*(Ap)---------------(left)------->\n // |\n // |\n // |\n // ----------------------*(I)-------------------\n // |\n // *(p)\n // |\n // -----------------------*(A)----(right)----------->\n\n const A = this.rightArm.closestPoint(p)\n const Ap = this.leftArm.closestPoint(A)\n\n // Line A-Ap is normal to both arms => I = (A+Ap)/2 is within arms of the wedge\n // and ||A-Ap|| is the radius of a circle to inscribe\n const I = A.plus(Ap).over(2)\n const r: number = A.minus(Ap).norm / 2\n // Now l = this.right_arm.delta*t + I = D_ra*t + I passes between the arms\n // We need to find Ic on l such that (Ic-p).(Ic-p) = r^2\n // |Ic-p|^2-r^2 = |D_ra*t + I - p|^2-r^2 = (D_ra*t + I - p).(D_ra*t + I - p)-r^2 =\n // |D_ra|^2 t^2 + 2*(I-P).D_ra*t + |I-p|^2 - r^2\n const a = this.rightArm.delta.normSquared\n const b = I.minus(p).dot(this.rightArm.delta) * 2\n const c = I.minus(p).normSquared - r * r\n const discriminant = b * b - 4 * a * c\n\n if (discriminant < (-10) ** -5) {\n // Account for possible computation errors\n // This should not happen if point is strictly contained within the wedge with a reasonable err\n return null\n }\n\n const t: number[] = []\n\n if (Math.abs(discriminant) < 10 ** -5) {\n t.push(-b / (2 * a))\n } else {\n t.push((-b + Math.sqrt(discriminant)) / (2 * a))\n t.push((-b - Math.sqrt(discriminant)) / (2 * a))\n }\n\n const result: Array<{ circle: Circle; tangent: Line }> = []\n\n t.forEach((t0: number) => {\n const O = this.rightArm.delta.times(t0).plus(I)\n result.push({\n circle: { centre: O, r },\n tangent: new Line(p, p.plus(O.minus(p).normal()))\n })\n })\n\n return result\n }\n\n private fit_Dl(\n l: Line,\n err: number\n ): Array<{ circle: Circle; tangentParameter: number }> | null {\n if (!this.formTriangle(l, err)) {\n // edge is parallel to the arms\n return null\n }\n\n // Intersection are ensured by the previous check\n // => A and B are non-null-s\n // ------(B)*-----*(Ap)---------------(left)------->\n // \\ |\n // \\ |\n // -----------\\--*(I)-------------------\n // \\ |\n // \\|\n // ---------------*(A)-------------(right)----------->\n const A = l.intersectionPoint(this.rightArm, 0)!\n const B = l.intersectionPoint(this.leftArm, 0)!\n\n const AB = new Line(A, B)!\n const Ap = this.leftArm.closestPoint(A)\n\n // Line A-Ap is normal to both arms => I = (A+Ap)/2 is within arms of the wedge\n // and ||A-Ap|| is the radius of a circle to inscribe\n const I = A.plus(Ap).over(2)\n const r = A.minus(Ap).norm / 2\n // Now this.right_arm.delta*t + I passes between the arms and parallel to them\n\n const t1 =\n (AB.delta.cross(A.minus(I)) + r * AB.delta.norm) /\n AB.delta.cross(this.rightArm.delta)\n const t2 =\n (AB.delta.cross(A.minus(I)) - r * AB.delta.norm) /\n AB.delta.cross(this.rightArm.delta)\n\n const o1: Vec2 = this.rightArm.delta.times(t1).plus(I)\n const o2: Vec2 = this.rightArm.delta.times(t2).plus(I)\n\n return [\n {\n circle: { centre: o1, r },\n tangentParameter: l.closestPointParam(o1)\n },\n {\n circle: { centre: o2, r },\n tangentParameter: l.closestPointParam(o2)\n }\n ]\n }\n\n private fit_NDp(\n p: Vec2,\n err: number\n ): Array<{ circle: Circle; tangent: Line }> | null {\n if (!this.strictlyContains(p, err)) {\n return null\n }\n // Point is in-between the wedge's arms\n\n // *(C)\n // /|\n // / |\n // / |\n // / |\n // / |\n // / *(p)|\n // / |\n // (A)* *(B)\n\n // By construction of wedge\n const C = this.leftArm.start // or = this.right_arm.end\n const A = this.leftArm.end\n const B = this.rightArm.end\n\n const a: number = C.minus(B).norm\n const b: number = C.minus(A).norm\n\n const D = A.minus(B)\n .times(a / (a + b))\n .plus(B)\n\n const bisector = new Line(C, D)\n\n const // coefficients for quadratic equations\n eA = D.minus(C).normSquared - (A.minus(C).cross(D.minus(C)) / b) ** 2\n const eB = D.minus(C).dot(C.minus(p)) * 2\n const eC = C.minus(p).normSquared\n const discriminant = eB * eB - 4 * eA * eC\n\n if (discriminant < (-10) ** -5) {\n // Account for possible computation errors\n // This should not happen if point is strictly contained within the wedge with a reasonable err\n return null\n }\n\n let O: Vec2, r: number\n\n if (Math.abs(discriminant) < 10 ** -5) {\n const t = -eB / (2 * eA)\n O = bisector.evaluate(t)\n r = O.minus(p).norm\n } else {\n const t1 = (-eB + Math.sqrt(discriminant)) / (2 * eA)\n const t2 = (-eB - Math.sqrt(discriminant)) / (2 * eA)\n // Pick the value corresponding to larger radius\n if (\n bisector.evaluate(t1).minus(p).normSquared >\n bisector.evaluate(t2).minus(p).normSquared\n ) {\n O = bisector.evaluate(t1)\n r = bisector.evaluate(t1).minus(p).norm\n } else {\n O = bisector.evaluate(t2)\n r = bisector.evaluate(t2).minus(p).norm\n }\n }\n\n return [\n {\n circle: { centre: O, r },\n tangent: new Line(p, p.plus(O.minus(p).normal()))\n }\n ]\n }\n\n private fit_NDl(\n l: Line,\n err: number\n ): Array<{ circle: Circle; tangentParameter: number }> | null {\n if (!this.formTriangle(l, err)) {\n // Edge is parallel to one of the arms\n return null\n }\n\n // Intersections are ensured by the previous check;\n // => A, B, and C are non-null-s\n // Form a triangle such that:\n // 1. vertex C is the wedge corner point\n const C = this.leftArm.start\n\n // 2. vertex A is the line-left-arm intersection\n const A = l.intersectionPoint(this.leftArm, 0)!\n\n // 3. vertex B is the line-right-arm intersection\n const B = l.intersectionPoint(this.rightArm, 0)!\n\n // => sides of the triangle are\n const AC = new Line(A, C)\n const BC = new Line(B, C)\n const AB = new Line(A, B)\n\n // lengths of sides\n const a = AC.length\n const b = BC.length\n const c = AB.length\n // half perimeter\n const s = (a + b + c) / 2\n\n if ((s * (s - a) * (s - b)) / (s - c) < 0) {\n // Case of a very thin triangle\n // Should not happen with a reasonable err\n return null\n }\n\n // We need to find an escribed circle touching AB\n // Radius of such circle\n const r = Math.sqrt((s * (s - a) * (s - b)) / (s - c))\n\n const det: number = AB.delta.cross(AC.delta)\n\n const lhsAll: Vec2[] = [\n new Vec2(B.cross(A) + r * c, C.cross(A) + r * a),\n new Vec2(B.cross(A) + r * c, C.cross(A) - r * a),\n new Vec2(B.cross(A) - r * c, C.cross(A) + r * a),\n new Vec2(B.cross(A) - r * c, C.cross(A) - r * a)\n ]\n\n // Possible centres\n const OAll: Vec2[] = []\n lhsAll.forEach((lhs: Vec2) => {\n OAll.push(\n new Vec2(\n new Vec2(AB.delta.x, AC.delta.x).cross(lhs),\n new Vec2(AB.delta.y, AC.delta.y).cross(lhs)\n ).over(-det)\n )\n })\n\n //choose the one touching the third side\n let o: Vec2 | null = null\n const dists: Array<{ raw: number; norm: number }> = []\n for (const O of OAll) {\n dists.push({\n raw: Math.abs(BC.distanceToPoint(O) - r),\n norm: Math.abs(BC.distanceToPoint(O) / r - 1)\n })\n // absolute error --- is the distance between circle and a line, this is the ultimate measure of closeness\n const absoluteError = Math.abs(BC.distanceToPoint(O) - r)\n // relative error --- is the distance between circle and a line normalized to the radius\n // this measure is usefull when circle has a very large radius and absolute error might grow\n const relativeError = Math.abs(BC.distanceToPoint(O) / r - 1)\n if (\n (absoluteError < 10 ** -5 || relativeError < 10 ** -5) &&\n AC.pointOnSide(O) !== BC.pointOnSide(O)\n ) {\n o = O\n break\n }\n }\n\n let msg = ''\n if (o === null) {\n msg = 'fit_NDl, centre is undefined'\n for (let i = 0; i < OAll.length; i++) {\n msg += `centre: (${OAll[i].x}, ${OAll[i].y}), r: ${r}, dist raw: ${dists[i].raw}, dist norm: ${dists[i].norm}\\n`\n }\n }\n if (o === null) {\n throw new Error(msg)\n }\n\n return [\n {\n circle: { centre: o, r },\n tangentParameter: l.closestPointParam(o)\n }\n ]\n }\n\n fitCircles(\n element: Vec2,\n err: number\n ): Array<{ circle: Circle; tangent: Line }> | null\n fitCircles(\n element: Line | Line,\n err: number\n ): Array<{ circle: Circle; tangentParameter: number }> | null\n fitCircles(element: Vec2 | Line | Line, err: number) {\n if (element instanceof Vec2) {\n return this.isDegenerate\n ? this.fit_Dp(element, err)\n : this.fit_NDp(element, err)\n }\n if (element instanceof Line) {\n return this.isDegenerate\n ? this.fit_Dl(element instanceof Line ? element : element, err)\n : this.fit_NDl(element instanceof Line ? element : element, err)\n }\n return null\n }\n\n toString(): string {\n return (\n `LA: ${this.leftArm.start.toString()} --> ${this.leftArm.end.toString()}\\n` +\n `RA: ${this.rightArm.start.toString()} --> ${this.rightArm.end.toString()}`\n )\n }\n}\n", "import * as Inscribe from './inscribe'\nimport { Line, Side } from './line'\nimport { Vec2 } from './vec2'\n\nexport function lineTangentToHull(\n line: Line,\n points: Vec2[],\n halo: number\n): { holds: boolean; side: number } {\n let holds = true\n let side = Side.Top\n\n let k = 0\n while (side === Side.Top && k < points.length) {\n side = line.pointOnSide(points[k], halo)\n k++\n }\n\n for (let i = k; i < points.length; i++) {\n const testSide = line.pointOnSide(points[i], halo)\n if (testSide === Side.Top) {\n continue\n }\n if (testSide !== side) {\n holds = false\n break\n }\n }\n\n return { holds, side }\n}\n\n/**\n * Solves an optimization problem of finding the shortest third side for a given wedge such that they\n * enclose the given convex hull.\n * Such side, if found, will be generated by a Line which start will lie on the left arm of the wedge\n * and end will be P or Q (as described in the reference to the main function).\n *\n * startVertex is used to define the edge we start from.\n * endVertex is the last possible vertex through which a circle can be fitted into the wedge\n * startVertex > endVertex\n */\nfunction findEnclosingSide(\n wedge: Inscribe.Wedge,\n startVertex: number,\n endVertex: number,\n points: Vec2[],\n halo: number\n): { side: Line; stopVertex: number } | null {\n // Enclosing side\n let side: Line | null = null\n // Keep strack at which vertex we stopped\n let stopVertex = startVertex\n\n let vertex = startVertex\n\n while (side === null && vertex > endVertex) {\n const p1 = points[vertex]\n const p2 = points[vertex - 1]\n\n // Edge can be constructed\n const edge = new Line(p1, p2)\n\n const circlesEdge = wedge.fitCircles(edge, halo)\n if (circlesEdge !== null) {\n // In case of a degenerate wedge there will be 2 circles.\n // In a more commong case of a regular wedge there will be only 1 circle.\n // In each case the circle has to touch the edge and not its extension.\n let tangentParameter = 100\n if (wedge.isDegenerate) {\n // Choose such a circle that it has its centre on a different side\n let sidedness = Side.Top\n let k = 0\n while (sidedness === Side.Top && k < points.length) {\n sidedness = edge.pointOnSide(points[k], halo)\n k++\n }\n\n tangentParameter =\n edge.pointOnSide(circlesEdge[0].circle.centre) !== sidedness\n ? circlesEdge[0].tangentParameter\n : circlesEdge[1].tangentParameter\n } else {\n tangentParameter = circlesEdge[0].tangentParameter\n }\n\n // Check whether this tangent point belongs to the edge\n if (tangentParameter > 0 && tangentParameter < 1) {\n const Y = edge.evaluate(tangentParameter)\n const joint = wedge.leftArm.intersectionPoint(edge, halo)!\n side = new Line(joint, Y)\n }\n }\n\n // Investigate for p2 to generate the side if it's still not found\n if (side === null) {\n const circlesPoint = wedge.fitCircles(p2, halo)\n if (circlesPoint !== null) {\n // In case of a degenerate wedge there will be 2 circles.\n // In a more commong case of a regular wedge there will be only 1 circle.\n // In each case the circle has to also be tangent to the hull.\n let tangent: Line\n if (wedge.isDegenerate) {\n // Choose such a circle that it has its centre on a different side\n let sidedness = Side.Top\n let k = 0\n while (sidedness === Side.Top && k < points.length) {\n sidedness = circlesPoint[0].tangent.pointOnSide(points[k], halo)\n k++\n }\n\n tangent =\n circlesPoint[0].tangent.pointOnSide(\n circlesPoint[0].circle.centre,\n halo\n ) !== sidedness\n ? circlesPoint[0].tangent\n : circlesPoint[1].tangent\n } else {\n tangent = circlesPoint[0].tangent\n }\n\n // `tangent` is such that:\n // 1. it is tangent to a circle going through p1,\n // 2. it separates the centre of this circle and the hull points\n // If it is also tangent to the hull => it generates the side\n if (lineTangentToHull(tangent, points, halo).holds) {\n const joint = wedge.leftArm.intersectionPoint(tangent, halo)!\n side = new Line(joint, p2)\n }\n }\n }\n stopVertex = vertex\n vertex--\n }\n\n return side === null ? null : { side, stopVertex }\n}\n\nfunction findAntipode(points: Vec2[]) {\n // find the farthest point from the start and end point of the range\n let farthestIndex = 0\n let farthestDist = 0\n\n for (let i = 0, n: number = points.length; i < n; i++) {\n //check if considered point is farther than farthest\n const testDist: number = new Line(points[0], points[n - 1]).distanceToPoint(\n points[i]\n )\n if (testDist > farthestDist) {\n farthestDist = testDist\n farthestIndex = i\n }\n }\n\n return farthestIndex\n}\n\n/**\n * Finds a minimal perimeter triangle enclosing a convex hull of an _arc_ trace\n * The longest side of the hull is considered to be a bottom of the triangle and\n * _is fixed_. This procedure is tailored from the generic algorithm given in\n * http://scholar.uwindsor.ca/cgi/viewcontent.cgi?article=2527&context=etd\n * starting from p. 22; In the notation of the generic algorithm BC is fixed\n */\nexport function minTriangleWithBase(\n convexHull: Vec2[],\n err: number,\n tol: number\n): { A: Vec2; B: Vec2; C: Vec2 } | null {\n // Sides of the triangle\n let AB: Line, AC: Line\n\n // The arrangement of the points assures that the base is formed by the first\n // and the last point of the hull\n const n = convexHull.length\n const BC = new Line(convexHull[0], convexHull[n - 1])\n\n // Find the antipodal point to the base, i.e. the farthest point\n const antipodIndex = findAntipode(convexHull)\n const baseParallel = new Line(\n convexHull[antipodIndex],\n convexHull[antipodIndex].plus(BC.delta)\n )!\n\n // Bootstrap the algorithm with a degenerate wedge\n let wedge = Inscribe.Wedge.new(BC, baseParallel, err)!\n\n // Progress of the algorithm through the verices (see ref.)\n let Pn = n - 1\n let Qn = antipodIndex\n\n do {\n //iterations\n\n const CQinfo = findEnclosingSide(wedge, Pn, antipodIndex, convexHull, err)\n if (CQinfo === null) {\n return null\n }\n ;({ side: AC, stopVertex: Pn } = CQinfo)\n\n // FYI: Q = AC.end;\n\n // reconstruct the wedge with left arm as is and right arm being the recently found side\n wedge = Inscribe.Wedge.new(wedge.leftArm, AC, err)!\n\n const BPinfo = findEnclosingSide(wedge, Qn, 0, convexHull, err)\n if (BPinfo === null) {\n return null\n }\n ;({ side: AB, stopVertex: Qn } = BPinfo)\n\n // FYI: P = AB.end;\n\n wedge = Inscribe.Wedge.new(wedge.leftArm, AB, err)!\n\n // By design |AB| >= |AC| (see ref.), stop when they are close\n } while (AB.length - AC.length > tol)\n\n const A = AC.intersectionPoint(AB, 0)!\n const B = AB.start\n const C = AC.start\n\n return { A, B, C }\n}\n\nexport function minTriangle(\n convexHull: Array<{ x: number; y: number }>,\n err: number,\n tol: number\n): {\n A: { x: number; y: number }\n B: { x: number; y: number }\n C: { x: number; y: number }\n} | null {\n if (convexHull.length < 3) {\n return null\n }\n\n if (convexHull.length === 3) {\n return { A: convexHull[0], B: convexHull[1], C: convexHull[2] }\n }\n\n const points = convexHull.map((p: { x: number; y: number }) => {\n return new Vec2(p.x, p.y)\n })\n\n let A: Vec2 | null = null\n let B: Vec2 | null = null\n let C: Vec2 | null = null\n let perimeter = -1\n\n let rotations = 0\n\n while (rotations < points.length) {\n // rotate array of points\n if (rotations > 0) {\n points.push(points.shift()!)\n }\n\n // re-calculate the triangle\n const triangle = minTriangleWithBase(points, err, tol)\n\n //assert triangle is found\n if (triangle !== null) {\n const { A: A1, B: B1, C: C1 } = triangle\n\n const perimeter1 =\n A1.minus(B1).norm + B1.minus(C1).norm + C1.minus(A1).norm\n if (perimeter1 < perimeter || perimeter === -1) {\n ;[A, B, C] = [A1, B1, C1]\n perimeter = perimeter1\n }\n }\n\n rotations++\n }\n\n return perimeter === -1\n ? null\n : {\n A: { x: A!.x, y: A!.y },\n B: { x: B!.x, y: B!.y },\n C: { x: C!.x, y: C!.y }\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAQO,IAAM,OAAN,MAAW;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,OAAa,KAAW;AAClC,SAAK,QAAQ;AACb,SA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,EAAE,GAAG,WAAW,CAAC,GAAG,GAAG,WAAW,CAAC,GAAG,GAAG,WAAW,CAAC,EAAE;AAGhE,MAAM,SAAS,WAAW,IAAI,CAAC,MACtB,IAAI,KAAK,EAAE,GAAG,EAAE,CAAC,CACzB,GAEG,IAAiB,MACjB,IAAiB,MACjB,IAAiB,MACjB,YAAY,IAEZ,YAAY;AAEhB,SAAO,YAAY,OAAO,UAAQ;AAEhC,IAAI,YAAY,KACd,OAAO,KAAK,OAAO,MAAM,CAAE;AAI7B,QAAM,WAAW,oBAAoB,QAAQ,KAAK,GAAG;AAGrD,QAAI,aAAa,MAAM;AACrB,UAAM,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,IAAI,UAE1B,aACJ,GAAG,MAAM,EAAE,EAAE,OAAO,GAAG,MAAM,EAAE,EAAE,OAAO,GAAG,MAAM,EAAE,EAAE;AACvD,OAAI,aAAa,aAAa,cAAc,QACzC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,GACxB,YAAY;AAAA;AAIhB;AAAA;AAGF,SAAO,cAAc,KACjB,OACA;AAAA,IACE,GAAG,EAAE,GAAG,EAAG,GAAG,GAAG,EAAG,EAAE;AAAA,IACtB,GAAG,EAAE,GAAG,EAAG,GAAG,GAAG,EAAG,EAAE;AAAA,IACtB,GAAG,EAAE,GAAG,EAAG,GAAG,GAAG,EAAG,EAAE;AAAA,EACxB;AACN;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@escapace/minimum-perimeter-triangle",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"author": "escapace <opensource@escapace.com>",
|
|
6
6
|
"bugs": "https://github.com/escapace/minimum-perimeter-triangle/issues",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@commitlint/cli": "17.
|
|
9
|
-
"@commitlint/config-conventional": "17.
|
|
10
|
-
"@ls-lint/ls-lint": "
|
|
11
|
-
"@types/chai": "4.3.
|
|
8
|
+
"@commitlint/cli": "17.6.5",
|
|
9
|
+
"@commitlint/config-conventional": "17.6.5",
|
|
10
|
+
"@ls-lint/ls-lint": "2.0.0",
|
|
11
|
+
"@types/chai": "4.3.5",
|
|
12
12
|
"@types/mocha": "10.0.1",
|
|
13
|
-
"@types/node": "
|
|
14
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
15
|
-
"@typescript-eslint/parser": "5.
|
|
13
|
+
"@types/node": "20.2.5",
|
|
14
|
+
"@typescript-eslint/eslint-plugin": "5.59.8",
|
|
15
|
+
"@typescript-eslint/parser": "5.59.8",
|
|
16
16
|
"arg": "5.0.2",
|
|
17
|
-
"c8": "7.
|
|
17
|
+
"c8": "7.14.0",
|
|
18
18
|
"chai": "4.3.7",
|
|
19
|
-
"changelogithub": "0.12.
|
|
20
|
-
"esbuild": "0.17.
|
|
21
|
-
"eslint": "8.
|
|
22
|
-
"eslint-config-escapace": "3.
|
|
23
|
-
"eslint-config-prettier": "8.
|
|
24
|
-
"eslint-plugin-editorconfig": "4.0.
|
|
19
|
+
"changelogithub": "0.12.11",
|
|
20
|
+
"esbuild": "0.17.19",
|
|
21
|
+
"eslint": "8.41.0",
|
|
22
|
+
"eslint-config-escapace": "3.17.0",
|
|
23
|
+
"eslint-config-prettier": "8.8.0",
|
|
24
|
+
"eslint-plugin-editorconfig": "4.0.3",
|
|
25
25
|
"eslint-plugin-no-null": "1.0.2",
|
|
26
26
|
"execa": "7.1.1",
|
|
27
27
|
"fast-glob": "3.2.12",
|
|
28
|
-
"fs-extra": "11.1.
|
|
28
|
+
"fs-extra": "11.1.1",
|
|
29
29
|
"husky": "8.0.3",
|
|
30
30
|
"is-ci": "3.0.1",
|
|
31
|
-
"lint-staged": "13.2.
|
|
31
|
+
"lint-staged": "13.2.2",
|
|
32
32
|
"mocha": "10.2.0",
|
|
33
|
-
"prettier": "2.8.
|
|
33
|
+
"prettier": "2.8.8",
|
|
34
34
|
"prettier-config-escapace": "1.0.5",
|
|
35
|
-
"semver": "7.
|
|
36
|
-
"syncpack": "
|
|
35
|
+
"semver": "7.5.1",
|
|
36
|
+
"syncpack": "10.1.0",
|
|
37
37
|
"ts-node": "10.9.1",
|
|
38
|
-
"typescript": "5.0.
|
|
38
|
+
"typescript": "5.0.4"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">= 18.2.0",
|
|
42
|
-
"pnpm": ">=
|
|
42
|
+
"pnpm": ">= 8.6.0"
|
|
43
43
|
},
|
|
44
44
|
"exports": {
|
|
45
45
|
".": {
|
|
@@ -55,9 +55,6 @@
|
|
|
55
55
|
"license": "MPL-2.0",
|
|
56
56
|
"module": "lib/esm/index.mjs",
|
|
57
57
|
"private": false,
|
|
58
|
-
"publishConfig": {
|
|
59
|
-
"access": "public"
|
|
60
|
-
},
|
|
61
58
|
"repository": "https://github.com/escapace/minimum-perimeter-triangle.git",
|
|
62
59
|
"sideEffects": false,
|
|
63
60
|
"type": "module",
|