[SciPy-User] random points within an ellipse

alex argriffi@ncsu....
Wed Aug 4 19:18:25 CDT 2010

On Wed, Aug 4, 2010 at 7:38 PM, Benjamin Root <ben.root@ou.edu> wrote:

> Hi,
> 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?
> Thanks,
> 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...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100804/82d9c5e7/attachment.html 

More information about the SciPy-User mailing list