POV-Ray : Newsgroups : povray.general : Array... Server Time
20 Nov 2024 08:42:24 EST (-0500)
  Array... (Message 1 to 10 of 19)  
Goto Latest 10 Messages Next 9 Messages >>>
From: F Audet
Subject: Array...
Date: 14 Oct 2001 11:34:57
Message: <3BC9AFCA.9B469579@sympatico.ca>
Does anyone could give me
some "basic" principles about Array !

I draw a 3d zero and a 3d one,  which objects
can be choosen randomly from a macro....
The macro is done and works well.
Each time I need a number,  the macro
randomly return a zero or a one.
I only need to put this "binary_01 ( )" macro
inside an array,  say,  20*20.

   Alex Pilote

...I know I could use a loop....


Post a reply to this message

From: Warp
Subject: Re: Array...
Date: 14 Oct 2001 11:51:32
Message: <3bc9b483@news.povray.org>
F.Audet <flo### [at] sympaticoca> wrote:
: ...I know I could use a loop....

  So why don't you do it?

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


Post a reply to this message

From: JRG
Subject: Re: Array...
Date: 14 Oct 2001 17:05:05
Message: <3bc9fe01@news.povray.org>
I think he meant: "...I know I should use a loop..."
"Warp" <war### [at] tagpovrayorg> ha scritto nel messaggio
news:3bc9b483@news.povray.org...
> F.Audet <flo### [at] sympaticoca> wrote:
> : ...I know I could use a loop....
>
>   So why don't you do it?
>
> --
> #macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
> rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
> ],13),8)-3,10>#end blob{N(array[6]{11117333955,
> 7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: JRG
Subject: Re: Array...
Date: 14 Oct 2001 17:07:16
Message: <3bc9fe84$1@news.povray.org>
"F.Audet" <flo### [at] sympaticoca> ha scritto nel messaggio
news:3BC9AFCA.9B469579@sympatico.ca...
>     Does anyone could give me
> some "basic" principles about Array !
>
> I draw a 3d zero and a 3d one,  which objects
> can be choosen randomly from a macro....
> The macro is done and works well.
> Each time I need a number,  the macro
> randomly return a zero or a one.
> I only need to put this "binary_01 ( )" macro
> inside an array,  say,  20*20.
>
>    Alex Pilote
>
> ...I know I could use a loop....

In fact:

#declare YOUR_ARRAY = array[20][20]
#declare i = 0;
#while (i<20)
#declare j=0;
#while (j<20)
#declare YOUR_ARRAY[i][j]= binary_01();
#declare j=j+1;
#end
#declare i=i+1;
#end

Done.


Post a reply to this message

From: F Audet
Subject: Re: Array...
Date: 14 Oct 2001 20:38:36
Message: <3BCA2F34.20A7BB2E@sympatico.ca>


> "F.Audet" <flo### [at] sympaticoca> ha scritto nel messaggio
> news:3BC9AFCA.9B469579@sympatico.ca...
> >     Does anyone could give me
> > some "basic" principles about Array !
> >
> > I draw a 3d zero and a 3d one,  which objects
> > can be choosen randomly from a macro....
> > The macro is done and works well.
> > Each time I need a number,  the macro
> > randomly return a zero or a one.
> > I only need to put this "binary_01 ( )" macro
> > inside an array,  say,  20*20.
> >
> >    Alex Pilote
> >
> > ...I know I could use a loop....
>
> In fact:
>
> #declare YOUR_ARRAY = array[20][20]
> #declare i = 0;
> #while (i<20)
> #declare j=0;
> #while (j<20)
> #declare YOUR_ARRAY[i][j]= binary_01();
> #declare j=j+1;
> #end
> #declare i=i+1;
> #end
>
> Done.

I don't know why,  but this code doesn't work
with the object which I have to reproduce....
I have also tried this code with a simple sphere;
it doesn' t work anymore.

So,  is there another way of using Array
without using the while directive ?!?

Thank you,            Alex


Post a reply to this message

