POV-Ray : Newsgroups : povray.general : Star night sky : Re: Star night sky Server Time
9 Aug 2024 09:07:55 EDT (-0400)
  Re: Star night sky  
From: Geoff Wedig
Date: 29 Sep 2000 08:46:04
Message: <39d48f0c@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   If I don't take only the points inside the sphere I would create more
> points in the "corners" than other places. It would mean that there are
> more stars in the direction of the eight corners of the cube.

So, instead of generating 3 numbers, generate 2, latitude and longitude. 
Ie:

#declare c1 = 180 * rand(s1) - 90;
#declare c2 = 360 * rand(s1);

translate <0,0,1000> // Assuming object originally at origin.

rotate <0, c2, c1>   // This means y is up direction, but it is really
                     // irrelevant which rotation is first and which
                     // of the axes as used as long as the first axis is
                     // not the direction of translation.

You might want to translate a randomly chosen distance, and/or size the
object as well, but that's pretty easy.

This code seems a *lot* shorter (and therefore faster) than the other code
I've seen.  And you only need one loop and no checks for being within a
certain space.

Geoff


Post a reply to this message

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