new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

D3 · all subjects

d3-force/collide

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

d3.forceCollide configuration

Force collide configuration methods: collide.radius (set circle radius), collide.strength (set collision resolution strength), collide.iterations (set number of iterations).

forceCollide constructor signature

forceCollide(radius) creates a new circle collide force with the specified radius. If radius is not specified, it defaults to the constant one for all nodes. Example: const collide = d3.forceCollide((d) => d.r);

collide.radius method signature

collide.radius(radius) sets the radius accessor to the specified number or function and returns the force, or returns the current radius accessor if radius is not specified. The radius accessor is invoked for each node in the simulation, being passed the node and its zero-based index. The resulting number is stored internally such that the radius of each node is only recomputed when the force is initialized or when this method is called with a new radius, not on every application of the force. The default radius accessor is a function that returns 1.

collide.strength method signature

collide.strength(strength) sets the force strength to the specified number in the range [0,1] and returns the force, or returns the current strength if strength is not specified. The default strength is 1. Overlapping nodes are resolved through iterative relaxation, and the change in velocity is dampened by the force's strength to allow resolution of simultaneous overlaps.

collide.iterations method signature

collide.iterations(iterations) sets the number of iterations per application to the specified number and returns the force, or returns the current iteration count if iterations is not specified. The default iteration count is 1. Increasing the number of iterations greatly increases the rigidity of the constraint and avoids partial overlap of nodes, but also increases the runtime cost to evaluate the force.

Collide force behavior

The collide force treats nodes as circles with a given radius, rather than points, and prevents nodes from overlapping. Two nodes a and b are separated so that the distance between them is at least radius(a) + radius(b). This is by default a soft constraint with configurable strength and iteration count to reduce jitter.

Give your agent this brain