POV-Ray : Newsgroups : povray.newusers : using arrays in functions Server Time
29 Jul 2024 08:23:34 EDT (-0400)
  using arrays in functions (Message 1 to 5 of 5)  
From: stefan berke
Subject: using arrays in functions
Date: 30 May 2006 11:14:19
Message: <447c614b$1@news.povray.org>
hi, is there any way of using an array like
MAP[mZ][mX] = float in a function?

say:
   #local fun = function(x,y,z) { map[z][x] }
results in:
    >Float expected but vector or color expression found<
and:
    #local fun=function(A,B) { map[A][B] }
results in:
    >expected numeric expression, undeclared identifier 'A' found instead<

any way you put it, it's like arrays where not accepted by
the parser.
i wanted to create an isosurface & pigments out of an array of heightdata.
ok, i could stuck together some mesh
from the array but still cannot use it for the pigments if
theres no wrapper from arrays to functions.

anyone a hint please?


Post a reply to this message

From: Christoph Hormann
Subject: Re: using arrays in functions
Date: 30 May 2006 11:45:03
Message: <e5hp1l$mdg$1@chho.imagico.de>
stefan berke wrote:
> hi, is there any way of using an array like
> MAP[mZ][mX] = float in a function?
> 
> say:
>    #local fun = function(x,y,z) { map[z][x] }

No.

> i wanted to create an isosurface & pigments out of an array of heightdata.

Use an image_map/image_pattern pigment/pattern function.

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.imagico.de/ (Last updated 27 May. 2006)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

From: stefan berke
Subject: Re: using arrays in functions
Date: 30 May 2006 13:13:50
Message: <447c7d4e$1@news.povray.org>
> No.

well, thats sad to hear.
the reason i initially use an array of heightdata is that it can be created
in several distinguish steps. f.e creating a valley/river/branches,
interpolating it, etc. now, after your neg. answer, i tried to write a macro
which outputs the
array into an .TGA file and failed again. seems POV SDL can output only
characters #01-#127. (and $0d0a instead of $0a) at least the missing zero
is quite a prob while writing the TGA header.... is there any binary output?
    i got a feeling i'm stuck with this method. at least i could render some
height
map by using the array-data for colors of boxes or something-this would just
mean one seperate render, ok... guess it's like that. thanx anyway.


Post a reply to this message

From: Christoph Hormann
Subject: Re: using arrays in functions
Date: 30 May 2006 14:30:03
Message: <e5i2qt$pfj$1@chho.imagico.de>
stefan berke wrote:
>> No.
> 
> well, thats sad to hear.
> the reason i initially use an array of heightdata is that it can be created
> in several distinguish steps. f.e creating a valley/river/branches,
> interpolating it, etc. now, after your neg. answer, i tried to write a macro
> which outputs the
> array into an .TGA file and failed again.

Write to a plain PGM file - that's better suited for height data anyway.

The format is described on:

http://netpbm.sourceforge.net/doc/pgm.html

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.imagico.de/ (Last updated 27 May. 2006)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

From: Mike Williams
Subject: Re: using arrays in functions
Date: 30 May 2006 17:16:52
Message: <r99WBBA3XLfEFwFx@econym.demon.co.uk>
Wasn't it stefan berke who wrote:
>hi, is there any way of using an array like
>MAP[mZ][mX] = float in a function?

http://www.econym.demon.co.uk/isotut/arrays.htm

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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