POV-Ray : Newsgroups : povray.beta-test : Function weirdness Server Time
31 Jul 2024 02:20:42 EDT (-0400)
  Function weirdness (Message 1 to 2 of 2)  
From: Slime
Subject: Function weirdness
Date: 17 Sep 2001 23:35:22
Message: <3ba6c0fa$1@news.povray.org>
If this is a double post, I'm really sorry... I thought i posted it hours
ago and it hasn't shown up yet, so maybe I just messed something up.

I have this simple function...

function {
     #local normvec = vnormalize(x,y,z);
     vlength(normvec)+f_noise3d(normvec.x,normvec.y,normvec.z)-1
}

I'm trying to get the normal vector of the current x,y,z coordinate being
tested, but it appears to think i'm referring to the variables x=<1,0,0>,
y=<0,1,0>, and z=<0,0,1>, so it gives me the error "Parse Error: Expected
')', , found instead" on the line with the "local" statement.

Is this a bug, or do I need to do this some other way? Trying
#local normlen = sqrt(x^2+y^2+z^2)
also caused an error.

- Slime
[ http://www.teja.nu/slime/ ]
[ http://www.teja.nu/slime/images ]


Post a reply to this message

From: SciBorg
Subject: Re: Function weirdness
Date: 18 Sep 2001 04:17:06
Message: <3BA70301.2C0F92B0@irrwerk.de>
Slime schrieb:

> If this is a double post, I'm really sorry... I thought i posted it hours
> ago and it hasn't shown up yet, so maybe I just messed something up.
>
> I have this simple function...
>
> function {
>      #local normvec = vnormalize(x,y,z);
>      vlength(normvec)+f_noise3d(normvec.x,normvec.y,normvec.z)-1
> }
>

IT's not a bug ! vnormalize expects one vector. You are assigning three
vectors to it !
normvec= vnormalize (Identifier);
Identifier=<scalar,scalar,scalar>   or
Identifeir=vector

your's gives Identifier= vector,vector,vector
which POV is not expecting.

Workaround
If you use the unchangeble x,y,z - vectors it is equal to use
#local normvec = vnormalize(<1,1,1>);  //or
#local normvec = vnormalize( x+y+z ); //which gives the same vector as result
as above
or if you want to use the scalar vector components use
#local normvec = vnormalize(<x.x,y.y,z.z>);
or if you refer to the components of a single vector
#local normvec = vnormalize(<a.x,a.y,a.z>);
but this would be equal to
#local normvec = vnormalize(a);

this is just for vnormalize. I didn't get the function at all working. :-(

Maybe this is already of  help

8) SciBorg


Post a reply to this message

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