[Date Index]
[Thread Index]
[Author Index]
Re: random points!
*To*: mathgroup at smc.vnet.net
*Subject*: [mg80976] Re: [mg80892] random points!
*From*: "Ricardo Samad" <resamad at gmail.com>
*Date*: Thu, 6 Sep 2007 05:39:14 -0400 (EDT)
*References*: <200709050646.CAA26069@smc.vnet.net>
Dear Dimitris,
you can do the following:
define variables, with Rho being the radius of the circle to be filled:
npts = 300;
ptsize = 0.012
\[Rho] = 0.55;
generate a table with aleatory x coordinates for each point:
px = Table[RandomReal[{-\[Rho], \[Rho]}], {i, 1, npts}];
generate a point table with the y coordinate bounded by the circle conditio=
n
(Rho^2=x^2+y^2) for each point x coordinate, times a random value
randpoints =
Graphics[Table[{PointSize[ptsize],
Point[{px[[i]], Sqrt[\[Rho]^2 - px[[i]]^2] RandomReal[-1]}]}, {i,
1, npts}]];
you may have to tune the ptsize and Rho values to obtain a nice boundary.
Ricardo
On 9/5/07, dimitris <dimmechan at yahoo.com> wrote:
>
> Hello.
>
> I have the following drawing
> (it is just a part of a bigger figure...)
>
> In[125]:=
> surface = Graphics[{Thickness[0.0079], Line[{{-3.1, 0}, {3, 0}}]}];
> halfcir = Graphics[{Thickness[0.0079], Circle[{0, 0}, 0.6, {Pi,
> 2*Pi}]}];
> randpoints = Table[Graphics[{PointSize[0.012], Point[{Random[Real,
> {-0.42, 0.42}], Random[Real, {-0.01, -0.47}]}]}], {300}];
> Show[surface, halfcir, randpoints, AspectRatio -> Automatic];
>
> How can I add as much points as possible inside the half-circle
> (so that there are not so big white regions as in the previous
> drawing)
> assuring that they are not situated outside it?
>
> I think something has to be modified for randpoints above in order to
> be included
> a rule but currently I can't think sth.
>
> Thanks
> Dimitris
>
>
>
--
____________________________________
Ricardo Elgul Samad
tel: (+55 11) 3816-9314
fax: (+55 11) 3816-9315
Centro de Lasers e Aplica=E7=F5es
IPEN/CNEN-SP
AV. Prof. Lineu Prestes 2242
Cidade Universit=E1ria
05508-000
S=E3o Paulo - SP
Brazil
____________________________________
Prev by Date:
**Re: random points!**
Next by Date:
**Re: Kernel and frontend crash with ANY Graphics3D objects**
Previous by thread:
**random points!**
Next by thread:
**Re: random points!**
| |