POV-Ray : Newsgroups : povray.general : Array... Server Time
15 Oct 2026 12:37:17 EDT (-0400)
  Array... (Message 1 to 19 of 19)  
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>
JRG a écrit :

> "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>
Ron Parker a écrit :

> 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>
Ron Parker a écrit :

> 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...
>
>
> Ron Parker a écrit :
>
> > 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: F Audet
Subject: Re: Array...
Date: 15 Oct 2001 11:46:05
Message: <3BCB03E4.6337B066@sympatico.ca>
I should have missed something, somewhere...

Is there a tutorial about arrays,  on the web ?

Thank you,               Alex


Post a reply to this message

From: JRG
Subject: Re: Array...
Date: 15 Oct 2001 14:15:46
Message: <3bcb27d2@news.povray.org>
Hi F.Audet, wasn't you who wrote:
>
>
> Ron Parker a écrit :
>
> > 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

I think you misunderstood what an array is. Just having 400 objects put in
an array does not mean that you get them traced!
If you want to put your 400 objects in a 20x20 units grid you have to add
the following code:

 #declare i = 0;
 #while (i<20)
#declare j=0;
#while (j<20)
object {YOUR_ARRAY[i][j] translate <-10 +i, 0 , -10+j>}
#declare j=j+1;
#end
#declare i=i+1;
#end

But probably it's me who has misunderstood you...

--
Jonathan.


Post a reply to this message

From: Warp
Subject: Re: Array...
Date: 15 Oct 2001 15:01:47
Message: <3bcb329a@news.povray.org>
JRG <jrg### [at] hotmailcom> wrote:
: I think you misunderstood what an array is.

  It is possible that someone who has no experience in programming may have
no notion what an "array" is in a programming language. The term "array"
has also another meaning in a different context and this may be the cause
of the confusion.

-- 
#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: F Audet
Subject: Re: Array...
Date: 15 Oct 2001 15:22:37
Message: <3BCB36A5.FD815ADF@sympatico.ca>
Warp a écrit :

> JRG <jrg### [at] hotmailcom> wrote:
> : I think you misunderstood what an array is.
>
>   It is possible that someone who has no experience in programming may have
> no notion what an "array" is in a programming language. The term "array"
> has also another meaning in a different context and this may be the cause
> of the confusion.

 I thought the array function allowed to reproduce an object
into a grid system... I didn' t think about it in term of programming anymore.
Excuse me,  I misunderstood the reel functionality of an array.

Alex

>
>
> --
> #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: 15 Oct 2001 15:26:10
Message: <3bcb3852@news.povray.org>
Then you just need this one:

#declare i = 0;
#while (i<20)
#declare j=0;
#while (j<20)
object {binary_01() translate <-10 +i, 0 , -10+j>}
#declare j=j+1;
#end
#declare i=i+1;
#end

Hope this helps,

--
Jonathan.


Post a reply to this message

From: F Audet
Subject: Re:that's ok
Date: 15 Oct 2001 20:24:44
Message: <3BCB7D73.EEE5DB3C@sympatico.ca>
JRG a écrit :

> Then you just need this one:
>
> #declare i = 0;
> #while (i<20)
> #declare j=0;
> #while (j<20)
> object {binary_01() translate <-10 +i, 0 , -10+j>}
> #declare j=j+1;
> #end
> #declare i=i+1;
> #end
>
> Hope this helps,
>
> --
> Jonathan.

Yes,  I did it that way and
I think everything is OK by now...   Have a look at Binaries-images
to see what were the purpose of my requests.
......................."Virus_inc"............"F.Audet"...............................

Thank you very much for your responses,

                                                                   Alex


Post a reply to this message

From: KalleK
Subject: Re: Array...
Date: 17 Oct 2001 14:38:42
Message: <3bcdd032@news.povray.org>
> 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...

Do you mean, Povray 3.5 (beta) doesn't run with 640*480 screen
resolution? (3.1g did some warning - is not designed to run under
800*600 - but it run) I'm a bit afraid about that message, I'm going
to use Povray 3.5 (when it's out) on a 640*480 screen.
Can someone tell me if that's true (or better: not true) - I tried
with beta 4, it worked (you could not press the ok-button of the
povlegal-screen - but it worked)
Or did I misunderstand you?

cukk


Post a reply to this message

From: Ben Chambers
Subject: Re: Array...
Date: 17 Oct 2001 18:41:19
Message: <3bce090f@news.povray.org>
"KalleK" <kal### [at] gmxde> wrote in message news:3bcdd032@news.povray.org...
> Do you mean, Povray 3.5 (beta) doesn't run with 640*480 screen
> resolution? (3.1g did some warning - is not designed to run under
> 800*600 - but it run) I'm a bit afraid about that message, I'm going
> to use Povray 3.5 (when it's out) on a 640*480 screen.
> Can someone tell me if that's true (or better: not true) - I tried
> with beta 4, it worked (you could not press the ok-button of the
> povlegal-screen - but it worked)
> Or did I misunderstand you?
>
> cukk

I just tried it.  It runs.

...Chambers


Post a reply to this message

From: KalleK
Subject: Re: Array...
Date: 18 Oct 2001 04:02:12
Message: <3bce8c84@news.povray.org>
> I just tried it.  It runs.

Phewww...

Thank you

cukk


Post a reply to this message

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