d3/d3-force

Forcing angle in crystalline structure

fabiospampinato opened this issue · 1 comments

Hello there, I'm using d3-force for a little simulation where nodes have labels attached to them visually.

The problem is that if nodes happen to align ~horizontally then those labels are really crammed in there visually:

Screen Shot 2021-06-16 at 15 40 16

While if nodes are aligned ~vertically labels are laid out much better:

Screen Shot 2021-06-16 at 15 40 27

Those two crystalline (?) structures are both hexagonal, but basically the difference is that if the pointy tips of the hexagon are aligned vertically the thing looks great, while if they are aligned horizontally the thing looks pretty bad.

What would be the best way to force the pointy tips to align vertically? I'm thinking that maybe I should change the collision force, since the default one expects point-like masses, should that work? If so is there some already-done alternative collision force that I could use for this?

Fil commented

please open a discussion instead of an issue