Divide cube GH

These subdivisions are iterative (the same algorithm is executed for n iterations, the next iteration starts from the situation at the end of the previous one).

A possible algorithm in your case would be:

. from a list of boxes, find the closest box to each attractor point
. subdivide only the closest box
. pass to the next iterations the subdivided boxes

Repeat the above n times (as many as you need). Since Grasshopper does not implement iterative processes natively, you’ll either need a plugin like Anemone or code it yourself in a custom C# or Python scripting component.

I’ve made a possible example using Anemone. For Octree subdivisions, I prefer a non-distructive method. The algorithm works for any number of points, in any position.

Octree Attractors.gh (23.8 KB)