HI,
I am trying to develop a very basic testing. This requireS restricting the random generated dots inside a rectangular. Does anyone know the components do this trick?
Or do I use boundary component?
Thanks,
HI,
I am trying to develop a very basic testing. This requireS restricting the random generated dots inside a rectangular. Does anyone know the components do this trick?
Or do I use boundary component?
Thanks,
Grasshopper’s random component lets you input how many random number it should generate.
If you are accessing the RhinoCommon, you can use Python’s own random library that has a sample()
method
you mean pop 2D or pop geometry?
Since you tagged as Rhinocommon, if you are scripting
Make sure your random values are generating between 0 and 1
and use them for the x and y values in the rectangle space using Rectangle.PointAt(double,double) like the following:
Point3d recPt = yourRectangle.PointAt(randomX, randomY);
Michael and Will, I am not doing scripts. Thanks Michael for pointing out this, so I revised my question.
Since you want to generate random dots inside a rectangular region, you can simply use the Pop2D (Populate 2D)
component, with your region as input.
If you want your points to be three-dimensional, you can use Pop3D (Populate 3D)
and input your region as a rectangular box, instead of a two-dimensional rectangle.
Both components let you control the number of random points in your region, as well as the random seed, which basically lets you change the random state.
Thanks. I do use populate 2d component in the beginning. However, after several more steps, I need to restrain my circles into new rectangular, this rec isn’t coming from the Populate 2d. What should I do? Do I try domain or boundary components?
test-restrictedInRec.gh (6.1 KB)
You need to explain more clearly what you’re after!
Your file includes only the rectangle that you generate your circle center points in. The second rectangle that you mentioned above is missing.
Are you after packing your circles into a rectangular region or do you simply want to sort out circles that are not within this region?
“Are you after packing your circles into a rectangular region”
-sorry for not explaining my questions clearer. The above you mentioned is indeed what I want to do. Much Thanks.
OK, check this out:
Hi, I still want to figure out my own way at this moment. The only thing I couldn’t do is to erase those circles outside the rectangular I put in. What should I do? Please help.
test-restrictedInRec1.gh (9.7 KB)
Thanks for your help. I have some questions for your definition:
C(Curve)input of Point In Curve only takes curve parameter, not rectangle. They are different. You need datatype conversion.
Kim, thanks for the explanation.
I see. In my previous definition, I put an attractor line to seperate the circles. I wonder if this still work in your definition?
?.. You mean this?
You can scale circles ;you need Pufferfish or use standard component
test-restrictedInRec2.gh (13.1 KB)