mirror of
https://github.com/kalmarek/SmallHyperbolic
synced 2024-11-27 16:35:26 +01:00
use bezier instead of elliptic arrows
This commit is contained in:
parent
8df415ca59
commit
007a8bcece
20
docs/morphisms/js/d3_visualisation.js
vendored
20
docs/morphisms/js/d3_visualisation.js
vendored
@ -24,11 +24,23 @@ function drag(simulation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function linkArc(d) {
|
function linkArc(d) {
|
||||||
const r = Math.hypot(d.target.x - d.source.x, d.target.y - d.source.y);
|
let r = Math.hypot(d.target.x - d.source.x, d.target.y - d.source.y);
|
||||||
|
r = 40*Math.exp(r/50)
|
||||||
|
// r = 50 + 2*(r/20)**3
|
||||||
|
// Elliptical arc:
|
||||||
|
// return `
|
||||||
|
// M${d.source.x},${d.source.y}
|
||||||
|
// A${r},${r} 0 0,1 ${d.target.x},${d.target.y}
|
||||||
|
// `;
|
||||||
|
let xmid = (d.source.x + d.target.x) / 2
|
||||||
|
let ymid = (d.source.y + d.target.y) / 2
|
||||||
|
// cubic smooth Bezier
|
||||||
return `
|
return `
|
||||||
M${d.source.x},${d.source.y}
|
M${d.source.x} ${d.source.y}
|
||||||
A${r},${r} 0 0,1 ${d.target.x},${d.target.y}
|
S${xmid - 0.01*ymid} ${ymid + 0.01*xmid}
|
||||||
`;
|
${d.target.x},${d.target.y}
|
||||||
|
`
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
function highlight(node) {
|
function highlight(node) {
|
||||||
|
Loading…
Reference in New Issue
Block a user