POV-Ray : Newsgroups : povray.general : union of door and handle pushes item off z axis : Re: union of door and handle pushes item off z axis Server Time
30 Jul 2024 12:27:18 EDT (-0400)
  Re: union of door and handle pushes item off z axis  
From: Alain
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

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