POV-Ray : Newsgroups : povray.general : Rotating an object : Rotating an object Server Time
31 Jul 2024 06:18:06 EDT (-0400)
  Rotating an object  
From: Ger
Date: 4 Oct 2007 16:45:10
Message: <470550d6@news.povray.org>
I have a #macro that creates a wall :


#macro OutSideWall(Position1,End1,Position2,End2)
// ---------- for testing purpose only
cylinder{Position1,Position1+<0,400,0>,30 pigment { red 1 }}
cylinder{Position2,Position2+<0,450,0>,25 pigment { blue 1 }}
// ----------
  #local XLength = Position2.x - Position1.x;
  #local ZLength = Position2.z - Position1.z;
  #local WallLength = VDist(Position1,Position2);
  #local Angle = degrees(asin(ZLength/WallLength));

  #local LogCounter = 0;
  #declare ThisWall =
    union {
    #while ((LogCounter * HtHLogDistance) < OutsideWallHeight)
      object { Log(WallLength,End1,End2) translate y * HtHLogDistance *
(LogCounter+0.5) }
      #local LogCounter = LogCounter + 1;
    #end
    }

  object { ThisWall rotate y * Angle translate Position1 }
#end

so I can do this

OutSideWall(< 200,0,1200>, true,< 200,0,800>, true)
OutSideWall(< 200,0,800>, true,< 400,0, 800>, true)

for a whole building

The walls are created just fine and placed at the correct place (Position1)
but the rotation (rotate Angle) is wrong.

I know this is stupidly simple, but I guess I'm dumber :)

-- 
Ger


Post a reply to this message

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