There are useful articles available at mathworld.wolfram.com explaining uniform sampling of points from spheres, disks circles and a few other entities.
http://mathworld.wolfram.com/CirclePointPicking.html
http://mathworld.wolfram.com/SpherePointPicking.html
http://mathworld.wolfram.com/DiskPointPicking.html
The disk point picking transformation that is given will result in the same distribution that Alberto provided without requiring that (1-pi)/pi of the random points be discarded.
Jeff Wilkinson
Jeff Wilkinson
Medtronic Technical Fellow, Sr Principal R&D Engineer
Medtronic, Inc -- 8200 Coral Sea St NE -- Mounds View, MN 55112 USA
763-526-0483
Hi Sebastien,
Be careful, MYRHO begins with an M, it will be interpreted as
an integer. Call it RHOMY.
But I don't think that it is correct to sample a radius between 0 and RADIUS,
as you do. There are many more points at large radii than at small ones,
and your sampling fails to account for this.
You should sample the points in a square of edge 2.D0*RADIUS, and reject if
a point falls outside the circle:
123 CONTINUE
XXX = -RADIUS + FLRNDM(XDUMMY) * (TWOTWO*RADIUS)
YYY = -RADIUS + FLRNDM(YDUMMY) * (TWOTWO*RADIUS)
IF((XXX**2+YYY**2) .GT. RADIUS**2) GO TO 123
................................................
XFLK (NPFLKA) = XXX
YFLK (NPFLKA) = YYY
Alberto
On Fri, 30 Jan 2009, Sebastien WURTH wrote:
> Hello,
[CONFIDENTIALITY AND PRIVACY NOTICE]
Information transmitted by this email is proprietary to Medtronic and is intended for use only by the individual or entity to which it is addressed, and may contain information that is private, privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please delete this mail from your records.
To view this notice in other languages you can either select the following link or manually copy and paste the link into the address bar of a web browser: http://emaildisclaimer.medtronic.com
Received on Tue Feb 03 2009 - 21:16:44 CET
This archive was generated by hypermail 2.2.0 : Tue Feb 03 2009 - 21:16:44 CET