Random point generator


I would like to generate a Random point on the X-Y Plane within a boundary curve using RhinoCommon.

What is the best way to generate it without doing too many tests on whether the point is in the boundary?

(Menno Deij - van Rijswijk) #2

Depending on the shape of the boundary curve, you could determine its bounding box (i.e. rectangle) and put a random point inside the box (random widht/height). Then, test inside/outside with one of the Curve.Contains(...) methods. The curve must be closed of course.