POV-Ray : Newsgroups : povray.general : an extraordinary rotation question : Re: an extraordinary rotation question Server Time
30 Jul 2024 16:17:57 EDT (-0400)
  Re: an extraordinary rotation question  
From: Chris B
Date: 24 Jun 2009 04:54:26
Message: <4a41e9c2$1@news.povray.org>
"mysdn" <kam### [at] hotmailcom> wrote in message 
news:web.4a41d72acfb6d60e4e47a1b0@news.povray.org...
> Hi,
> I got most of the macro working, only a few problems, ..
>
> 1- I can't pass the texture names to macro as a parameter

Yes you can, but it's usually best to #declare a texture and use it's name 
as a parameter:
#declare MyTexture = texture {pigment {rgb <1,1,0>}}
MyMacro(0,1,MyTexture,2,3)


> 2- I need another Union inside Cabinet Union for door, the door and the 
> handle
> should be another Union inside Cabinet Union. So when we open the door the
> handle moves along. Right?

You can nest unions within one another. Yes it's easiest to union the handle 
to the door before you move the back left or right edge of that union to the 
origin to rotate (open) it.


> 3- the handle may be on the right or left of the door , how do we handle 
> that?
>   thus the hinge place changes, thus the door opens to a different 
> side....

I would recommend having a 'HingeSide' setting of '1' for right, or '-1' for 
left. Then, for the door handle you can do something like
translate <-HingeSide*0.4*Width,HandleHeight,DoorThickness>
// Note the '-' sign to bring the handle to the opposite side to the hinge.

then with the union of the door and handle you'd have something like:
translate <HingeSide*Width,0,0>
rotate y*Door_OpenAngle
translate <-HingeSide*Width,0,0>


Regards,
Chris B.


Post a reply to this message

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