POV-Ray : Newsgroups : povray.general : an extraordinary rotation question : Re: an extraordinary rotation question Server Time
30 Jul 2024 16:26:34 EDT (-0400)
  Re: an extraordinary rotation question  
From: mysdn
Date: 24 Jun 2009 03:50:00
Message: <web.4a41d72acfb6d60e4e47a1b0@news.povray.org>
Hi,
I got most of the macro working, only a few problems, sorry for sounding really
stupid. My previous request for a macro sample is rendered obsolete by this
post. Cause I got a macro (Chris B's sample) working even though still missing
a lot of functionality.

1- I can't pass the texture names to macro as a parameter
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?
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....

that's it for now I'm working on it, these 3 are all I'm stuck on right now.

PS: in the future I'll need a challenging macro for angled cabinets. Remember
the angled wall, well what if it needs a cabinet placed in its angled corner.
That cabinet should be angled accordingly in 2 pieces, single door. To
understand what I'm saying , draw a straight line 50 cm, at right side draw
another line 40 cm at 40 degrees rotated towards yourself, now make that into a
cabinet on paper.

Thanks a million


------------ the code I got working--------improvised Chris B's code
// How does it look?

//#include "Cabinet.inc"

camera {location <-1, 1.2, -1> look_at <0.6,0.3,0>}
light_source {<2,20,-4> color rgb 2}


#macro Cabinet (Width,Height,Depth,HasDoor,Door_OpenAngle)


  #ifndef (Thickness)  #declare Thickness  = 0.012; #end
  // Default Door Variables
  #ifndef (Door_OpenAngle) #declare Door_OpenAngle  = 0;    #end
  #ifndef (HasDoor)        #declare HasDoor  = true;        #end

  // Default Textures
  #ifndef (Cabinet_Texture)
    #declare Cabinet_Texture = pigment {image_map {jpeg "yo_toprak"}scale 1 }
  #end
  #ifndef (Door_Texture)
    #declare Door_Texture = pigment {image_map {jpeg "A366_abanoz"}scale 1 }
  #end

  union {
    // Cabinet
    difference {
      box {<0,0,0><Width,Height,Depth>}
      box {<Thickness,0.15,-0.001>
           <Width,Height,Depth>-Thickness
      }
      texture {Cabinet_Texture}
    }
    // Door
    #if (HasDoor)
      box {<0,0,0><Width,Height,-0.02>
        texture {Door_Texture}
        rotate y*Door_OpenAngle
      }
    #end
  }

#end


// Add 3 cabinets to the scene by calling the macro

// Default Cabinet
#declare Cabinet_Texture = pigment {image_map {jpeg "yldz_yesiltarra"}scale 1 }
#declare Door_Texture = pigment {image_map {jpeg "A366_abanoz"}scale 1 }
object {Cabinet(0.5,0.75,0.6,true,0) rotate y*0 translate 0.0*x translate 0.10*y
translate 0.15*z}



// Custom Cabinet
#declare Cabinet_Texture = pigment {image_map {jpeg "yo_toprak"}scale 1 }
#declare Door_Texture = pigment {image_map {jpeg "A366_abanoz"}scale 1 }
object {Cabinet(0.5,0.75,0.6,true,45) rotate y*45 translate 0.62*x translate
0.10*y translate 0.15*z}

// Doorless Cabinet
#declare Cabinet_Texture = pigment {image_map {jpeg "yo_toprak"}scale 1 }
#declare Door_Texture = pigment {image_map {jpeg "A366_abanoz"}scale 1 }
object {Cabinet(0.35,0.75,0.6,true,0) rotate y*0 translate -0.38*x translate
0.10*y translate 0.15*z}


Post a reply to this message

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