|
![](/i/fill.gif) |
"Patrick Elliott" <sha### [at] hotmail com> wrote in message
news:MPG.19836835a2284e4b98983c@news.povray.org...
> In article <3f192104$1@news.povray.org>, tim### [at] gmx de says...
> > It does sound interesting, but also a little above
> > my head at the moment... Nontheless, thanks
> > for link, perhaps I can make something of it when
> > having more time to spend on it...
> >
>
> Simplest definition is that Inverse Kinematics uses some sort of nesting
> of objects. In SDL this is easy:
>
> union {
> Object1
> Object {
> Object2
> rotate <x2,y2,z2>
> }
> rotate <x1,y1,z1>
> }
>
An array-based approach works too.
#declare ataObjs = array[8] { ataBase, ataSectB, ataSectM, ataSectM,
ataSectM, ataSectH, ataHandL, ataHandR }
#declare ataLens = array[8] { atabHgtB, atasH, atasH, atasH, atasH, atasH,
0, 0 }
#declare atArmAng = array[1][3]
#declare atArmAng[0][0] = array[7] { <-40, 20,-35>, x*26, x*30 , x*28, x*33,
x* 5,-x*10 }
#declare atArmAng[0][1] = array[7] { < 10, 70, 5>, x* 6, x* 4 , x* 8, x*13,
x*10,-x*20 }
#declare atArmAng[0][2] = array[7] { <- 3,-90,-15>, x*10, x* 8 , x*14, x*11,
x*15,-x*30 }
#declare ataMoves = array[7]
#macro ManipArm(Objects, Lengths, Joints, Moves)
#local aSiz = dimension_size(Joints,1);
#debug concat(str(aSiz,0,0), " objects.\n")
#local ps = 0;
#while (ps<aSiz)
#local rt = ps;
#declare Moves[ps] = transform {
#while (rt>=0)
rotate Joints[rt]
translate y*Lengths[rt]
#local rt = rt - 1;
#end
}
#local ps = ps + 1;
#end
union {
#set ps = 0;
object { Objects[ps] }
#while (ps<aSiz)
#local ps = ps + 1;
object { Objects[ps] transform { Moves[ps-1] } }
#end
}
#end
#macro atArm(obn, arn) object { ManipArm(ataObjs, ataLens,
atArmAng[obn][arn], ataMoves) } #end
The idea is to set up the transforms for each object first so that nesting
becomes unnecessary:
If you want the object definitions check out my "Manipulator arm" thread.
Post a reply to this message
|
![](/i/fill.gif) |