POV-Ray : Newsgroups : povray.general : troubles with functions in 3.5 ... Server Time
20 Nov 2024 04:29:54 EST (-0500)
  troubles with functions in 3.5 ... (Message 1 to 4 of 4)  
From: jan Walzer
Subject: troubles with functions in 3.5 ...
Date: 12 Oct 2001 12:35:58
Message: <1103_1002904567@iq>
the following

----------------------------------------
#declare SphereInside=function(x,y,z,p,r) {
        select( vlength(<x,y,z>-p)-r),
                    0,1
                    )
    }
----------------------------------------
gives me:
	
----------------------------------------
        select( vlength(< <----ERROR

Parse Error: Expected 'operand', < found instead

Returned from renderer with error status
----------------------------------------

how do have to correct this ?
I think, it is clear, what I want to do ... and: Yes, I need this as a function, NOT a
macro!
BTW: I also tried it with (sqrt((x-p.x)^2+(y-p.y)^2+(z-p.z)^2+))

How can I do ?


Post a reply to this message

From: Christoph Hormann
Subject: Re: troubles with functions in 3.5 ...
Date: 12 Oct 2001 13:01:31
Message: <3BC721EB.317F3B6A@gmx.de>
jan Walzer wrote:
> 
> the following
> 
> ----------------------------------------
> #declare SphereInside=function(x,y,z,p,r) {
>         select( vlength(<x,y,z>-p)-r),
> [...]
> 
> how do have to correct this ?

Why do you think vlength() is allowed in user defined functions?


> BTW: I also tried it with (sqrt((x-p.x)^2+(y-p.y)^2+(z-p.z)^2+))
> 

This should work if you use floats instead of p.x etc.

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Slime
Subject: Re: troubles with functions in 3.5 ...
Date: 12 Oct 2001 13:28:56
Message: <3bc72858$1@news.povray.org>
Yeah, it took me a while to figure out that functions you're allowed to use
in functions are different from functions you're allowed to use in macros,
completely, in every case.

There's a list of the functions you *are* allowed to use in functions in
section 6.1.6  "User-Defined Functions" of the docs. (look for
"Float_Function", they're all listed under it.)

In the meantime, just say

#declare veclength = function (x,y,z) {sqrt(x^2+y^2+z^2)}

and then use that.

- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]

"Christoph Hormann" <chr### [at] gmxde> wrote in message
news:3BC721EB.317F3B6A@gmx.de...
>
>
> jan Walzer wrote:
> >
> > the following
> >
> > ----------------------------------------
> > #declare SphereInside=function(x,y,z,p,r) {
> >         select( vlength(<x,y,z>-p)-r),
> > [...]
> >
> > how do have to correct this ?
>
> Why do you think vlength() is allowed in user defined functions?
>
>
> > BTW: I also tried it with (sqrt((x-p.x)^2+(y-p.y)^2+(z-p.z)^2+))
> >
>
> This should work if you use floats instead of p.x etc.
>
> Christoph
>
> --
> Christoph Hormann <chr### [at] gmxde>
> IsoWood include, radiosity tutorial, TransSkin and other
> things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: troubles with functions in 3.5 ...
Date: 12 Oct 2001 13:30:06
Message: <3bc7289e@news.povray.org>
In article <1103_1002904567@iq> , jan Walzer <iq### [at] walliqde>  wrote:

> how do have to correct this ?

You cannot use vectors in user-defined functions.  The manual explains what
you can and cannot use in user-defined functions.  Note that you couldn't
use vectors in MegaPOV either.


    Thorsten


Post a reply to this message

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