[SciPy-User] random points within an ellipse
Wed Aug 4 19:18:25 CDT 2010
On Wed, Aug 4, 2010 at 7:38 PM, Benjamin Root <firstname.lastname@example.org> wrote:
> For a project, I need to create sets of random coordinates within a 2d
> domain. To start, I have been creating random x and y coordinates, which
> has worked very nicely. However, I would like to start doing some fancier
> domains like ellipses and crescents. Does anybody know of any useful tricks
> for doing this?
> Ben Root
For an ellipse you could start with random points in a disk like this
and then I think you can just stretch along an axis to give the points
inside the ellipse disk.
For fancier shapes you can do rejection sampling as long as you can get a
bounding box and
you can tell what is inside vs outside the domain.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User