Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #170929

Re: random points near central point

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: random points near central point
Date 2023-07-19 20:23 +0100
Organization A noiseless patient Spider
Message-ID <87tttzr9h0.fsf@bsb.me.uk> (permalink)
References <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>

Show all headers | View raw


fir <profesor.fir@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.

> something like 
>
> SetRandomPointSphericalSymetricAndFadingWithDistance(
> float x, float y, float r1, float r2);

This suggests that I've not understood your opening paragraph, but I
offer the solution in case someone else might be interested.

> this r1 is radius of circle below which density is max and r2 is radius 
> where above density is zero - in beetweem r1 and r2 density should 
> be from max (at r1) to zero at r2
>
> how to do that?

-- 
Ben.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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-08-03 10:00 -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
  Re: random points near central point Bonita Montero <Bonita.Montero@gmail.com> - 2023-08-03 19:17 +0200
    Re: random points near central point fir <profesor.fir@gmail.com> - 2023-08-03 10:55 -0700
      Re: random points near central point fir <profesor.fir@gmail.com> - 2023-08-03 11:04 -0700
      Re: random points near central point Bonita Montero <Bonita.Montero@gmail.com> - 2023-08-04 17:22 +0200
        Re: random points near central point fir <profesor.fir@gmail.com> - 2023-08-04 10:06 -0700
  Re: random points near central point John Forkosh <forkosh@panix.com> - 2023-08-05 10:57 +0000
    Re: random points near central point fir <profesor.fir@gmail.com> - 2023-08-05 05:41 -0700
      Re: random points near central point John Forkosh <forkosh@panix.com> - 2023-08-07 13:11 +0000
        Re: random points near central point fir <profesor.fir@gmail.com> - 2023-08-07 06:26 -0700
          Re: random points near central point fir <profesor.fir@gmail.com> - 2023-08-07 06:33 -0700
  Re: random points near central point "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-08-06 11:57 -0700

csiph-web