|
![](/i/fill.gif) |
The connection fingers at each end would scale with the object using your
approach, and I want constant finger lengths. To accomplish this a macro is
required:
#macro maSection(len) union {
box { <-2, 0, -1>, <-1, len-1, 1> }
cylinder { x*-2, x*-1, 1 }
box { < 1, 0, -1>, < 2, 1en-1, 1> }
cylinder { x*2, x*1, 1 }
box { <-1, 1, -1>, <1, len, 1> }
cylinder { <-1, len, 0>, <1, len, 0>, 1 }
texture { pigment { rgb <0.45, 0.49, 0.60> } }
} #end
I also wanted very badly to avoid nesting the objects the way your macro
does. POV-Ray will eventually complain if you have a lot pieces set up this
way. What I wanted to do was set up an individual transform for each piece
that would allow them to be placed in a group without the nesting:
// Joint array
#declare maRotArray = array [5] { 23, 29, -10, 15, 30 }
// Joint lengths
#declare maSizeArray = array [6] {10,9,7,5,4,3}
// Transform array
#declare maTrnArray = array [5]
//Connection macro
#macro ManipArm(ob, Lengths, Joints, Moves)
#local aSiz = dimension_size(Joints,1);
#local ps = 0;
#while (ps<aSiz)
#local rt = ps;
#declare Moves[ps] = transform {
#while (rt>=0)
rotate x*Joints[rt]
translate y*Lengths[rt]
#local rt = rt - 1;
#end
}
#local ps = ps + 1;
#end
union {
object { maSection(Lengths[ps]) }
#while (ps<aSiz)
#local ps = ps + 1;
object { maSection(Lengths[ps]) transform { Moves[ps-1] } }
#end
}
#end
//Invocation
object {ManipArm(maSection, maSizeArray, maRotArray, maTrnArray)
rotate y*90
}
You do have a point about working backward from the hand to the shoulder,
though.
Post a reply to this message
|
![](/i/fill.gif) |