From: Ron Parker
Subject: Re: Array...
Date: 14 Oct 2001 20:39:53
Message: <slrn9skc2p.ip.ron.parker@fwi.com>
On Sun, 14 Oct 2001 20:35:01 -0400, F.Audet wrote:
>I don't know why,  but this code doesn't work
>with the object which I have to reproduce....
>I have also tried this code with a simple sphere;
>it doesn' t work anymore.
>
>So,  is there another way of using Array
>without using the while directive ?!?

Is the problem perhaps that you're trying to do it with beta 5 of POV 3.5?
There was a problem with #while loops that caused crashes; it's been fixed
in beta 6.

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission 3-T}}}#end 
Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}


Post a reply to this message

From: F Audet
Subject: Re: Array...
Date: 14 Oct 2001 21:42:57
Message: <3BCA3E4A.9BBC741E@sympatico.ca>


> On Sun, 14 Oct 2001 20:35:01 -0400, F.Audet wrote:
> >I don't know why,  but this code doesn't work
> >with the object which I have to reproduce....
> >I have also tried this code with a simple sphere;
> >it doesn' t work anymore.
> >
> >So,  is there another way of using Array
> >without using the while directive ?!?
>
> Is the problem perhaps that you're trying to do it with beta 5 of POV 3.5?
> There was a problem with #while loops that caused crashes; it's been fixed
> in beta 6.

No,  I am still working with the 3.1 version because my computer does
not accept 800*600 screen minimum requirement...  I plan to solve
this problem soon,  with a more recent computer...

I decided to do what I wanted to do in simulating an array
with two #while loops, and it finally worked.
But if you could see why the famous array
did not work,  here is the code :

#declare s1 = seed(1);
#macro bin_01 ()  // note that it works well with a simple while, without array....
  #local obj_temp =
  #if ( rand(s1) <= 0.5 )
    object { nice_zero }
  #else
    object { nice_one }
  #end
  object { obj_temp }
#end

#declare YOUR_ARRAY = array[20][20]
#declare i = 0;
#while (i<20)
#declare j=0;
#while (j<20)
#declare YOUR_ARRAY[i][j] = bin_01()
#declare j=j+1;
#end
#declare i=i+1;
#end

> Alex Pilot
>
> --
> #macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
> -z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
> P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission 3-T}}}#end
> Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}


Post a reply to this message

From: Ron Parker
Subject: Re: Array...
Date: 14 Oct 2001 22:05:59
Message: <slrn9skh47.kt.ron.parker@fwi.com>
On Sun, 14 Oct 2001 21:39:23 -0400, F.Audet wrote:
>I decided to do what I wanted to do in simulating an array
>with two #while loops, and it finally worked.
>But if you could see why the famous array
>did not work,  here is the code :

Maybe something having to do with returning a local from a macro; this might
have been a bug in 3.1 as well.  Try rewriting the macro like this:

>
>#declare s1 = seed(1);
>#macro bin_01 ()  // note that it works well with a simple while, without array....
>  #if ( rand(s1) <= 0.5 )
>    object { nice_zero }
>  #else
>    object { nice_one }
>  #end
>#end

-- 
#macro R(P)z+_(P)_(P)_(P+1)_(P+1)+z#end#macro Q(C)bicubic_patch{type 1u_steps 6
v_steps 6R(1)R(3)R(5)R(7)translate 9*z-2pigment{rgb z}}#end#macro _(Y)#local X=
asc(substr(C,Y,1))-65;<mod(X,4)div(X,4)>#end#local O=union{Q("ABEFUQWS")Q(// RON
"WSXTLOJN")}Q("JNKLCGCD")union{O}union{O translate 3*x}light_source{x 1}//PARKER


Post a reply to this message

From: F Audet
Subject: Re: Array...
Date: 15 Oct 2001 11:07:56
Message: <3BCAFAF3.B8207208@sympatico.ca>


> On Sun, 14 Oct 2001 21:39:23 -0400, F.Audet wrote:
> >I decided to do what I wanted to do in simulating an array
> >with two #while loops, and it finally worked.
> >But if you could see why the famous array
> >did not work,  here is the code :
>
> Maybe something having to do with returning a local from a macro; this might
> have been a bug in 3.1 as well.  Try rewriting the macro like this:
>
> >
> >#declare s1 = seed(1);
> >#macro bin_01 ()
> >  #if ( rand(s1) <= 0.5 )
> >    object { nice_zero }
> >  #else
> >    object { nice_one }
> >  #end
> >#end
>

