generic-github-user / Caesium

General-purpose AI library with NEAT-style genetic algorithm.
https://generic-github-user.github.io/Caesium/src/versions/javascript/projects/network-visualization/
MIT License
1 stars 1 forks source link

Circles overflow edges of SVG element #40

Closed generic-github-user closed 6 years ago

generic-github-user commented 6 years ago

The radii of the circles are limited to the inner bounds of the SVG element, but the circles themselves can overflow. Some padding should be added (equivalent to the radius of the circles, or a little bit more).

generic-github-user commented 6 years ago

Fixed issue (added spacing)

circle.setAttribute(
      "cx", Math.round(
            random(
                  (radius + 3),
                  (100 - radius - 3)
            )
      ) + "%"
);
circle.setAttribute(
      "cy", Math.round(
            random(
                  (radius + 3),
                  (100 - radius - 3)
            )
      ) + "%"
);

image

It kind of looks like some kind of modern art.