POV-Ray : Newsgroups : povray.general : Parametric object with shadow gets black : Re: Parametric object with shadow gets black Server Time
17 Nov 2024 05:13:45 EST (-0500)
  Re: Parametric object with shadow gets black  
From: Wolfgang Wieser
Date: 19 Jun 2003 10:31:21
Message: <3ef1c936@news.povray.org>
Warp wrote:

> Wolfgang Wieser <wwi### [at] gmxde> wrote:
>> #declare f_besselJ = function { internal(81) }
>> #declare f_besselJD = function { internal(82) }
>> #declare f_CAVITY = function { internal(83) }
> 
>   You should really use functions by their official names. The internal()
> ID numbers are reserved and should not be used (because they can change
> at any time with a new version, without any notice, and can break old
> scenes).
>
The reason is just the same as the reason for the error below: 

>   I tried this scene with POV-Ray 3.5 and it says
> 
> Parse Error: Function 'internal(81)' does not exist.
> 
>   Are you using some kind of patched version?
> 
Correct. Because POVRay official version does not know the 
Bessel J function -- and if you saw that function, you know why I have 
to code it in C directly into POV source code...

Cheers,
Wolfgang

----------<fnintern.cpp>---------------
// Include GNU scientific library (GSL): 
#include "/usr/local/numerics/include/gsl/gsl_sf_bessel.h"

inline DBL _f_besselJ(DBL x,int m)
{
        return(gsl_sf_bessel_Jn(m,x));
}
inline DBL _f_besselJD(DBL x,int m)
{
        double eps=0.00001;
        double vA=gsl_sf_bessel_Jn(m,x-eps);
        double vB=gsl_sf_bessel_Jn(m,x+eps);
        return((vB-vA)/(2.0*eps));
}

DBL f_besselJ(DBL *ptr, unsigned int fn) // 81
{
        return(_f_besselJ(PARAM_X,int(PARAM(0)+0.5)));
}

DBL f_besselJD(DBL *ptr, unsigned int fn) // 81
{
        return(_f_besselJD(PARAM_X,int(PARAM(0)+0.5)));
}

DBL f_CAVITY(DBL *ptr, unsigned int fn) // 82
{
        int m=int(PARAM(0)+0.5);
        double tmpA=sin(m*PARAM_Y)*_f_besselJ(PARAM_X,m);
        double tmpB=cos(m*PARAM_Y)*m/PARAM_X*_f_besselJD(PARAM_X,m);
        return(hypot(tmpA,tmpB));
}
----------------------------------------


Post a reply to this message

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