POV-Ray : Newsgroups : povray.general : sugestion: get_local_point : Re: sugestion: get_local_point Server Time
2 Aug 2024 20:18:02 EDT (-0400)
  Re: sugestion: get_local_point  
From: Mike Williams
Date: 1 Aug 2004 07:50:21
Message: <fb674AAZjNDBFwV7@econym.demon.co.uk>
Wasn't it Rafal 'Raf256' Maj who wrote:
>I have a problem when I'm doing more advanced vectors math (in animation 
>for example) and some points I'm calculating "by hand" using vrotate etc, 
>other are calculated by CSG and transformations. THe problem is when I need 
>to convert between both methods.
>Example:
>
>union {
>  union {
>    object { MY_OBJECT } // object has center in <0,0,0>
>    rotate x*90
>    translate y*clock
>    // where will be center of MY_OBJECT in here - in this context?
>  }
>  rotate z*sin(clock)  translate z*clock*2
>  // where will be center of MY_OBJECT in here - in this context? 
>}
>
>sphere { position_of_MY_OBJECT_in_this_context 1 }
>
>and I want last sphere to point to center of MY_OBJECT, with is not easy as 
>it is in other transformations context and I would heve to repeat all CSG 
>transforamtions manualy to calcaulate that point, with is not very 
>comfortable.

You don't have to repeat the transforms, you just have to declare them
separately from the objects that you want to transform, like this:

#declare MOVEMENT = transform {
    rotate x*90
    translate y*clock
    rotate z*sin(clock)
    translate z*clock*2
}    

union {
  union {
    object { MY_OBJECT }        // The main object moved
    transform {MOVEMENT}
  }
}

sphere {0,1 transform {MOVEMENT}} // A sphere moved the same way



-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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