Grasshopper

generative modeling for Rhino

creating a percentage domain

hey

i want to create random points on a surface (using a definition i found in another discussion) within a specific area on the surface.
as you can see in the image below, i want to be able to tell the random points to be located within the horizontal domain of 10% to 90%
and within the vertical domain of 60% to 90%

this construction has no measurements or units, otherwise i'd know how to solve it. but the percentage framing is what troubles me.

anybody with a solution?

(rhino and gh files below)

Tags: boundary, frame, on, percentage, points, random, surface

Views: 374

Attachments:

Replies to This Discussion

If the parameterization of the surface is linear (I believe the \$10 word for this is "arc-length-parameterization", meaning that the parameters increase in equal measure to the physical dimensions) then you just need to create a 2D-Domain that matches this {10%-90% ; 60%-90%} (see attached).

If your surface does not have linear parameterization, it becomes a whole lot more complicated.

--

David Rutten

david@mcneel.com

Attachments:

oh crap, if i had only known of Populate2D earlier... i thought there is no other Random engine.

luckily, my surface is as simple as it gets, just a planar rectangle, so that works excellent!

Populate2D is rather new (added in 0.8.0060), maybe that's why you missed it?

--

David Rutten

david@mcneel.com

is there a chance to input a circle into the Populate2D to define it's region?

the R parameter clearly asks for a rectangle... i hope you'll make that possible in a future built!

Or do it yourself:

(generate enough -> pick out the useful ones)

Using circles and a curve region inside/outside test will be faster than testing inclusion for a surface. The fastest approach in this case would be to measure distance to the center point and removing all points that are further away than the radius.

--

David Rutten

david@mcneel.com

You're right, I wasn't aware of the curve containment component, thanks.

A small question: why does it not work if I put the expression if(r=1,true,false) in the output R of the containment component? (it normally outputs 0=coincident, 1=inside, 2=outside)

• View All