POV-Ray : Newsgroups : povray.advanced-users : Manipulator arm design : Re: Manipulator arm design Server Time
29 Jul 2024 00:26:39 EDT (-0400)
  Re: Manipulator arm design  
From: Mike Williams
Date: 15 Jul 2003 11:15:36
Message: <VXc5bBAZpBF$EwfC@econym.demon.co.uk>
Oops, I missed a "#local ps=ps-1;" in my previous post, so the top unit
was being inserted twice.

global_settings { assumed_gamma 1.0 }
camera { location  <10,20,-60> look_at <20, 15, 0>}
light_source {<-1000,1000,-1000> colour rgb 1}
plane {y,0 pigment {rgb 0.8}}

// ----------------------------------------

// Subsection
#declare maSection = union {
    box { <-2, 0, -1>, <-1, 9, 1> }
    cylinder { x*-2, x*-1, 1 }
    box { < 1, 0, -1>, < 2, 9, 1> }
    cylinder { x*2, x*1, 1 }
    box { <-1, 1, -1>, <1, 10, 1> }
    cylinder { <-1, 10, 0>, <1, 10, 0>, 1 }
    texture { pigment { rgb <0.45, 0.49, 0.60> } }
}

//Joint array
#declare maRotArray = array [5] { 23, 29, -10, 15, 30 }

//Connection macro
#macro ManipArm(ob, sep, Joints)
 #local ps = dimension_size(Joints,1) - 1;
 #local Arm = union{ob}
 #local ps=ps-1;        // This line added
 #while (ps>=0)
   #local Arm = union {
     object {Arm 
       rotate x*Joints[ps]
       translate y*sep
     }
     object {ob}
   }
   #local ps = ps-1;
 #end
 object {Arm}
#end

//Invocation
object {ManipArm(maSection, 10, maRotArray) 
  rotate y*90
}


Post a reply to this message

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