I’m trying to make a definition that subdivides the outer voxels into eight voxels. So far I’ve made a scalable box grid that is culled with a brep so that only the inside remains. Now I’m trying to figure out how to make the outer layer of boxes half size.
Is there a way to change the box size dynamically? Some kind of attractor point or list the outer boxes due to intersection with the brep or something?
This is a classic recursive task. Recursion is a rather “odd” way to do business where something calls itself until something else happens and the loop is terminated.
For instance in loop: 0 you subdivide and you get a List of boxes (2d or 3d). Then you sample the ones that yield a ccx event with a Curve and/or a Mesh and/or a Brep (general case) into a tree at branch loop.
Then in loop 1 you gather items from tree branch (loop -1) and for each you subdivide and you sample the new ones (ccx etc etc) into a tree at branch loop. This means that the amount of items can escalate quite fast (but depends on the “filter” used for passing items to the next loop).
A tree like that is in fact the history of the actions that occured (until the recursion termination) … so by selecting a given branch you can inspect what happened per loop.
You can do that via Anemone (or via code - my game). I fact I have stuff like that but is carried over solely via code and works in 3d against any Brep/Mesh.
The result is kinda like “approximating” an image via “pixels” with more and more finer resolution.
this is an experiment I did a long time ago: It’s not standard cuboid division (by 8) but rather by 2.
they are not cubic voxels (in order to be cut in half and retain a fixed proportion, they are based on the delian constant (2^1/3). I don’t know if you will find it useful.
(also, the definition could be greatly simplified if you use ‘anemone’ for the iterative process)
This one below uses Split Brep(white group, slightly slower) instead of BBX, then returns the piece of each split box (boxes that intersect the brep) that is either inside or outside the brep, depending on the Value List switch: “Interior” or “Exterior”.
I’ll see if there’s anything in your definition that I can use, but from what I see it’s not doing what I tried to accomplish. The point was to have two sizes of voxels/boxes: the main size inside the brep and then subdivide the outer of those voxels to eight voxels.
Ideally I’d have a definition that automatically made the boxes half size after a distance or outside a shape. That’s what I’m trying to figure out how to do.
It iteratively save each box that is fully inside the solid (by doing distance check with box diagonal) and split other boxex into 8 smaller (half size) for the next iteration. Boxes that are outside are discarded.
As how this works it always result in a set of boxex that is smaller than the original shape (it would take infinite time to reach correct volume).
43k boxes (centers+sizes) in less than a second, boxes have different size.
The rest of the work, the reconstruction and displaying of the boxes is actually more heavy: rhino viewport almost frozen (really low redraw fps) and baking take most of the time… so components inside attached solution are disabled.
My dear Watson (pick up that %%@ phone and tell me your news). Here’s how to address that voxel puzzle (general case: Lists of any template shape: Breps (slow) or Meshes (OK, but check for islands first) or Both (hmmm)).
First you should mastermind a recursion where the voxel subdivisions are user controlled. Plus you should use alternative ways to cut the mustard (because Ccx is rather slow - see 2). Plus you should control the voxelPlane (so you can animate that for LOL results). Plus you’ll need lot’s of espresso.
Since the N of voxels can escalate “a bit” and in order to finish the task this year (or century)… see 1 above. Plus: in fact that’s a classic // thingy were locking the right tasks is the 1M goal - because in order to proceed to the next recursion loop you should get all the pieces first on hand :
Dear lord of darkness! Please forgive me for my insolence! I will pm right away!
now let us not destroy yet another thread with irrelevant posts!
people come here for answers, not listening to old men rumbling on…
I am working with voxelization and would need someones help, I have this code that works good with brep selection,but I want to upgrade it so I have full control over pixel ,box size and can change then to rectangular shape( make them appear exact dimensions as I wan 5.3x11.8x3.5). Right now at the moment when I try to do it, the division between the pixels are destroyed and it wont array along the brep nicely. In attached documents you can find grasshopper code and the rhino file with brep.voxel.gh (21.1 KB) brep AT.3dm (750.5 KB)