Landform nodes - random points

image

Both nodes seem to generate fewer points than the required input on occasion. The top one seems more erratic.

Can anyone explain the difference between the nodes and if there’s any way to get the required number of points each time?

Likely an oversight into how it’s coded as the tolerance may be pruning before or not pruning excessive points. I have written a similar ‘fill a surface’ code using design script which I can try to find if it helps.

1 Like

I actually got round it by making it give me more than required then selecting the number I required from the list. :slight_smile:

I looked a bit closer and the first node maps the shape into UV coordinates… Longest width x longest length and puts the points into the resulting rectangle… So obviously a chunk of the points will be outside.

The 2nd node checks to see what’s outside and runs it again which is why it’s more accurate. (but not perfect).

Overshooting and then requesting the right amount could be problematic if/when it fails to give you enough even with the overshoot. Something which sends up a flag so you know it didn’t work out and has a higher likelihood of getting the target value exactly is likely a better tool, so in that spirit here you go:

A few notes before I post the DYN…

This is a custom definition I built up as part of an AU proposal on creating custom definitions with Design Script in a graph environment. Unfortunately I didn’t have time to submit this session (leaned into classes I thought would be more fun in the remote method of delivery instead), but there is always next year or perhaps in an answer hour or something. It was (and I guess someday will again become) a work in progress, and as such may need some additional development for some edge cases. As a ‘tool to teach’ it may not be the most efficient way to get stuff done or could provide unintended results (although I’m fairly confident it won’t, I haven’t tested this much beyond a few random 2D geometries) but it should illustrate the concept(s) well in a functional way so you can to some further independent study (it’s how we’ve all learned this stuff) and pick up where I left off.

In a nutshell the code does this:

  1. Defines X and the resulting point count as 0 and starts a loop
  2. Adds one to X
  3. Creates as many random points as you request on a surface
  4. Removes any which don’t touch the surface
  5. Prunes out any points which are closer than the desired separation distance.
  6. If X is equal to 500 or the resulting point list is equal to or greater than the desired point count then terminates the loop.
  7. Pulls a number of points equal to the request count from the list (to prevent over population)
  8. Returns the number of iterations used, if the count was hit, and the points produced after trimming excess results.

Anyway, here’s the DYN as promised… feel free to give it a shot in your context. Let me know how it works out if you do.
random points on surface.dyn (15.6 KB)

2 Likes

Awesome. Thanks. I’ll have a play and let you know how it works. :slight_smile:

1 Like