@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/index.cjs
CHANGED
|
@@ -586,6 +586,9 @@ function getChildArcsFan(pd) {
|
|
|
586
586
|
const TAU = Math.PI * 2;
|
|
587
587
|
const norm = (t) => ((t % TAU) + TAU) % TAU;
|
|
588
588
|
|
|
589
|
+
const ccwDelta = (a0, a1) => (a1 - a0 + TAU) % TAU;
|
|
590
|
+
const cwDelta = (a0, a1) => (a0 - a1 + TAU) % TAU;
|
|
591
|
+
|
|
589
592
|
// Circular midpoint that travels CCW from a -> b by half the CCW span
|
|
590
593
|
function midCCW(a, b) {
|
|
591
594
|
const d = (b - a + TAU) % TAU; // CCW delta in [0, 2π)
|
|
@@ -631,20 +634,25 @@ function getChildArcsFan(pd) {
|
|
|
631
634
|
|
|
632
635
|
for (let i = 0; i < N; i++) {
|
|
633
636
|
const prev = A[(i - 1 + N) % N];
|
|
634
|
-
const cur
|
|
637
|
+
const cur = A[i];
|
|
635
638
|
const next = A[(i + 1) % N];
|
|
636
639
|
|
|
637
640
|
// “fan” wedge around the child: midpoint(prev→cur) .. midpoint(cur→next), CCW
|
|
638
641
|
const start = midCCW(prev.a, cur.a);
|
|
639
|
-
const end
|
|
642
|
+
const end = midCCW(cur.a, next.a);
|
|
643
|
+
|
|
644
|
+
// Choose the **shorter** sweep (0 = CCW, 1 = CW in our math-angle convention)
|
|
645
|
+
const ccw = ccwDelta(start, end);
|
|
646
|
+
const cw = cwDelta(start, end);
|
|
647
|
+
const sweep = ccw <= cw ? 0 : 1;
|
|
640
648
|
|
|
641
649
|
child_arcs.push({
|
|
642
650
|
parentId: pid,
|
|
643
|
-
childId:
|
|
651
|
+
childId: cur.id,
|
|
644
652
|
radius,
|
|
645
653
|
start,
|
|
646
654
|
end,
|
|
647
|
-
sweep
|
|
655
|
+
sweep
|
|
648
656
|
});
|
|
649
657
|
}
|
|
650
658
|
}
|