I created a list of cubes and I want to delete X number of cubes from that list but I want to be sure that the cubes that I delete has less that 6 adjacent.
So here is the steps that I want to do:
1 I want to count how many adjacent for each cube
2.delete one cube that has less that 6 adjacents
3.repeat step 1 and 2 X timesmodular form.dyn (77.4 KB)
You say “repeat step 1 and 2 X times” but is X a defined number of times or until you run out of cubes to delete?
And only one cube not many? And randomly selected?
What do you consider adjacent? Touching? Close?
And do they have to be cubes? (This get’s a little tricky with corners touching each other.)
Are the cubes all the same size and on a grid? If so you could do a distance between centroids to eliminate the corners. Any distance equal to the length of a cube edge any one edge returning true would count towards the six.
It is an X number of cubes but I want to find how many adjacents each cube to delete one that has less than 6 adjacents then I want to count how many adjacent for each Cube after deleting the first one and delete the second which also has 6 adjacents…and repeat this X number of times
And yes Random selection but everytime I want to shuffle the choice
List.Shuffle, or list.drop with a math.random will allow for that. Can you post a sketch and an image of your script so far?
All the cubes has the same size. They are next each other on cue direction but there is a void in the middle. I also uploaded the code.
What I mean how many of the Cube faces are touching other cubes faces
0,1,2,3,4,5 or 6
So in the photo you can see how they are adjacent
You can get the cubes center points, and then do a distance calc between the other centerpoints, and a list.sort and then get the item at index. If that distance is equal to the cube edge, than that point has six faces tangential with other elements, and shouldn’t be included in the delete list. If the length is greater than Include it in the set to drop items from.
Once you have the list you can use a list.shuffle node and a list.drop node or a list.remove item at index node with a random list of indices to remove Y number of blocks (I know you said one but I don’t think that removing a variable will change the results, and will allow faster processing of the overall graph if you’re after lets say a 25% reduction of cubes. I like the idea of removing X on the first run, X-1 on the second, X-2 in the third…)
Having said all that, there are a LOT of geometrical calculations there even with the simplified variable removal. You may be better off generating the cubes after pruning the list of points as it will be more efficient memory wise to remove points than it will to remove cubes.
@Abdulaziz.Afandi Below is a way to distinguish cubes that have 6 adjacent cubes from those that don’t.
Basically, the peripheral cubes have less than 6 adjacent cubes, right?
You should be able to proceed with the deleting based on this, I suppose
modular form-Vik.dyn (88.3 KB)
Some random deleting of peripheral cubes …
I know that removing points I faster in calculation … Any ideas how to do that?
Can I get a sketch or a screen shot , It will help me a lot.
That is awesome for finding how many adjacent!
It is working fantastic.
Thank you that is really helpful,