Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How are overlaps avoided? #141

Closed
kevin-krug opened this issue Feb 5, 2024 · 2 comments
Closed

How are overlaps avoided? #141

kevin-krug opened this issue Feb 5, 2024 · 2 comments

Comments

@kevin-krug
Copy link

kevin-krug commented Feb 5, 2024

first of all thank you for open sourcing your code used for your tech radar.

this is not a issue, but a question on tech radar.js :

how are overlaps between data points on the tech radar avoided?

the custom random function ensures distinct values, however I can't find any code taking the radii of the points into account, to avoid a randomized (x,y) point being within the circle of another point, so that the cartesian diff (Math.sqrt(Math.pow(pointA.x - pointB.x, 2) + Math.pow(pointA.y - pointB.y, 2),)) is always greater 2 * r (r being the dot radius).

thank you for any pointers

@kevin-krug
Copy link
Author

kevin-krug commented Feb 16, 2024

I checked out the code, I see, you're using d3 force simulation / a force directed graph to avoid the overlaps, so I'll look into that 👀 , thanks again for open sourcing your code! (I first was expecting overlap would be checked on assigning a new random point within its segment)

  d3.forceSimulation()
    .nodes(config.entries)
    .velocityDecay(0.19) // magic number (found by experimentation)
    .force("collision", d3.forceCollide().radius(12).strength(0.85))
    .on("tick", ticked);

@bocytko
Copy link
Member

bocytko commented Apr 2, 2024

Closing as you seem to have answered your own question.

@bocytko bocytko closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants