POV-Ray : Newsgroups : povray.general : Spherical Iris? : Re: Spherical Iris? Server Time
6 Aug 2024 16:57:28 EDT (-0400)
  Re: Spherical Iris?  
From: Grey Knight
Date: 22 Feb 2002 07:05:43
Message: <3C76340B.DC65A914@namtar.qub.ac.uk>
I'm still working on it, but I need to go to a lecture now. Here's the
code for a flat iris extracted from my archives, maybe you can modify it
while I'm away.
I'll try and finish it later.

#macro ensure_vector(Input)
  Input+< 0, 0, 0>
#end

#macro rotate_to(iVector)
  #local Vector=ensure_vector(iVector);
  #if (vlength(Vector)=0)
    #warning "rotate_to:\f!WARNING! Trying to rotate onto null vector
!WARNING!\n\n"
  #end
  #if (Vector.x=0 & Vector.z=0)
    #local RotY=0;
  #else
    #local RotY=degrees(atan2(Vector.x,Vector.z));
  #end
  #local RotX=degrees(acos(vnormalize(Vector).y));
  rotate <RotX,RotY,0>
#end

#macro disc_iris(iCenter,iNormal, Radius, NumPetals, Open, UseUnion)
  //Original macro by Michael Andrews
  #declare Center=ensure_vector(iCenter);
  #declare Normal=ensure_vector(iNormal);
  intersection{
    cylinder{ -0.05*z, 0.05*z, 1 }
      #if(UseUnion)
        union{
      #else
        merge{
      #end
      #local c=0;#while(c<NumPetals)
        cylinder{ -0.01*z, 0.01*z, 1
          rotate -3*y
          translate y
          rotate 60*z
          translate -y rotate -Open*Open*120*z translate y
          rotate 360*(c/NumPetals)*z
        }
      #local c=c+1;#end
    }
    scale Radius
    rotate 90*x
    rotate_to(Normal-Center)
    translate Center
  }
#end

-- 
signature{
  "Grey Knight" contact{ email "gre### [at] yahoocom" }
  site_of_week{ url "http://digilander.iol.it/jrgpov" }
}


Post a reply to this message

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