Hi FolksHere is something that has been puzzling me for ages.I've been trying to (roughly) emulate the terrific-looking NYC2259 recursive vertical splits. However, due to my shortfall in skill, I'm using a much simpler approach. It goes like this: - The core has a given height, and the sections have a given (potential) height. For this example, the potential section height is twice the height of the core.
- Using the touches() instruction as a limitation, the randomized recursive vertical split and gaps should keep looping upwards while they touch the core.
- --If the sections and gaps loop too high ,to where the sections are not touching the core (i.e. be floating in the air and unsupported) so they will stop (give NIL).
- --If the sections and gaps reach the maximum specified section height, they will also stop.
What puzzles me is that seems to work great, but not all the time. I've embedded the script below, and here you can see it on this 2-minute video: http://youtu.be/j8phESvleRM If I split, translate or rescale the core geometry, the core geometry is always generated but, often, the section geometry is not generated at all*. But if I turn off the touches() limitation, both the sections and core are generated of course. Yet, the generated section geometry is visibly touching one or more elements of the core.As I understand it, the touches() should pick up contact with any shape tree. Perhaps there is there something that I am missing?Thanks for your help!David* yes, I'm working with watertight volumes, not polygons#################################################################################################################################### ## VARIABLES #################################################################################################################################### ## Level of Detail attr LOD = 1 ############################ ## Height and floors numberOfFloors = rint((scope.sx * scope.sz)/floorHeight/10 * popDensityFactor ) popDensityFactor = 1 coreHeight = numberOfFloors * floorHeight // actual height of the core sectionHeight = numberOfFloors * floorHeight * 2 // potential maximum height of the recursive sections and building floorHeight = 3 tileWidth = 3 ############################ ## Sections sectionRandomizer = (rint(randomSectionDistribution * sectionHeight *.75/floorHeight)) * floorHeight randomSectionDistribution = 15%:.4 20%:.2 20%:.1 20%:.5 else: .3 gapRandomizer = (rint(randomGapDistribution * sectionHeight *.75/floorHeight)) * floorHeight randomGapDistribution = 50%:.05 20%:.1 20%:.2 else: .3 #################################################################################################################################### ## RULES #################################################################################################################################### Lot--> // make a rectangle from the initial shape, rescale it and align it innerRect s('0.7,'1,'0.7) center(xz) alignScopeToAxes(y) s('1,0,'1) Squareize Squareize --> // make the new rectangle shape into square, lenght of side is the shortest scope length case scope.sx == scope.sz: s('1,0,'1) center(xz) Footprint case scope.sx > scope.sz: s(scope.sz,0,scope.sz) center(xz) Footprint case scope.sz > scope.sx: s(scope.sx,0,scope.sx) center(xz) Footprint else: NIL Footprint--> // extrude the core case scope.sx * scope.sz > 500: extrude(coreHeight ) Tower else: NIL ################################ ################################ ## CORE AND SECTIONS ################################ Tower--> // insert the model i(fileRandom("assets/volumes/Rule5/*.obj")) //CORE split(z){ '0.1: NIL | '0.3 : s('.5, '1, '.5) center(xz) t(0,0,2) Mass | '0.2 : NIL | '0.3: s('.5, '1, '.5) center(xz) t(0,0,-10) Mass |'0.1: NIL } //SECTIONS split(z){ '0.1: NIL | '0.7: center(xz) s('1, sectionHeight, '1) RecursiveSections |~1: NIL } ############################### ############################### ## RECURSIVE SECTIONS ############################### RecursiveSections --> // ALTERNATIVE 1: DESIRED repeat the section and gap, while it touches the core case touches(intra) : split(y){ sectionRandomizer: Mass | gapRandomizer : NIL | ~1: RecursiveSections } else: NIL // ALTERNATIVE 2: CHECK turn off touches() to see if some of the sections touch the core /* split(y){ sectionRandomizer: Mass | gapRandomizer : NIL | ~1: RecursiveSections } */ ################################ ################################ ## MASS ################################ Mass--> // split up the mass into roof, base and sides alignScopeToAxes(y) center(xyz) comp(f) {horizontal: BasicRoof |all : WallAlignCheck } ################################ ################################ ## WALL ################################ WallAlignCheck--> // check the alignment (not sure how this part works, but it seems to work) alignScopeToGeometry(zUp, auto) alignScopeToAxes(y) split(y){0.01 : TinySplit // Workaround split to get a tiny horizontal edge, for vertical alignment | ~1 : Wall1 } Wall1--> // split odd shapes into more usual shapes (not sure how this part works, but it seems to work) convexify() comp(f){all: Wall2} Wall2--> // give it a nice color color("#ff0000") ################################ ################################ ## FRAME ################################ Frame--> // give it a nice color color("#ff0000") Done. ################################ ################################ ## TINY SPLIT ################################ TinySplit--> // give it a nice color color("#ff0000") Done. ################################ ################################ ## BASIC ROOF ################################ BasicRoof --> // leave it white Roof.