POV-Ray : Newsgroups : povray.general : Asteroid Belt : Re: Asteroid Belt Server Time
31 Jul 2024 08:26:15 EDT (-0400)
  Re: Asteroid Belt  
From: Tim Attwood
Date: 9 Jul 2007 21:23:12
Message: <4692df80$1@news.povray.org>
>> 1) is there a way to adjust the while loop so that it generates the 
>> spheres
>> inside the boundries of the cone?

> I'd use the following steps:
> 1 - randomly chose a point along the axis of your cone
> 2 - randomly chose a radius, adjust that acording to your location along 
> the axis
> 3 - randomly chose an angle from 0 to 360 and rotate your location around 
> the axis
> 4 - place one asteroid at that location, and check that it don't intersect 
> another one. Use an array to store the locations.
> 5 - every 50 to 100 elements, place a dummy asteroids that have been 
> prescaled to twice or trice the dimention of the asteroid, make them part 
> of an union.
> 6 - on subsequant iterations, check if you are "inside" that union to 
> prevent part of the possible intersections.
>
> If your placement is sparce, there will be very few intersecting asteroids 
> and the placement process will be fast.

There is a macro for this in rand.inc
VRand_In_Obj(Object, Stream)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.