Random Triangular pattern

Three more things…

These issues are common to many GH models so I was aware of them, but set them aside for expediency.

  1. Orientation
  2. Manual settings for dependent geometry
  3. Branches of geometry (avoid Flatten!)

The “base curve” for this model is a rectangle in the XZ plane. Several vectors are implied in that decision: horizontal (X), vertical (Z) and the Y axis for rotation. To handle other orientations the base plane must be generalized using Deconstruct Plane, though it can be more complicated than swapping vectors. The base plane must be rotated correctly to preserve curve directions. Deconstructing XYZ point coordinates can be problematic so using Curve CP ‘D’ (Distance) can be more flexible.

Manual settings for dependent geometry
To get the diagonal lines in this model I initially used two arrays of planes intersecting the rectangular surface. The problem was that the number of planes required to fully span the rectangle was not easily computed so a slider was used. It also was slow. Both issues were addressed by using Contour instead.

Branches of geometry (avoid Flatten!)
Conventional wisdom says to avoid ‘Flatten’ for consistent data tree operations but it gets more complicated than that. PShift (Shift Paths) and Trim Tree work well but can require ‘Simplify’ on their inputs. And they can fail badly when data trees have only one level of branching, as explained in this thread:

That cluster might be written better because it can fail to get the expected result unless a second pShift is connected, as shown here:

pshift_2024Jan28a.gh (20.3 KB)

There can be other factors that make it difficult to handle branches of geometry, including making a relatively simple model more complex. In this case, the code could be modified to accept a grafted list of rectangles representing faces of a building. The “base plane” for each branch would have to be determined from the rectangles. And the many sliders and seed values (11?) that determine randomness would have to be shared by all rectangles or supplied somehow for each branch.

For these reasons, I’ll save that job for another day and post code that addresses only the first two issues mentioned.

triangles_2024Jan28a.gh (59.8 KB)