Closed NagRock closed 5 years ago
Ok, I've debugged this and looks like I need to have defined 4 variables to get this working:
x = 0;
y = 0;
z = 0;
vz = 0;
Is this a bug?
@NagRock you should define numDimensions
simultaneously when you include the nodes data, like so:
d3Force3d.forceSimulation(data, 3)
.
I've adjusted the docs to reflect this more clearly.
@vasturiano thanks, yes documentation didn't point it clearly. Nice that you've fixed it.
But, looks like I'm getting different results when I use d3Force3d.forceSimulation(data, 3)
and when I set default zeros for data elements.
I can create sample project if you want to take a look at it.
@NagRock that is expected, because internally the nodes are not initialized to 0,0,0, but in a 3D phyllotaxis arrangement, so that they spread out evenly.
From the docs:
The position ⟨x[,y[,z]]⟩ and velocity ⟨vx[,vy[,vz]]⟩ may be subsequently modified by forces and by the simulation. If either applicable vx, vy or vz is NaN, the velocity is initialized to ⟨0,0,0⟩. If either applicable x, y or z is NaN, the 2D position is initialized in a phyllotaxis arrangement, so chosen to ensure a deterministic, uniform distribution around the origin.
That initial arrangement influences the eventual nodes topology. So yes, you would expect a difference, but hopefully is for the best. 😃
Thanks for explanation!
Hi, when I try to do simple simulation with 3 dimension I get
z
asNaN
:d3Force3d.forceSimulation(data).numDimensions(3)
Do I need to do something special to get
z
defined?Is there any as simple as possible example with 3d simulation?