POV-Ray : Newsgroups : povray.general : Arrays: integer in subscript? : Re: Arrays: integer in subscript? Server Time
7 Aug 2024 17:21:23 EDT (-0400)
  Re: Arrays: integer in subscript?  
From: Ron Parker
Date: 15 Aug 2001 22:57:34
Message: <slrn9nmdl2.c0t.ron.parker@fwi.com>
On Wed, 15 Aug 2001 22:13:39 -0400, Greg M. Johnson wrote:
>What is allowed in the subscript of an array?  I often do math and then
>put some things into the array.  What is allowed?
>
>MyArray[3.1][n/2][int(n*3.1)]    etc......

Anything that evaluates as a float.  That is, any expression that's not 
a vector or a colour.

The value is rounded down before use, except when it's with 1e-8 of the
next higher integer, in which case it's rounded up (this accounts for 
rounding error in the calculation.)  Negative subscripts are not allowed.

There's a bug that keeps you from using -.000000000001 as a subscript, 
too, even though it should be rounded to zero.  That'll be fixed in 3.5.

-- 
#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

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