POV-Ray : Newsgroups : povray.general : Help with a spherical container Server Time
4 Nov 2024 19:18:32 EST (-0500)
  Help with a spherical container (Message 1 to 10 of 29)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Wesley Parker
Subject: Help with a spherical container
Date: 4 Nov 2003 19:38:38
Message: <3fa8468e@news.povray.org>
Hey, i had an idea for something pretty interesting but I am having problems
implementing it.  What i did was create a sphere with object media at the
origin with a radius of five. That part was easy enough, but placing the
lights is troubling me. I need the placement to be random, but at the same
time the lights need to be on the inside of the sphere. If they go outside,
they light the sphere itself and that destroys the scene. So can anyone help
me?

Thanks in advance.


Post a reply to this message

From: Warp
Subject: Re: Help with a spherical container
Date: 4 Nov 2003 20:22:08
Message: <3fa850c0@news.povray.org>
Wesley Parker <wes### [at] verizonnet> wrote:
> Hey, i had an idea for something pretty interesting but I am having problems
> implementing it.  What i did was create a sphere with object media at the
> origin with a radius of five. That part was easy enough, but placing the
> lights is troubling me. I need the placement to be random, but at the same
> time the lights need to be on the inside of the sphere.

#declare Seed = seed(0);

#declare LightLocation = 10*<rand(Seed), rand(Seed), rand(Seed)>-5;
#while(vlength(LightLocation) > 5)
  #declare LightLocation = 10*<rand(Seed), rand(Seed), rand(Seed)>-5;
#end

  After the loop ends you will have a random point inside the sphere
of radius 5 in 'LightLocation'.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Wesley Parker
Subject: Re: Help with a spherical container
Date: 4 Nov 2003 20:33:38
Message: <3fa85372$1@news.povray.org>
Ok, cool. It works great now. Can you explain how that works?

"Warp" <war### [at] tagpovrayorg> wrote in message
news:3fa850c0@news.povray.org...
> Wesley Parker <wes### [at] verizonnet> wrote:
> > Hey, i had an idea for something pretty interesting but I am having
problems
> > implementing it.  What i did was create a sphere with object media at
the
> > origin with a radius of five. That part was easy enough, but placing the
> > lights is troubling me. I need the placement to be random, but at the
same
> > time the lights need to be on the inside of the sphere.
>
> #declare Seed = seed(0);
>
> #declare LightLocation = 10*<rand(Seed), rand(Seed), rand(Seed)>-5;
> #while(vlength(LightLocation) > 5)
>   #declare LightLocation = 10*<rand(Seed), rand(Seed), rand(Seed)>-5;
> #end
>
>   After the loop ends you will have a random point inside the sphere
> of radius 5 in 'LightLocation'.
>
> -- 
> #macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb
M()}}
> N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
> N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  -
Warp -


Post a reply to this message

From: Christopher James Huff
Subject: Re: Help with a spherical container
Date: 4 Nov 2003 20:40:55
Message: <cjameshuff-618341.20403704112003@netplex.aussie.org>
In article <3fa850c0@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

> #declare LightLocation = 10*<rand(Seed), rand(Seed), rand(Seed)>-5;
> #while(vlength(LightLocation) > 5)
>   #declare LightLocation = 10*<rand(Seed), rand(Seed), rand(Seed)>-5;
> #end

Or you could just use VRand_In_Sphere() in rand.inc.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: Help with a spherical container
Date: 4 Nov 2003 20:44:08
Message: <cjameshuff-E27010.20435004112003@netplex.aussie.org>
In article <3fa85372$1@news.povray.org>,
 "Wesley Parker" <wes### [at] verizonnet> wrote:

> Ok, cool. It works great now. Can you explain how that works?

Find a random point in a 10x10x10 box. If the point is outside the 
radius-5 sphere, find another random point in the box. Repeat until you 
have a random point in the sphere.

The method the include file uses is a bit more complex, but is overall a 
bit faster...the loop method can require several attempts before it 
turns up a useable point.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Warp
Subject: Re: Help with a spherical container
Date: 4 Nov 2003 20:48:55
Message: <3fa85707@news.povray.org>
Christopher James Huff <cja### [at] earthlinknet> wrote:
> The method the include file uses is a bit more complex, but is overall a 
> bit faster...the loop method can require several attempts before it 
> turns up a useable point.

  This is true, but relevant only if you are going to place hundreds or
thousands of points inside the sphere... :)

  Honestly, I didn't remember the macro in the standard include file.
