@euphrasiologist/lwphylo 1.2.19 → 1.2.20
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/drawPhylogeny.cjs +12 -4
- package/dist/drawPhylogeny.cjs.map +1 -1
- package/dist/drawPhylogeny.esm.js +12 -4
- package/dist/drawPhylogeny.esm.js.map +1 -1
- package/dist/drawPhylogeny.umd.js +1 -1
- package/dist/drawPhylogeny.umd.js.map +1 -1
- package/dist/index.cjs +12 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/drawPhylogeny.cjs
CHANGED
|
@@ -473,6 +473,9 @@ function getChildArcsFan(pd) {
|
|
|
473
473
|
const TAU = Math.PI * 2;
|
|
474
474
|
const norm = (t) => ((t % TAU) + TAU) % TAU;
|
|
475
475
|
|
|
476
|
+
const ccwDelta = (a0, a1) => (a1 - a0 + TAU) % TAU;
|
|
477
|
+
const cwDelta = (a0, a1) => (a0 - a1 + TAU) % TAU;
|
|
478
|
+
|
|
476
479
|
// Circular midpoint that travels CCW from a -> b by half the CCW span
|
|
477
480
|
function midCCW(a, b) {
|
|
478
481
|
const d = (b - a + TAU) % TAU; // CCW delta in [0, 2π)
|
|
@@ -518,20 +521,25 @@ function getChildArcsFan(pd) {
|
|
|
518
521
|
|
|
519
522
|
for (let i = 0; i < N; i++) {
|
|
520
523
|
const prev = A[(i - 1 + N) % N];
|
|
521
|
-
const cur
|
|
524
|
+
const cur = A[i];
|
|
522
525
|
const next = A[(i + 1) % N];
|
|
523
526
|
|
|
524
527
|
// “fan” wedge around the child: midpoint(prev→cur) .. midpoint(cur→next), CCW
|
|
525
528
|
const start = midCCW(prev.a, cur.a);
|
|
526
|
-
const end
|
|
529
|
+
const end = midCCW(cur.a, next.a);
|
|
530
|
+
|
|
531
|
+
// Choose the **shorter** sweep (0 = CCW, 1 = CW in our math-angle convention)
|
|
532
|
+
const ccw = ccwDelta(start, end);
|
|
533
|
+
const cw = cwDelta(start, end);
|
|
534
|
+
const sweep = ccw <= cw ? 0 : 1;
|
|
527
535
|
|
|
528
536
|
child_arcs.push({
|
|
529
537
|
parentId: pid,
|
|
530
|
-
childId:
|
|
538
|
+
childId: cur.id,
|
|
531
539
|
radius,
|
|
532
540
|
start,
|
|
533
541
|
end,
|
|
534
|
-
sweep
|
|
542
|
+
sweep
|
|
535
543
|
});
|
|
536
544
|
}
|
|
537
545
|
}
|