Add a bigger triangle to see how it looks. Can be enhanced but it does not look bad

This commit is contained in:
Matthieu Baumann
2021-02-03 15:51:58 +01:00
parent 84fcb6fb8a
commit 5ae019fb73
2 changed files with 41 additions and 11 deletions

9
dist/footprint.html vendored
View File

@@ -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
});
</script>
</body>
</html>

View File

@@ -62,7 +62,6 @@ fn subdivide<P: Projection>(
vertices.push(b);
vertices.push(c);
}
//return;
} else {
// Subdivide a->b and b->c
subdivide::<P>(
@@ -78,13 +77,43 @@ fn subdivide<P: Projection>(
);
}
}
(Some(a), Some(b), None) => {
vertices.push(a);
vertices.push(b);
(Some(_), Some(_), None) => {
// relay the subdivision to the first half
subdivide::<P>(
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::<P>(
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::<P>(
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::<P>(
vertices,
[&e, &((mp[1] + e) * 0.5).normalize(), &mp[1]],
camera,
);
//vertices.push(b);
//vertices.push(c);
}
_ => (),
}