|
![](/i/fill.gif) |
OpalPlanet nous apporta ses lumieres en ce 2007/07/09 16:29:
> Hi all -
> I'm working on a solar system image right now, and im having trouble with
> the asteroid belt. I've tried a media - filled cone, and a while loop to
> place random spheriods. (see code below)
>
> So really, I have 3 questions -
>
> 1) is there a way to adjust the while loop so that it generates the spheres
> inside the boundries of the cone?
>
> 2) i know Tek used an asteroid belt pigment in one of his IRTC entries. Does
> anyone have the source code for this pigment or something similar that I
> could use?
>
> 3) Anyone have any other ideas for this project?
>
> Thanks,
> OpalPlanet
>
>
>
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.
--
Alain
-------------------------------------------------
Bend the facts to fit the conclusion. It's easier that way.
Post a reply to this message
|
![](/i/fill.gif) |