POV-Ray : Newsgroups : povray.general : union of door and handle pushes item off z axis Server Time
30 Jul 2024 10:22:05 EDT (-0400)
  union of door and handle pushes item off z axis (Message 11 to 12 of 12)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: optima
Subject: Re: union of door and handle pushes item off z axis
Date: 29 Aug 2009 17:55:01
Message: <web.4a99a26ab4a77fd044cee4d70@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:
> So, before you rotate the object, be sure it's sitting at the correct
> place. Never translate from the origin before you rotate.
>
> 1 - Create all objects AT the origin.
> 2 - Scale the object as needed.
> 3 - Rotate the object as needed.
> 4 - Translate the object to it's final location.
>
> Alain

Is this cabinet located on the origin? If I knew how to get it to origin before
rotation my problem would be solved for rotations.
union{
object { cabinet_case  }
union{
object { door scale <49.4999961853027,75,1> translate <25,0,61> pigment
{image_map {jpeg "2.jpg"}}}
object { handle translate <47,62,64> pigment {image_map {jpeg "a700.jpg"}}}
translate -<0,47.5,60> rotate y*-0 translate <0,47.5,60>}//DOOR ROTATION
translate <-0,0,0> rotate <0,0,0> translate <-50,0,0>}//CABINET FINAL PLACEMENT
                       //-50 suppose there is another cabinet to the left
                       //if I rotate this cabinet y*45 it will orbit

This is how I create my cabinets, are they created at the origin?

Thanks a lot, your assistance is appreciated so much.
Ibrahim


Post a reply to this message

From: Alain
Subject: Re: union of door and handle pushes item off z axis
Date: 31 Aug 2009 13:48:30
Message: <4a9c0cee$1@news.povray.org>

> Alain <aze### [at] qwertyorg> wrote:
>> So, before you rotate the object, be sure it's sitting at the correct
>> place. Never translate from the origin before you rotate.
>>
>> 1 - Create all objects AT the origin.
>> 2 - Scale the object as needed.
>> 3 - Rotate the object as needed.
>> 4 - Translate the object to it's final location.
>>
>> Alain
> 

> Thanks a lot, your assistance is appreciated so much.
> Ibrahim
> 
> 
> 

union{
object { cabinet_case  }
union{
	object { door scale <49.49999,75,1> translate <25,0,61>}
	object { handle translate <47,62,64>}
	translate -<0,47.5,60> rotate y*-0 translate <0,47.5,60>
	}//end of door

	translate <-0,0,0> rotate <0,0,0> translate <-50,0,0>
}//end of cabinet
                       //-50 suppose there is another cabinet to the left
                       //if I rotate this cabinet y*45 it will orbit
This means that the cabinet is obviously NOT at the origin.

Removed the textures for clarity.
(it would be beter NOT to include the textures, it's not part of the 
problem, and make it harder to read)

What is the definition of the object "cabinet_case"? What are it's 
dimentions and it's location?

If you don't know the location of the cabinet, then you can use 
min_extent() and max_extent() to get it's location and move it back to 
the correct "starting position":

#declare Min = min_extent(cabinet_case);
#declare Max = max_extent(cabinet_case);// Find the bounding box
#declare cabinet_case = object{cabinet_case
		translate -<(Min.x+Max.x)/2,0, (Min.z+Max.z)/2>
// Bring the cabinet back around the Y axis.
// OPTIONAL translate: move forward to have the back-side at zero
		}
//Do NOT translate again before the last rotation and/or scale


Alain


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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