diff --git a/dist/footprint.html b/dist/footprint.html index 6a2234ea..4e6e995c 100644 --- a/dist/footprint.html +++ b/dist/footprint.html @@ -27,13 +27,14 @@ aladin = A.aladin('#aladin-lite-div', {target: 'M 1', fov: 0.2}); var overlay = A.graphicOverlay({color: '#ee2345', lineWidth: 3}); aladin.addOverlay(overlay); - overlay.addFootprints([A.polygon([[83.64287, 22.01713], [83.59872, 22.01692], [83.59852, 21.97629], [83.64295, 21.97629]]), A.polygon([[83.62807, 22.06330], [83.58397, 22.02280], [83.62792, 22.02258]])]); + overlay.addFootprints([ + A.polygon([[83.64287, 22.01713], [83.59872, 22.01692], [83.59852, 21.97629], [83.64295, 21.97629]]), + A.polygon([[83.62807, 22.06330], [83.58397, 22.02280], [83.62792, 22.02258]]), + A.polygon([[8.62807, 220.06330], [83.58397, 10.02280], [150.62792, 87.02258]]) + ]); overlay.add(A.circle(83.66067, 22.03081, 0.04, {color: 'cyan'})); // radius in degrees }); - - - diff --git a/src/core/src/line.rs b/src/core/src/line.rs index fea1aa6a..75778ffb 100644 --- a/src/core/src/line.rs +++ b/src/core/src/line.rs @@ -62,7 +62,6 @@ fn subdivide( vertices.push(b); vertices.push(c); } - //return; } else { // Subdivide a->b and b->c subdivide::

( @@ -78,13 +77,43 @@ fn subdivide( ); } } - (Some(a), Some(b), None) => { - vertices.push(a); - vertices.push(b); + (Some(_), Some(_), None) => { + // relay the subdivision to the first half + subdivide::

( + vertices, + [mp[0], &((mp[0] + mp[1]) * 0.5).normalize(), mp[1]], + camera, + ); + + // and try subdividing a little further + // hoping that the projection is defined for e + let e = (mp[1] + mp[2]) * 0.5; + subdivide::

( + vertices, + [mp[1], &((mp[1] + e) * 0.5).normalize(), &e], + camera, + ); + //vertices.push(a); + //vertices.push(b); } - (None, Some(b), Some(c)) => { - vertices.push(b); - vertices.push(c); + (None, Some(_), Some(_)) => { + // relay the subdivision to the second half + subdivide::

( + vertices, + [mp[1], &((mp[1] + mp[2]) * 0.5).normalize(), mp[2]], + camera, + ); + + // and try subdividing a little further + // hoping that the projection is defined for e + let e = (mp[0] + mp[1]) * 0.5; + subdivide::

( + vertices, + [&e, &((mp[1] + e) * 0.5).normalize(), &mp[1]], + camera, + ); + //vertices.push(b); + //vertices.push(c); } _ => (), }