POV-Ray : Newsgroups : povray.general : Help with function : Re: Help with function Server Time
29 Jul 2024 14:19:38 EDT (-0400)
  Re: Help with function  
From: Jim Holsenback
Date: 31 Mar 2011 15:33:23
Message: <4d94d703$1@news.povray.org>
On 03/31/2011 12:25 PM, Trevor G Quayle wrote:
> "Robert McGregor"<rob### [at] mcgregorfineartcom>  wrote:
>> Jim Holsenback<jho### [at] povrayorg>  wrote:
>>> On 03/31/2011 05:16 AM, Anthony D. Baye wrote:
>>>> can someone help me with the following transform:
>>>>
>>>> #local s = 1 / (2 * (1 + sum(k,1,n, cos(2*pi*k/n)) ));
>>>
>>> Just a casual glance so I might be wrong, but I think you're misusing
>>> the sum function
>>
>> Yep, try something like this, with a function wrapper for sum:
>>
>> #local fn = function(k,n) { sum(k,1,n, cos(2*pi*k/n)) }
>> #local s = 1 / (2 * (1 + fn(1,2)));
>>
>> -------------------------------------------------
>> www.McGregorFineArt.com
>
> Though the docs don't seem to say so explicitly, it appears that the sum() and
> prod() functions need to be in a function.

Yep ... when I had a quick look at the docs the example does appear to 
be eluding to that point, but yes it's a bit thin, and that's why I 
wasn't 100% on my initial advice.

I've been asked to capture some information from the "Light Attenuation" 
thread in this same news group and see if I can glean something from 
that discussion and get it into the docs ... I'll add prod/sum to my to 
do list as well.

Jim


Post a reply to this message

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