POV-Ray : Newsgroups : povray.general : Union door and handle Server Time
2 Nov 2024 09:17:17 EDT (-0400)
  Union door and handle (Message 1 to 5 of 5)  
From: optima
Subject: Union door and handle
Date: 21 Aug 2009 08:25:00
Message: <web.4a8e9198a0e4bea223dbf5ab0@news.povray.org>
Hi,
I want to attach the handle onto the door so that they rotate together. But no
such luck after a few hours of trying. How can I move the handle with the door?
Sample is complete with what you need to know for helping. Thank you very much.
http://www.kitchendesigned.com/download/handle.zip

I guess they need to be nested inside one another but how
or should it be done some other way? Any help is appreciated.

Ibrahim Dogan


Post a reply to this message

From: Stephen
Subject: Re: Union door and handle
Date: 21 Aug 2009 09:37:54
Message: <9o8t8551bgppmpbgoi54da7ks2l8b5jajv@4ax.com>
On Fri, 21 Aug 2009 14:33:13 +0100, Stephen <mcavoysAT@aolDOTcom> wrote:

>subtract the translation if the union. 

subtract the translation of the union. 
-- 

Regards
     Stephen


Post a reply to this message

From: Warp
Subject: Re: Union door and handle
Date: 21 Aug 2009 09:53:30
Message: <4a8ea6d9@news.povray.org>
optima <jes### [at] yahoocom> wrote:
> I want to attach the handle onto the door so that they rotate together.

union
{ object { Door }
  object { Handle }
  rotate <whatever>
}

-- 
                                                          - Warp


Post a reply to this message

From: Stephen
Subject: Re: Union door and handle
Date: 21 Aug 2009 12:12:08
Message: <ioht85l9amlt74tlaihkmfaej0pll1s636@4ax.com>
On Fri, 21 Aug 2009 14:37:30 +0100, Stephen <mcavoysAT@aolDOTcom> wrote:

Sorry I messed up a post :(

As Warp says:

Yes you need to group your door and handle in a union and rotate that union. But
remember that every rotate is about the origin. You will need to translate your
objects to the appropriate position rotate the union and translate them back.

I don't hand code but use a modeller so I can't give you a written example. I
would create a union where the hinge would be add the objects to it then
subtract the translation of the union. But that maybe a roundabout way of
describing it.
-- 

Regards
     Stephen


Post a reply to this message

From: Reactor
Subject: Re: Union door and handle
Date: 21 Aug 2009 16:45:00
Message: <web.4a8f06a62d7d9803b10e65ae0@news.povray.org>
"optima" <jes### [at] yahoocom> wrote:
> Hi,
> I want to attach the handle onto the door so that they rotate together. But no
> such luck after a few hours of trying. How can I move the handle with the door?
> Sample is complete with what you need to know for helping. Thank you very much.
> http://www.kitchendesigned.com/download/handle.zip
>
> I guess they need to be nested inside one another but how
> or should it be done some other way? Any help is appreciated.
>
> Ibrahim Dogan


I had a look at your code.  The point of rotation would be along the hinges, not
the center.  Also, the rotation in the scene file is 360 degrees, which would
appear to have no effect, since it is rotated completely back around to its
starting point.  You have the right idea of translating it first, though.

Note that this statement here:

translate -x*CentrePoint.x translate -y*CentrePoint.y translate -z*CentrePoint.z

is identical to

translate -CentrePoint

Since CentrePoint is already a 3D vector, there is no need to break it into
components.  Furthermore, changing the camera angle shows that the handle is
not connected, probably due to the transformation that is applied to it.  Since
the door and handle do not move relative to one another, you should be applying
one singe transformation to the union consisting of the door and handle.  The
case of the cabinet should be in its own union.

Further inspection shows that the handle's transformation appears to be correct.
The way it should be grouped is:
#declare case =
union{
// boxes for walls of cabinet
}

#declare door_and_handle =
union{
// door objects
// handle objects
}


// entire_cabinet:
union
{
    object{ case }
    object{ door_and_handle
  // from the handle's old transformation
      translate -<0,47.5,60> rotate y*-25 translate <0,47.5,60>
    }
// any transformation for the entire cabinet,
// whether the door is opened or closed, would go here.
}


HTH

-Reactor


Post a reply to this message

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