vasturiano / 3d-force-graph

3D force-directed graph component using ThreeJS/WebGL
https://vasturiano.github.io/3d-force-graph/example/large-graph/
MIT License
4.48k stars 803 forks source link

Node border #640

Open rlyfun opened 10 months ago

rlyfun commented 10 months ago

I have a problem where, if Im creating a new node that isn't linked to anything and i render it in the graph that already has a lot of connections ,then the node gets sent somewhere really far away, because of how the force graph works, and it becomes harder to locate the node.

how can i create like a spherical bounding box to keep the nodes contained, so they don't go flying out into space?

here's a picture depicting what I would like to accomplish:

image

vasturiano commented 10 months ago

@atlllas thanks for reaching out.

You could add an additional force: d3-force-limit that prevents nodes from exiting a given sized container.

In that force plugin the container is cubical not spherical, but maybe that suits your case. If not, you can use the same principle to build a spherical container custom force.