POV-Ray : Newsgroups : povray.general : 3.2.1.6.5 in docs--clarification needed : Re: 3.2.1.6.5 in docs--clarification needed Server Time
29 Jul 2024 10:29:07 EDT (-0400)
  Re: 3.2.1.6.5 in docs--clarification needed  
From: Kenneth
Date: 1 Mar 2013 00:40:01
Message: <web.51303c93ef3a5b59c2d977c20@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 27.02.2013 22:32, schrieb Kenneth:
>
> > In the v3.62 docs section 3.2.1.6.4  "Declaring User-Defined Vector Functions"
> > (immediately preceding the one I mentioned), there's another similar(??)
> > example...
> >
> >   #declare foo = function {
> >     transform {
> >       rotate <90, 0, 0>
> >       scale 4
> >     }
> >   }
> >
> >   #declare myvector = foo(4, 3, 7);
> >
> > Would myvector ever return anything other than rotate <90,0,0> and scale 4? Or
> > am I still totally confused? (BTW, the spline function example in that section
> > *does* make sense to me, if I'm grasping the fundamental idea correctly.)
>
> The example is equivalent to
>
> #declare fooTrans = transform {
>    rotate <90, 0, 0>
>    scale 4
> }
>
> #declare myvector = vtransform(<4,3,7>, fooTrans);
>
> i.e. the function interprets the three parameters as coordinates in 3D
> space, rotates the corresponding point by 90 degrees around the x axis,
> and scales it by a factor of 4.

I've been working with a test scene to try and understand what "myvector" does
here, but I'm conceptually lost (as to both the function example and just the
vtransform version.) My scene may not even be appropriate.

I assume that it's just a 3-component vector; but the 'scale' part is a mystery.
What is the concept of 'scaling a point'? Does it just mean that the chosen
point in space, by being scaled, then moves 'up and away' from the origin? (like
scale would do to any point on an *object* if it were not at the origin to begin
with.) If so, then I *think* I understand what happens to 'the point' at
<4,3,7>--the vector is the new 3D position of that point--a single point--after
it's rotated and 'scaled' from it's original <4,3,7> position.

But how to use it: Can I apply myvector to a box object, for example? Is it then
supposed to rotate *and scale* the entire box? Or just move it to the new
coordinates? If this is making any sense at all, then how/where would I use it
in the box code to do so? (Translate, transform, etc.?) My attempts have all
failed, or make no visual sense because I'm not even sure what to expect. *Any*
example of its use would be helpful.

So, using myvector = vtransform(<4,3,7>, fooTrans)...

box{0,1 translate -.5
   Then....????....
      transform{myvector} // produces a fatal error
// Or...
      translate myvector // this works, but the results don't make sense--the
// box is no longer at the origin, and is (obviously--I think?) unscaled.

I do have a vague sense about something: The box as built isn't AT the
coordinates <4,3,7>...but I don't know what that means when myvector is applied
to it.


Post a reply to this message

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