Random, not-self-intersecting pipes growing upward

Hey folks!

I want to create 3D pipes that grow from a small base to a larger base, making many turns but only along cardinal directions (taking turns but mostly moving upward and outward). I want a realistic look without self-intersections. Could you please give me some guidance?

After searching up, minimum spanning tree is somewhat similar to this, except the line segments don’t snap to cardinal directions.

Thanks a lot!

MST has rather nothing to do with that. Given a collection of base Pts you should grow in Z (according a random amplitude) and in XY (according also a random amplitude and a random - or restricted - rotation). Clash checks/events (i.e. every candidate axis or Pipe VS the already sampled/valid ones) would been performed either via Trigonometry of classic Ccx Brep/Brep events (waaaaaaay slower). Obviously some clearance value is required as well.

In the past I have written something similar for entirely different purposes (truss weird [and very ugly] columns etc etc) . If you are familiar with C# I could post it (requires some mods - here and there - in order to fully comply with your goals).


1 Like

I can’t :smiling_face_with_tear:

I wanted to test an idea combining voxel + shortest walk, then realized it’s probably useless, but kind of fun to play with - a bunch of sliders can be swapped/combined/disconnected - kind of overwhelming lol:
walkuprandom.gh (27.3 KB)



ShortestWalk-1-5-2.gha (33.5 KB)

1 Like

Another thought - simpler approach: shortest walk, no voxels, no turns:
walkuprandom-simple-noturn.gh (12.3 KB)


2 Likes

Thanks for your detailed explanation and the demo––this (clash checks and rotations) is more complex than I thought!

Thank you René! I got your files to work––I’ve never tried voxels before, and the ‘point’ of shortest walk being shortest is great for my project.

Now I’m thinking of constraining the paths to a larger path e.g. with some variations. I think I can figure it out and code it up!

1 Like

I found Heteroptera Heteroptera | Food4Rhino whose (discrete) field seems similar to what I want, though…

(1) from what I can understand it doesn’t consider collision)

(2) I can’t find any examples

Some Tips (BTW: this is very easy via code)

  1. The tube paths (Lines and Arcs [fillets]) are sampled on a per DataTree basis (of Type Curve) where rhe 1st dim is the index of the base (start) pt.
  2. Two nested Loops are required: the outer [say via i] is from i = 0 to i < loops (see snaps above) and the inner [say via j] is from j = 0 to j < basePts.Count. If i is even (i.e. i%2 == 0) then we move (randomly) up. If not we rotate (randomly)/move(randomly) in a XY plane. For each zigzag pair we create the Fillet as well with R = radius + filletDelta.
  3. Any candidate path segment should been tested (clash) against all the existed (and sampled) segments. That’s done via a classic while(true) Loop where the break happens if the segment is valid (clash free). Obviously more elaborated questions are required: for instance if we go up and there’s a clash against a segment in XY … this means that the path should become locked (unless backtracing is used - but this is a very simple zigzag thingy so why bother?).
  4. A simple crvA.ClosestPoints(crvB, out pA, out pB) check is OK (where pA.DistanceTo(pB) should be greater or equal to: 2 * radius + clearance).
  5. The fillet radius is tube radius + some filletDelta value. Meaning that the min/max amplitudes (vertical/horizontal) require a pre-check as well.
  6. The core Method for all the above:

finally a ceiling bool option does this:


And that’s the “same” in a 3d grid (also rather very simple [no clash check required] via code and Recursion).

1 Like

Ina dield there is no collision except at sinks every trajectory converge.

It is a field so it works like other fields component

1 Like

https://1j01.github.io/pipes/

1 Like

Whoa! Thanks so much for the super detailed breakdown! This could be teaching resource for computer science students!

Thank you! I learnt to use the magnet icons (spin force ect.). I’m on the way to familiarize with the more complicated components in this plugin!

Thanks! I never knew! That screensaver captured imaginations!