Quantcast
Channel: Grasshopper Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 3672

Random points loop

$
0
0

@Amir_Habibi wrote:

Hi , what is the best way to loop a set of random double for creating a list of point inside a bounding box ?
I’ve showed the way for creating one single point

Random random = new Random();
Point3d pt = new Point3d(0, 0, 0);

//creating boundingbox around ur mesh for random point generation
BoundingBox bb = mesh.GetBoundingBox(true);
//finding the corners
Point3d[] corners = bb.GetCorners();
//get the random pt
pt.X = corners[0].X + (corners[1].X - corners[0].X) * random.NextDouble();
pt.Y = corners[0].Y + (corners[3].Y - corners[0].Y) * random.NextDouble();
pt.Z = corners[0].Z + (corners[4].Z - corners[0].Z) * random.NextDouble();
A = pt;

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 3672

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>