Skip to content

Commit

Permalink
Fix polytomy bounding box calculation. Caused numerical instability w…
Browse files Browse the repository at this point in the history
…hen zooming deep (e.g. Citrus reticulata) due to bad choice of graphref.
  • Loading branch information
wolfmanstout committed Jan 21, 2024
1 parent 81bc1e8 commit f39d6ff
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -36,14 +36,13 @@ class PolytomyHorizonCalc {
return changed;
}
calc_horizon(node) {
// Calculate parent's arcr based on our own.
// Calculate parent's arcr within our coordinate reference.
function parent_arcr(node) {
if (!node.upnode) return 0;

// NB: node.upnode.arcr can't be relied on at this point, so derive from nextr
for (let i = 0; i < node.upnode.children.length; i++) {
if (node.upnode.children[i] === node) {
return node.arcr / node.upnode.nextr[i];
return node.upnode.arcr / node.upnode.nextr[i];
}
}
}
Expand Down Expand Up @@ -82,4 +81,4 @@ class PolytomyHorizonCalc {

let polytomy_horizon_calc = new PolytomyHorizonCalc();

export default polytomy_horizon_calc;
export default polytomy_horizon_calc;

0 comments on commit f39d6ff

Please sign in to comment.