|
|
<ramble on>
I've been working on a posable hand, towards the goal of a fully
animated humaniform robot (see my posts in p.b.a and p.b.i)
I've created the fingers in such a way that their position is determined
by the angles of the three joints:
object{Finger(Angle1, Angle2, Angle3)}
The problem is, when animating I think it would be easier to specify
the desired target for the fingertip and have the macro work out the
angles - but I can't figure the maths out :(
I have a macro for working out the position of the tip from the angles
given, but cannot work out the complementary formula.
For a finger based at the origin:
#local Nuckle2=vrotate(JointLength[J1][FingerType]*z, ThisAngle.x*x);
#local Nuckle3=Nuckle2+vrotate(JointLength[J2][FingerType]*z,
(ThisAngle.x+ThisAngle.y)*x);
#local FingerTip=Nuckle3+vrotate(JointLength[J3][FingerType]*z,
(ThisAngle.x+ThisAngle.y+ThisAngle.z)*x);
Because the fingertips (currently) only move in two dimensions (y and z)
this can be written as:
y=(Length1*SIN(Angle1))+(Length2*SIN(Angle1+Angle2))+(Length3*SIN(Angle1+Ang
le2+Angle3))
z=(Length1*COS(Angle1))+(Length2*COS(Angle1+Angle2))+(Length3*COS(Angle1+Ang
le2+Angle3))
I know (I think) that there is more than one possible combination of angles
that will give the same point, but
there must be a "simple" procedural way of doing this?
help! This is somewhat beyond my mathematical tallents... (You should have
seen how long it took me to find the solutions to the Nuckle2, Nuckle3,
FingerTip stuff)
thanks,
Mark
Website & Sig on the way...
(http://news.povray.org/povray.binaries.images/21524/)
(http://news.povray.org/povray.binaries.animations/21525/)
<ramble off>
Post a reply to this message
|
|
|
|
John Van Sickle has a findknee macro on his page, and I use that to
create fingers. I have to double up on the macro. If you play with this
code you may find it helpful.
// From JVS's site
#macro FindKnee(pA,pH,lT,lS,vD)
#local lB=vlength(pA-(pH));
#if( (lB>lT+lS) | (lT>lB+lS) | (lS>lT+lB) )
#error "Invalid span lengths.\n"
#end
#local tX=(lT*lT-lS*lS+lB*lB)/2/lB;
#local tY=sqrt(lT*lT-tX*tX);
#local vO=vnormalize(pA-(pH));
#local vF=vnormalize(vcross(vD,vO));
#local vU=vnormalize(vcross(vO,vF));
(pH+vO*tX+vU*tY)
#end
#declare l0 = 1; // Length of one flange
#declare l1 = 0.75; // Length of second flange
#declare l2 = pow(0.75,2); // COrrected length (if memory serves)
#declare p0 = <-0.75,0.25,0>; // The Base of the finger
#declare p1 = <0.25,0,0>;
#declare p2 = <0.5,-1,0>;
#declare px = p2 + (p1 - p2)*SmoothEnds(Five(clock));
// px is the target. The smoothends macro was one I made to simulate a
finger tapping.
// Use what you will for px
sphere { p0 0.1 pigment { rgb 1 } }
sphere { px 0.1 pigment { rgb 1 } }
#declare j1 = FindKnee(px,p0,l0,(l1+l2)*0.9,x);
#declare j2 = FindKnee(px,j1,l1,l2,(j1-p0));
sphere { j1 0.1 pigment { rgb 1 } }
sphere { j2 0.1 pigment { rgb 1 } }
cylinder { p0 j1 0.1 pigment { rgb 1 } }
cylinder { j1 j2 0.1 pigment { rgb 1 } }
cylinder { j2 px 0.1 pigment { rgb 1 } }
Hope this helps.
Josh English
eng### [at] spiritonecom
http://www.spiritone.com/~english
Post a reply to this message
|
|