Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #170984
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: random points near central point |
| Date | 2023-07-20 20:59 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87sf9ipd5e.fsf@bsb.me.uk> (permalink) |
| References | <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com> <87tttzr9h0.fsf@bsb.me.uk> <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com> <874jlyqsi1.fsf@bsb.me.uk> <2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com> |
fir <profesor.fir@gmail.com> writes: > czwartek, 20 lipca 2023 o 21:43:02 UTC+2 Ben Bacarisse napisał(a): >> fir <profes...@gmail.com> writes: >> >> > środa, 19 lipca 2023 o 21:24:09 UTC+2 Ben Bacarisse napisał(a): >> >> fir <profes...@gmail.com> writes: >> >> >> >> > i need tos et asteroids in game (about 100 or 200) but not in square >> >> > area with two rands one for x and second for y but need it to >> >> > be sphericel symetric around central point and in more densitu near it >> >> > and less desity with bigger radius until some radius when it is zero >> >> If you just pick a uniform angle and a uniform radius and plot those >> >> points, the density of points near the origin will be higher. This is a >> >> very simple method and might be suitable for a game. >> > >> > uniform radius? dont know what is that >> Uniform refers to a statistical distribution with uniform density -- >> every result in some range is equally likely. Your random number >> generator will have a function to give you a number uniformly >> distributed in some range (often >= 0.0 to < 1.0). I'll use drand48() >> as an example. >> >> double pi = 4 * atan(1); >> double r = drand48(); >> double a = 2 * pi * drand48(); >> >> Now if you plot the point at angle a and distance r from (0,0) you will >> see that they all lie in the unit circle but they cluster round the >> origin. >> >> Obviously you can convert polar coordinates r and a to Cartesian x and y >> with >> >> double x = r * cos(a), y = r * sin(a); >> >> I'm not sure if this is what you want, but it sounds like it from some >> of the words you used. > > no i just need to add rangom grou[p which is randomly spgerical amd > has more density near centre and which get downs to zero at some > radius R2 the centre of it (with some radius R) should have some flat > density ...iys not just much important what but flad I wish you well. If you want to ask in a group where English is widely used, can you find someone to review your posts? I have no idea what you are asking, but please don't spend any time explaining it -- I don't need to know. -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
random points near central point fir <profesor.fir@gmail.com> - 2023-07-18 23:38 -0700
Re: random points near central point Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-07-19 01:49 -0700
Re: random points near central point fir <profesor.fir@gmail.com> - 2023-07-19 04:20 -0700
Re: random points near central point Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-07-19 01:59 -0700
Re: random points near central point Kaz Kylheku <864-117-4973@kylheku.com> - 2023-07-19 16:50 +0000
Re: random points near central point Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-07-19 20:23 +0100
Re: random points near central point fir <profesor.fir@gmail.com> - 2023-07-20 09:31 -0700
Re: random points near central point Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-07-20 20:42 +0100
Re: random points near central point fir <profesor.fir@gmail.com> - 2023-07-20 12:56 -0700
Re: random points near central point Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-07-20 20:59 +0100
Re: random points near central point David Brown <david.brown@hesbynett.no> - 2023-07-21 09:13 +0200
Re: random points near central point fir <profesor.fir@gmail.com> - 2023-07-21 05:55 -0700
Re: random points near central point Ed Prochak <edprochak@gmail.com> - 2023-07-22 12:24 -0700
Re: random points near central point fir <profesor.fir@gmail.com> - 2023-07-23 04:04 -0700
Re: random points near central point Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-07-23 14:53 +0100
Re: random points near central point fir <profesor.fir@gmail.com> - 2023-07-23 07:03 -0700
Re: random points near central point "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-07-23 12:30 -0700
Re: random points near central point Ed Prochak <edprochak@gmail.com> - 2023-07-30 21:48 -0700
Re: random points near central point fir <profesor.fir@gmail.com> - 2023-07-20 13:20 -0700
Re: random points near central point "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-07-20 12:57 -0700
Re: random points near central point fir <profesor.fir@gmail.com> - 2023-07-20 13:18 -0700
Re: random points near central point "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-07-23 12:28 -0700
Re: random points near central point "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-07-20 12:56 -0700
csiph-web