POV-Ray : Newsgroups : povray.advanced-users : user-defined functions-- basic question of use : user-defined functions-- basic question of use Server Time
18 Apr 2024 17:12:52 EDT (-0400)
  user-defined functions-- basic question of use  
From: Kenneth
Date: 25 Feb 2018 14:20:00
Message: <web.5a930bd733a18267a47873e10@news.povray.org>
I'm familiar with using PIGMENT/PATTERN functions, although it has been awhile.
But I was looking at 3.3.1.8.4 "Declaring User-Defined Vector Functions" in the
docs, and it's not clear to me how to actually *use* the examples given there.

The first example (a transform function) is described only like this:

#declare foo = function {
  transform {
    rotate <90, 0, 0>
    scale 4
    }
  }

#declare myvector = foo(4, 3, 7);

How is "myvector" supposed to be used? My assumption is that it 'acts like' a
transform-- just like any transform{..}-- but I can't get it to work. Maybe I'm
using it in a totally wrong way? I tried all sorts of permutations in a sphere
object, but NONE of them work-- all fatal errors. (Some of these are probably
nonsense, but I wanted to be thorough.) Can someone give an example of the
correct way to use  myvector-- in a sphere, or in some other way altogether? I'm
obviously not grasping the underlying idea.

sphere{0,.3

       // myvector
       // or...
       //my_vector(4,3,7)
       // or...
       //transform{myvector}
       // or...
       //transform{myvector(4,3,7)}
       // or...
       //transform{myvector(x,y,z)}
       // or...
       //function{myvector}
       // or...
       //function(x,y,z){myvector}
       // or...
       //foo
       // or...
       //foo(4,3,7)
       // or...
       //function{foo}
       // or...
       //function(x,y,z){foo}
       // or..
       //transform{foo}
       // or...
       //transform{foo(4,3,7)}
       // or...
       //transform{ <myvector.x,my-vector.y,myvector.z>}
       // or... ??
               pigment{ rgb <0,1,0>}
       }


Post a reply to this message

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