If I had, I would have suggested it.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Wesley Parker
Subject: Re: Help with a spherical container
Date: 4 Nov 2003 21:06:42
Message: <3fa85b32$1@news.povray.org>
this is kinda funny, i changed the amount of lights im going to use from 25
to 250 (and increased the radius to 500) and its been parsing for the last
15 minutes o.O

im just going to go ahead and stop it now and try the function in the
standard include.
"Warp" <war### [at] tagpovrayorg> wrote in message
news:3fa850c0@news.povray.org...
> Wesley Parker <wes### [at] verizonnet> wrote:
> > Hey, i had an idea for something pretty interesting but I am having
problems
> > implementing it.  What i did was create a sphere with object media at
the
> > origin with a radius of five. That part was easy enough, but placing the
> > lights is troubling me. I need the placement to be random, but at the
same
> > time the lights need to be on the inside of the sphere.
>
> #declare Seed = seed(0);
>
> #declare LightLocation = 10*<rand(Seed), rand(Seed), rand(Seed)>-5;
> #while(vlength(LightLocation) > 5)
>   #declare LightLocation = 10*<rand(Seed), rand(Seed), rand(Seed)>-5;
> #end
>
>   After the loop ends you will have a random point inside the sphere
> of radius 5 in 'LightLocation'.
>
> -- 
> #macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb
M()}}
> N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
> N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  -
Warp -


Post a reply to this message

From: Wesley Parker
Subject: Re: Help with a spherical container
Date: 4 Nov 2003 21:11:20
Message: <3fa85c48$1@news.povray.org>
nah, i cant resist the urge to see how long it takes.

20 minutes and counting...

"Wesley Parker" <wes### [at] verizonnet> wrote in message
news:3fa85b32$1@news.povray.org...
> this is kinda funny, i changed the amount of lights im going to use from
25
> to 250 (and increased the radius to 500) and its been parsing for the last
> 15 minutes o.O
>
> im just going to go ahead and stop it now and try the function in the
> standard include.
> "Warp" <war### [at] tagpovrayorg> wrote in message
> news:3fa850c0@news.povray.org...
> > Wesley Parker <wes### [at] verizonnet> wrote:
> > > Hey, i had an idea for something pretty interesting but I am having
> problems
> > > implementing it.  What i did was create a sphere with object media at
> the
> > > origin with a radius of five. That part was easy enough, but placing
the
> > > lights is troubling me. I need the placement to be random, but at the
> same
> > > time the lights need to be on the inside of the sphere.
> >
> > #declare Seed = seed(0);
> >
> > #declare LightLocation = 10*<rand(Seed), rand(Seed), rand(Seed)>-5;
> > #while(vlength(LightLocation) > 5)
> >   #declare LightLocation = 10*<rand(Seed), rand(Seed), rand(Seed)>-5;
> > #end
> >
> >   After the loop ends you will have a random point inside the sphere
> > of radius 5 in 'LightLocation'.
> >
> > -- 
> > #macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb
> M()}}
> > N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
> > N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  -
> Warp -
>
>


Post a reply to this message

From: Christopher James Huff
Subject: Re: Help with a spherical container
Date: 4 Nov 2003 21:41:41
Message: <cjameshuff-B78040.21412304112003@netplex.aussie.org>
In article <3fa85b32$1@news.povray.org>,
 "Wesley Parker" <wes### [at] verizonnet> wrote:

> this is kinda funny, i changed the amount of lights im going to use from 25
> to 250 (and increased the radius to 500) and its been parsing for the last
> 15 minutes o.O

It shouldn't take *that* long to parse, it may actually be done parsing 
and busy working on light buffers. If it takes too long or runs out of 
memory, try turning off light buffers. Or maybe you made a mistake in 
modifying the code...it will take a very long time to find random points 
in a 5-unit sphere when you use random points from a 1000-unit box.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Kurts
Subject: Re: Help with a spherical container
Date: 5 Nov 2003 01:09:18
Message: <kurtzlepirate-B9FAE6.07091605112003@netplex.aussie.org>
In article <3fa8468e@news.povray.org>, "Wesley Parker" <wes### [at] verizonnet> 
wrote:

> Hey, i had an idea for something pretty interesting but I am having problems
> implementing it.  What i did was create a sphere with object media at the
> origin with a radius of five. That part was easy enough, but placing the
> lights is troubling me. I need the placement to be random, but at the same
> time the lights need to be on the inside of the sphere. If they go outside,
> they light the sphere itself and that destroys the scene. So can anyone help
> me?
> 
> Thanks in advance.
> 
> 
hi,

you can about that :

take a rayon
take a random number from 0 to 360
take an other random number from +90 to -90
then just convert polar coordonates from this 3 number to rectangular <x,y,z>

pretty simply


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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