POV-Ray : Newsgroups : povray.advanced-users : Mandelbrots, Rand, and maybe more... Server Time
4 Nov 2024 19:23:19 EST (-0500)
  Mandelbrots, Rand, and maybe more... (Message 1 to 5 of 5)  
From: Ken
Subject: Mandelbrots, Rand, and maybe more...
Date: 29 May 1999 01:29:30
Message: <374F6CCC.82E06A57@pacbell.net>
Mandelbrot:

  Why will the mandelbrot pigment pattern not tile as other patterns
will ? I could not find anything specific about it in the docs but
it seems to behave similar to the way the planar, spherical, and
box patterns behave i.e. in 1 unit square only non repeating patterns.


Rand:

  When a value is returned from the rand function is there a range
it is confined to i.e. 0 - 1,  .1 - 10, or ?

Is the value returned always a fraction of 1, or less than 100 or can be
anything up to and including 20 billion.



Array question(s):

#declare Dnum = 6;
#declare Data = array [Dnum][2]
{ {60, 50},
  {70,130},
  {60,170},
  {70,250},
  {60,310},
  {70,  5}}

#declare Unit = box { -1,1 }

#declare J=0; #while (J < 4)
#declare Unit =
    union {
      #declare I=0;
       #while (I < Dnum)
        object { Unit 
            rotate <Data[I][0],Data[I][1],0> 
etc.

object { Unit } = while loop constructed object


  In the above example the object Unit is declared before the loop is
started as a box object. Inside the loop another object is declared
also with the assigned designation of Unit. A later use of an object
called Unit is treated as the Unit derived from the while loop
construct and not the previously delcared box object of the same
designation.

  Why is Pov not running into a name collision when a scene is
constructed like this ?

  I was under the impression that the #local directive was designed
with this in mind but did not know that it was also extended to any
such similar use within a while loop.

  Are such naming conventions a possible ticket to later problems
or can one reliably count on the current behavior ?


Also in the above example there is an array of predetermined numbers.
I am assuming the script is using these sets of 6 numbers as x and y
vectors for the rotate command. How many numbers wide can an array
hold ?

Is the following a legal use of this function ?

#declare Dnum = 6;
#declare Data = array [Dnum][5]
{ {0.60, 0.50, 0.3, 0.1, 0.66},
  {0.70, 0.13, 0.4, 0.3, 0.55},
  {0.60, 0.17, 0.5, 0.2, 0.44},
  {0.70, 0.25, 0.6, 0.4, 0.33},
  {0.60, 0.31, 0.7, 0.6, 0.22},
  {0.70, 0.50, 0.8, 0.5, 0.11}}

 #declare I=0;
  #while (I < Dnum)
#declare Acid_Trip = 
 pigment {
  rgbft < Data[I][0], Data[I][1], Data[I][3], Data[I][4], Data[I][5] >
  }
etc.

If the above is valid it certainly opens up possibilities for some wild
and variable pigments. I could almost image feeding it my entire 677
predefined colors from my modified colors include file and then cycling
it through an animation or a similar number of pov generated objects.

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Darcy Johnston
Subject: Re: Mandelbrots, Rand, and maybe more...
Date: 29 May 1999 03:14:25
Message: <374f85c1.0@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote in message
news:374F6CCC.82E06A57@pacbell.net...
> Rand:
>
>   When a value is returned from the rand function is there a range
> it is confined to i.e. 0 - 1,  .1 - 10, or ?
>
> Is the value returned always a fraction of 1, or less than 100 or can be
> anything up to and including 20 billion.

According to the docs:
"The numbers are uniformly distributed, and have values between 0.0 and 1.0,
inclusively."

But I guess with a little massaging of the numbers, you can make it come out
to most any range.

Hope that helps,
Sorry I couldn't help (at least not immediately) with the others.
Darcy
djo### [at] inamecomNOSPAM
http://www.geocities.com/SiliconValley/Sector/4317


Post a reply to this message

From: Anders Haglund
Subject: RE: Mandelbrots, Rand, and maybe more...
Date: 29 May 1999 09:43:54
Message: <374fe10a.0@news.povray.org>
Darcy Johnston <djo### [at] inamecomNOSPAM> wrote:
> Ken <tyl### [at] pacbellnet> wrote in message
> news:374F6CCC.82E06A57@pacbell.net...
> > Rand:
> >
> >   When a value is returned from the rand function is there a range
> > it is confined to i.e. 0 - 1,  .1 - 10, or ?
> >
> > Is the value returned always a fraction of 1, or less than 100 or can be
> > anything up to and including 20 billion.
>
> According to the docs:
> "The numbers are uniformly distributed, and have values between 0.0 and
1.0,
> inclusively."
>
> But I guess with a little massaging of the numbers, you can make it come
out
> to most any range.

You could allways do a small macro, something like:

#macro rand2(rand_min,rand_max,rseed)
    rand_min + (rand_max - rand_min) * rand(rseed)
#end

...written from the top of my head but it should work just fine. I love
macros :)

/Anders


Post a reply to this message

From: Margus Ramst
Subject: Re: Mandelbrots, Rand, and maybe more...
Date: 29 May 1999 13:11:09
Message: <3750119d.0@news.povray.org>
Ken wrote in message <374F6CCC.82E06A57@pacbell.net>...
>
>
>Mandelbrot:
>

Well, I'm not sure, but here's a guess: it's basically a subdivision
fractal, i.e. its dimendions approach a certain limit. It does not stretch
into ifinity - much like the spherical pattern. It should be possible to
make Mandelbrots tiling into infinity - but in the source code, not in a
script.

>
>
>Rand:
>


Rand has a mean of 0.5 and a maximum deviation of 0.5 so it can be from 0 to
1.  Here are a few rand() macros you might find useful (I'll probably post
my entire macro collection sometime soon)

//return 1 with the likelyhood of P (from 0 to 1)
//otherwise return 0
#macro Chance(P,Seed)
    #local R=abs(rand(Seed)-.5)*2;
    (#if(R>=(1-P)) 1 #else 0 #end)
#end

//Create random number of given mean and maximum deviation
//M - mean value
//D - maximum deviation
//Seed - (declared) random number seed identifier
#macro rand_ext(M,D,Seed)
        (M+(rand(Seed)-.5)*2*D)
#end

//Give a random vector of given mean and max deviation
//M - mean (vector/float)
//D - max deviation (vector/float)
//Seed - (declared) random number seed identifier
#macro v_rand_ext(M,D,Seed)
        #local MV=M+<0,0,0>;
        #local DV=D+<0,0,0>;
        (<rand_ext(MV.x,DV.x,Seed),
           rand_ext(MV.y,DV.y,Seed),
           rand_ext(MV.z,DV.z,Seed)>)
#end

>
>Array question(s):
>

The "Unit problem"... Is that indenting I see?! Well, another speculation.
The Unit object is not assigned the new construct until the script breaks
out of the loop; until then the old Unit is referenced.
Anyway, if it works, why worry?
And AFAIK, #local is meant for macros and include files. I don't think it
separates nested conditional levels.

As for your array example, all seems correct. I'm not sure how large an
array dimension can be, but I've gone pretty high. Perhaps it's only limited
by available memory. The number of dimensions is limited to 5, though. And
5-dimensional arrays become very large very quickly (remember, all array
elemenst become initialized once you declare one element).

Margus


Post a reply to this message

From: Peter Popov
Subject: Re: Mandelbrots, Rand, and maybe more...
Date: 29 May 1999 17:35:47
Message: <37504c5b.37466425@news.povray.org>
On Fri, 28 May 1999 21:27:56 -0700, Ken <tyl### [at] pacbellnet> wrote:

>
>
>Mandelbrot:
>
>  Why will the mandelbrot pigment pattern not tile as other patterns
>will ? I could not find anything specific about it in the docs but
>it seems to behave similar to the way the planar, spherical, and
>box patterns behave i.e. in 1 unit square only non repeating patterns.

The M-set is calculated in the following way:

1. Take a point (X,Y).
2. Let a complex number C=(X, i*Y) where i is the imaginary unit
sqrt(-1).
3. Have another complex number Z=(0,i*0).
4. Perform the iteration Z=Z*Z+C .
5. Repeat 4. until a) Z*Z>=4 or b) you reach the maximum number of
iterations specified.

The color assigned to point (X,Y) is the number of iterations needed
so that Z*Z goes above 4 (it is assumed that in this case Z will
approach infinity very quickly). Therefore, any point lying at a
distance of more than 2 from the origin will lead to bailout on the
second iteration. That's why the Mandelbrot pattern is confined within
a circle of radius 2 centered at the origin, so it will not tile.

You can use a repeat warp, though.

---------
Peter Popov
ICQ: 15002700


Post a reply to this message

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