POV-Ray : Newsgroups : povray.general : User-Defined Functions Server Time
3 Nov 2024 11:48:04 EST (-0500)
  User-Defined Functions (Message 1 to 2 of 2)  
From: kurtz le pirate
Subject: User-Defined Functions
Date: 12 Mar 2006 12:09:04
Message: <kurtzlepirate-7D0D0B.18090312032006@news.povray.org>
hello :)

reading <http://www.povray.org/documentation/view/3.6.1/231/>, i see 
that user-defined function cannot return simple vector :

FUNCTION_IDENTIFIER:
    #local FUNCTION_IDENTIFIER = function { FLOAT }               |
    #declare FUNCTION_IDENTIFIER = function { FLOAT }             |
    #local FUNCTION_IDENTIFIER = function(IDENT_LIST) { FLOAT }   |
    #declare FUNCTION_IDENTIFIER = function(IDENT_LIST) { FLOAT } |
    #local FUNCTION_IDENTIFIER = function{SPECIAL_FLOAT_FUNCTION} |
    #local VECTOR_IDENTIFIER = function{SPECIAL_VECTOR_FUNCTION}  |
    #local COLOR_IDENTIFIER = function { SPECIAL_COLOR_FUNCTION } |

#declare curve = function(tt) {
  <-22*cos(tt)-128*sin(tt)-44*cos(3*tt)-78*sin(3*tt),
  11*cos(tt)-43*cos(3*tt)+34*cos(5*tt)-39*sin(5*tt),
  70*cos(3*tt)-40*sin(3*tt)+8*cos(5*tt)-9*sin(5*tt)>
  }
... of corse don't work :( but :
#macro curve(tt)
  <-22*cos(tt)-128*sin(tt)-44*cos(3*tt)-78*sin(3*tt),
  11*cos(tt)-43*cos(3*tt)+34*cos(5*tt)-39*sin(5*tt),
  70*cos(3*tt)-40*sin(3*tt)+8*cos(5*tt)-9*sin(5*tt)>
#end

... work well :)


why this limitation ?

-- 
klp


Post a reply to this message

From: Christoph Hormann
Subject: Re: User-Defined Functions
Date: 12 Mar 2006 13:05:03
Message: <dv1nqn$rpg$1@chho.imagico.de>
kurtz le pirate wrote:
> 
> why this limitation ?
> 

User-defined functions were designed to allow render time code in 
patterns and isosurfaces.  Coding a vector expression like you showed is 
not required there and it would be extremely inefficient with the 
current function syntax.  You can however do what you want to do using 
the average pigment trick - see the Vector_Function() macro in MegaPOV's 
mechsim.inc

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.imagico.de/ (Last updated 31 Oct. 2005)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

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