POV-Ray : Newsgroups : povray.newusers : object parameters : Re: object parameters Server Time
26 Apr 2024 07:54:15 EDT (-0400)
  Re: object parameters  
From: William F Pokorny
Date: 15 Feb 2023 07:20:40
Message: <63ecce18$1@news.povray.org>
On 2/15/23 05:38, seNex wrote:
> thanks for the quick reply. The underlying problem is, I wanted to track the
> center of the sphere after applying transformations to it. It seems to me from
> the documentation, that there is no way to apply transformations to the vector,
> but only to objects.

You can do something like:

#version 3.8;
global_settings { assumed_gamma 1 }

#declare Vec00 = <0,0,0>;
#declare Xfrm00 = transform {
     translate <0.5,0.0,0.0>
     rotate z*30.0
}
#declare FnXfrm00 = function { transform {Xfrm00} }

// You might need to use 'inverse', if result is to be used in a
// isosurface function , for example.
// #declare FnXfrm00 = function { transform {Xfrm00 inverse} }

#debug concat("Vec00.x --> ",str(Vec00.x,0,-1)," transformed to --> ",
     str(FnXfrm00(Vec00.x,Vec00.y,Vec00.z).x,0,-1),".\n")
#debug concat("Vec00.y --> ",str(Vec00.y,0,-1)," transformed to --> ",
     str(FnXfrm00(Vec00.x,Vec00.y,Vec00.z).y,0,-1),".\n")
#debug concat("Vec00.z --> ",str(Vec00.z,0,-1)," transformed to --> ",
     str(FnXfrm00(Vec00.x,Vec00.y,Vec00.z).z,0,-1),".\n")

#declare Vec00_Xfrmed =
<FnXfrm00(Vec00.x,Vec00.y,Vec00.z).x,
FnXfrm00(Vec00.x,Vec00.y,Vec00.z).y,
FnXfrm00(Vec00.x,Vec00.y,Vec00.z).z>;

#debug concat("\nXfrmed vector <",
     vstr(3,Vec00_Xfrmed, ",", 0, 3), ">\n\n")

#error "\nStopping by #error after parse"

---

If you want to capture a more complete set of 'coordinate modifiers', 
for example, turbulence or warps along with transforms, you are stuck 
in any official POV-Ray release as far as I know.

The povr fork introduced a vector function called pattern_modifiers 
which captures a complete sequence of positional modifiers as a function 
which then can be used as FnXfrm00 is up top.

#declare FnXfrm00 = function {
     pattern_modifiers { Pigment00 }
}

However, at best, such functionality wouldn't show up until a v4.0 
official release.

Bill P.


Post a reply to this message

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