... It does parse and trace,  but nothing appears on the screen.
Messages: 1 frame level object; 1 infinite.   // my plane object !
... I think it is my fault,  cause I just tried,  a minute ago,  with
a simple csg object,  without any kind of randomness and #local,
and it doesn' t work anymore !

in fact,  the following code doesn' t work at all...
#declare YOUR_ARRAY = array[20][20]
#declare i = 0;
#while (i<20)
#declare j=0;
#while (j<20)
#declare YOUR_ARRAY[i][j] = sphere { 0, 1 pigment { White }}
#declare j=j+1;
#end
#declare i=i+1;
#end

Have I to put it into "object {YOUR_ARRAY}", or something like that ?!?

Alex Pilot

>
> --
> #macro R(P)z+_(P)_(P)_(P+1)_(P+1)+z#end#macro Q(C)bicubic_patch{type 1u_steps 6
> v_steps 6R(1)R(3)R(5)R(7)translate 9*z-2pigment{rgb z}}#end#macro _(Y)#local X=
> asc(substr(C,Y,1))-65;<mod(X,4)div(X,4)>#end#local O=union{Q("ABEFUQWS")Q(// RON
> "WSXTLOJN")}Q("JNKLCGCD")union{O}union{O translate 3*x}light_source{x 1}//PARKER


Post a reply to this message

From: Chaps
Subject: Re: Array...
Date: 15 Oct 2001 11:28:49
Message: <3bcb00b1@news.povray.org>
I didn't try it, but it seems to me that if you are using somewhere in the
code:

#declare toto = sphere{0*x,r}

there is not any object in the scene until  you write

object { toto }

It should be the same with your code.

Chaps

"F.Audet" <flo### [at] sympaticoca> wrote in message
news:3BCAFAF3.B8207208@sympatico.ca...
>
>

>
> > On Sun, 14 Oct 2001 21:39:23 -0400, F.Audet wrote:
> > >I decided to do what I wanted to do in simulating an array
> > >with two #while loops, and it finally worked.
> > >But if you could see why the famous array
> > >did not work,  here is the code :
> >
> > Maybe something having to do with returning a local from a macro; this
might
> > have been a bug in 3.1 as well.  Try rewriting the macro like this:
> >
> > >
> > >#declare s1 = seed(1);
> > >#macro bin_01 ()
> > >  #if ( rand(s1) <= 0.5 )
> > >    object { nice_zero }
> > >  #else
> > >    object { nice_one }
> > >  #end
> > >#end
> >
>
> ... It does parse and trace,  but nothing appears on the screen.
> Messages: 1 frame level object; 1 infinite.   // my plane object !
> ... I think it is my fault,  cause I just tried,  a minute ago,  with
> a simple csg object,  without any kind of randomness and #local,
> and it doesn' t work anymore !
>
> in fact,  the following code doesn' t work at all...
> #declare YOUR_ARRAY = array[20][20]
> #declare i = 0;
> #while (i<20)
> #declare j=0;
> #while (j<20)
> #declare YOUR_ARRAY[i][j] = sphere { 0, 1 pigment { White }}
> #declare j=j+1;
> #end
> #declare i=i+1;
> #end
>
> Have I to put it into "object {YOUR_ARRAY}", or something like that ?!?
>
> Alex Pilot
>
> >
> > --
> > #macro R(P)z+_(P)_(P)_(P+1)_(P+1)+z#end#macro Q(C)bicubic_patch{type
1u_steps 6
> > v_steps 6R(1)R(3)R(5)R(7)translate 9*z-2pigment{rgb z}}#end#macro
_(Y)#local X=
> > asc(substr(C,Y,1))-65;<mod(X,4)div(X,4)>#end#local
O=union{Q("ABEFUQWS")Q(// RON
> > "WSXTLOJN")}Q("JNKLCGCD")union{O}union{O translate 3*x}light_source{x
1}//PARKER
>


Post a reply to this message

Goto Latest 10 Messages Next 9 Messages >>>

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