@euphrasiologist/lwphylo 1.2.6 → 1.2.7
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/index.cjs +13 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -153,6 +153,18 @@ function describeArc(cx, cy, radius, startAngle, endAngle) {
|
|
|
153
153
|
return `M ${p0.x} ${p0.y} A ${radius} ${radius} 0 ${largeArcFlag} ${sweepFlag} ${p1.x} ${p1.y}`;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
// describeArcSweep.js
|
|
157
|
+
function describeArcSweep(cx, cy, r, a0, a1, sweep /*0=CCW,1=CW*/) {
|
|
158
|
+
const TAU = Math.PI * 2;
|
|
159
|
+
const norm = (t) => ((t % TAU) + TAU) % TAU;
|
|
160
|
+
const delta = sweep === 0 ? norm(a1 - a0) : norm(a0 - a1); // magnitude on chosen sweep
|
|
161
|
+
if (delta < 1e-9 || r <= 0) return "";
|
|
162
|
+
const largeArcFlag = delta > Math.PI ? 1 : 0;
|
|
163
|
+
const p0 = { x: cx + r * Math.cos(a0), y: cy - r * Math.sin(a0) };
|
|
164
|
+
const p1 = { x: cx + r * Math.cos(a1), y: cy - r * Math.sin(a1) };
|
|
165
|
+
return `M ${p0.x} ${p0.y} A ${r} ${r} 0 ${largeArcFlag} ${sweep} ${p1.x} ${p1.y}`;
|
|
166
|
+
}
|
|
167
|
+
|
|
156
168
|
/**
|
|
157
169
|
* Recursive function for pre-order traversal of tree (returns array)
|
|
158
170
|
*/
|
|
@@ -1742,5 +1754,5 @@ function drawPhylogeny(
|
|
|
1742
1754
|
}
|
|
1743
1755
|
}
|
|
1744
1756
|
|
|
1745
|
-
export { describeArc, drawPhylogeny, parentFisheye, phisheye, radialLayout, readTree, rectangleLayout, subTree, unrooted };
|
|
1757
|
+
export { describeArc, describeArcSweep, drawPhylogeny, parentFisheye, phisheye, radialLayout, readTree, rectangleLayout, subTree, unrooted };
|
|
1746
1758
|
//# sourceMappingURL=index.js.map
|