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 06:18:33 EDT (-0400)
  Re: union of door and handle pushes item off z axis  
From: Alain
Date: 25 Aug 2009 21:27:57
Message: <4a948f9d$1@news.povray.org>

> I got it with the code shown below, thank you. I hope this is the best way to
> assemble a cabinet in povray code. I extracted the solution from povray's
> woodbox sample. Alain's help was encouraging also.
> 
> #declare door = object{ model_101_ scale <0.01,0.01,0.8> scale
> <49.4999961853027,75,1> translate <25,-1,61> pigment {image_map {jpeg
This translate should be used to align the door relative to the Y axis.
> "A333_bergama.jpg"} scale 1} finish {phong 1 ambient 0.6 reflection 0.08}
>   translate -<0,47.5,60> rotate y*-0 translate <0,47.5,60>
Remove this line.
>  }
A rotation here will only rotate the door. It will not affect anything 
attached to it.
----> don't rotate here!

Make sure that one edge, preferably the hinge axis, of the door lies ON 
the Y axis.

> 
> 
> #declare handle = object {k_model_1_ pigment {image_map {jpeg "A316_wenge.jpg"}
> scale 1}
> scale <0.1,0.1,0.1> rotate z*0
> translate <3,62,64>finish {phong 1 ambient 0.3 reflection 0.3}//a2
> }
This must be located relative to the door at it's starting location.
> 
> 
> #declare cabinetcase = union{
> object{ BOX scale <50,2,60> translate <25,0,0> pigment {color rgb <1,1,1>}}
> object{ BOX scale <2,73,58> translate <49,37.5,2> pigment {color rgb <1,1,1>}}
> object{ BOX scale <2,73,58> translate <1,37.5,2> pigment {color rgb <1,1,1>}}
> object{ BOX scale <50,73,2> translate <25,37.5,0> pigment {color rgb <1,1,1>}}
> 
> }//close union
> 
>  //FINALLY PUT EVERYTHING TOGETHER
> union {
> object { cabinetcase  }
> object { door  }
> object { handle  }
> 
>  translate x*62   rotate -y*35
This rotation will affect EVERYTHING in the union and make it orbit 
around the origin. Very probably the cause of your unexpected movements.
>      }
> 
> 
> 

New union:
union{
	object { cabinetcase  }
	union{ // for the door itself
		object { door  }
		object { handle  }
		rotate Door_Opening
// This will rotate ONLY the door and it's decorations
		translate Door_Location
// To place the door at it's final location
		}
	rotate Cabinet_Rotation
// To align the cabinet to a wall or some thing
	translate Cabinet_Location
// Final placement of the whole cabinet
	}

Remember to rotate THEN translate.

If you translate then rotate, the rotation will cause the object to 
change position. Usefull if you want to place several objects in a circle.



Alain


Post a reply to this message

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