This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Part 2 : I made a big water tank and simulated a situation of water erosion. In other words, it searches for adjacent space (water) from the surrounding walls(water tank) and terminates when it reaches the cubes. The rest is done by using the solution from Part 1.
By the way, it took long time to simulate the flooding due to a simple logic bug.
The trick for me on part 2 was removing the group of air droplets accessible from the outside. I expanded the min and max boundaries of the drop and removed the largest continuous group of drops. Took me a while to figure out that there were two types of air drops: those completely surrounded by lava and those touching other internal air drops. My input data has a cluster of 1000+ internal air drops.
Part1 was pretty easy just generating all the faces and seeing if they matched another face. For Part2, I thought of each cube of space as a cube and combined it all using the make group tool (ie is cube of space A is connected to cube of space B, and B connected to C, then the make group puts A,B,C into a single group).
part1: generate 6 side +1 for each. outer join with lava.
part2: find closed area, instead of closed spot.
1. generate whole 20x20x20 2. generate 6 side for each point as well. 3. compare lava with x. y and z axis. to identify whether it blocked.
now, we have list of open and closed point (directly, have lava in front of all 6 sides.). to settle the indirect open point, I used influence method, which create a loop macro to check if one of the sides is open, change to open.
now we have a cleaned closed point, we just need to outer join against the part1 answers.
Part 1: - the solution here is to generate every neighbour cell of an existing cell - there should be one for each face (6) - if the generated neighbour cell exists in the original set - then this face was never visible ... only odd thing here is that you're not generating ALL neighbours - only those facing a face (i.e. the 3d manhattan distance is exactly 1)
Part 2: Part 2 asks that you exclude any surfaces that are internal only (holes) .... so - if you can figure out the internal holes - and add them back into the set - then part 1 works (and just gives you external faces)
So - 4 part solution: a) generate every single cell around and within the blob (I added a 1 cell boundary) b) working from the outside - move to every cell that you can see. After a few iterations, this separates the cells into outside; rock; and inside c) add the inside to the rocks to make it a solid object (no internal holes) d) then just apply part 1 - and the answer pops out like magic
parse & bulk out the data....
Walk from the edges to find everything visible from outside