POV-Ray : Newsgroups : povray.newusers : Uniform placing sphere Server Time
31 Jul 2024 02:31:00 EDT (-0400)
  Uniform placing sphere (Message 1 to 5 of 5)  
From: Rafal 'Raf256' Maj
Subject: Uniform placing sphere
Date: 20 Apr 2003 06:09:31
Message: <Xns93637BB522E1Fraf256com@204.213.191.226>
Hello,
how can I distribute some points randomly on sphere, but that they would be +/- in
same range from 
each oter (uniformly) ?

    #local R1=seed(3433452);
    #local I=0; #while (I<500)
      #local B = vrotate(<0,30,0>, <rand(R1)*360,0,rand(R1)*360>);
    #local I=I+1; #end

this method is wrong, because poins are close togeather at top and bottom of sphere
and there are few 
in middle


-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: ingo
Subject: Re: Uniform placing sphere
Date: 20 Apr 2003 06:22:07
Message: <Xns93637E457F33Eseed7@povray.org>
in news:Xns### [at] 204213191226 Rafal 'Raf256' Maj 
wrote:

> how can I distribute some points randomly on sphere,

"7.12.1  Generation macros (flat distribution)"
-  vrand_on_sphere

Ingo


Post a reply to this message

From: Micha Riser
Subject: Re: Uniform placing sphere
Date: 20 Apr 2003 13:26:31
Message: <3ea2d847@news.povray.org>
Rafal 'Raf256' Maj wrote:

> how can I distribute some points randomly on sphere, but that they would
> be +/- in same range from each oter (uniformly) ?
> 

make random points in the cube <-1,-1,-1>,<1,1,1> and if their 
distance from origin is <1 project them on the sphere otherwise throw them 
away


-- 
POV-Ray Objects Collection: http://objects.povworld.org


Post a reply to this message

From: Warp
Subject: Re: Uniform placing sphere
Date: 20 Apr 2003 13:46:16
Message: <3ea2dce8@news.povray.org>
Micha Riser <mri### [at] gmxnet> wrote:
> make random points in the cube <-1,-1,-1>,<1,1,1> and if their 
> distance from origin is <1 project them on the sphere otherwise throw them 
> away

  He asked points *on* a sphere, not *in* a sphere... :)

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Micha Riser
Subject: Re: Uniform placing sphere
Date: 20 Apr 2003 14:01:59
Message: <3ea2e097@news.povray.org>
Warp wrote:

> Micha Riser <mri### [at] gmxnet> wrote:
>> make random points in the cube <-1,-1,-1>,<1,1,1> and if their
>> distance from origin is <1 project them on the sphere otherwise throw
>> them away
> 
>   He asked points *on* a sphere, not *in* a sphere... :)
> 

... and that's exactly why I said "project them on the sphere" :)


-- 
POV-Ray Objects Collection: http://objects.povworld.org


Post a reply to this message

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