POV-Ray : Newsgroups : povray.advanced-users : Need Help jointing a leg for IK Server Time
26 Nov 2024 09:41:58 EST (-0500)
  Need Help jointing a leg for IK (Message 1 to 9 of 9)  
From: H  E  Day
Subject: Need Help jointing a leg for IK
Date: 23 Sep 2000 17:01:12
Message: <01c025a1$3bb42d00$527889d0@daysix>
Ok, since my skills have never lain in the direction of advanced
mathematical application, I bring this to you guys.  I need a jointed leg,
or code on how to produce one.  This leg needs to have defineable Thigh and
Shin lengths.  I only want to have to move the ankle for the entire leg to
move accordingly.  
The leg doesn't need to be anything fancy, just 3 spheres (Hip, Knee,
Ankle) and 2 cylinders (Thigh, Shin).  I'll replace the objects with the
stuff I've already have built.
I find it important to note that I have allready spen a good month on this
problem, and have been unable to come to a solution.  I ain't lazy.
Thanks in advance!


-- 
H.E. Day
<><


Post a reply to this message

From: Warp
Subject: Re: Need Help jointing a leg for IK
Date: 23 Sep 2000 18:42:28
Message: <39cd31d4@news.povray.org>
I used a very simplified IK of this kind in my Spider Robot animation
in the IRTC.
  You can look at the code to see how I did it.

  I could also try to figure out some math for you if you really want
(but right now I have a terrible "brain laziness"...)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Warp
Subject: Re: Need Help jointing a leg for IK
Date: 23 Sep 2000 18:44:28
Message: <39cd324c@news.povray.org>
(More specifically, look at the Leg() macro in the 'robot.pov' file.)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Rune
Subject: Re: Need Help jointing a leg for IK
Date: 23 Sep 2000 18:54:00
Message: <39cd3488@news.povray.org>
"H. E. Day" wrote:
> I need a jointed leg, or code on how to produce one.

Ok, have a look in povray.binaries.scene-files and please tell me if it is
of any help!

Greetings,

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated July 23)
/ Also visit http://www.povrayusers.org


Post a reply to this message

From: John VanSickle
Subject: Re: Need Help jointing a leg for IK
Date: 23 Sep 2000 19:55:05
Message: <39CD43C4.D7088830@erols.com>
H. E. Day wrote:
> 
> Ok, since my skills have never lain in the direction of advanced
> mathematical application, I bring this to you guys.  I need a jointed
> leg, or code on how to produce one.  This leg needs to have defineable
> Thigh and Shin lengths.  I only want to have to move the ankle for the
> entire leg to move accordingly.

The FindKnee() macro in my Thoroughly Useful Macros will find the
location of the knee for you.

Regards,
John
-- 
ICQ: 46085459


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Need Help jointing a leg for IK
Date: 26 Sep 2000 10:35:51
Message: <39D0B305.28DA5B12@my-dejanews.com>
"H. E. Day" wrote:

> Ok, since my skills have never lain in the direction of advanced
> mathematical application, I bring this to you guys.  I need a jointed leg,
>
> I find it important to note that I have allready spen a good month on this
> problem, and have been unable to come to a solution.  I ain't lazy.
> Thanks in advance!

Isn't this the prodigy who gave us the coolest running robot ever seen in
"Traffic?"  What did you use then, or was it the case that we never actually
saw the feet touch the ground?


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Need Help jointing a leg for IK
Date: 26 Sep 2000 18:36:03
Message: <39D12493.F157BAB2@hotmail.com>
"H. E. Day" wrote:

> ...
> I need a jointed leg, or code on how to produce one.
>
> This leg needs to have defineable Thigh and Shin lengths.
>
> I only want to have to move the ankle for the entire leg to
> move accordingly.
>
> The leg doesn't need to be anything fancy, just 3 spheres
> (Hip, Knee, Ankle) and 2 cylinders (Thigh, Shin).
>
> I'll replace the objects with the stuff I've already have built.
> ...

Is it something like the code below that you need ?

It's not very advanced though.
(It's "quick and dirty", but I hope it can give you some ideas.)


Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.1;

#include "colors.inc"


#macro FindKnee(pHip, pAnkle, ThighLength, ShinLength, vForw)

  #local vLeg = pAnkle - pHip;
  #local dd = vlength(vLeg);
  #local aa = (pow(dd, 2) + pow(ThighLength, 2) - pow(ShinLength, 2))/(2*dd);
  #local bb = sqrt(pow(ThighLength, 2) - pow(aa, 2));
  #local vRight = vcross(vForw, vLeg);
  #local vFront = vcross(vLeg, vRight);

  (pHip + aa*vnormalize(vLeg) + bb*vnormalize(vFront))

#end // macro FindKnee


#declare DirectionOfMovement = <-3, 0, 2>;

#declare LengthOfThigh = 50;
#declare LengthOfShin = LengthOfThigh*0.9;

#declare PositionOfpHip = <20, 100, -20>;
#declare PositionOfAnkle = <-10, 30, -10>;


/*
// Macro and code to locate the ankle
#macro FindAnkle(pHip, ThighLength, ShinLength,
                 vSpine, vForw, Angle, Stretch)

  #local vRight = vcross(vSpine, vForw);
  #local DistFromHip = ThighLength + ShinLength*(2*Stretch - 1);

  (pHip + vaxis_rotate(DistFromHip*vnormalize(vSpine), vRight, Angle))

#end // macro FindAnkle


#declare DirectionOfSpine = <0, 1, 0>;

// At 0 degrees the ankle is close to the neck
// At 180 degrees the ankle is in line with the spine
#declare RotationOfLeg = 120;

// Value between 0 and 1 that tells how stretched-out
// the leg is. (1 is fully stretched out)
#declare StretchOfLeg = 0.7;


//#declare Phi = 2*pi*3/8;
//// Or you could make Phi a function of the time
//#declare RotationOfLeg = 180 + 30*sin(Phi);
//#declare StretchOfLeg = 0.8 + 0.2*cos(Phi);


#declare PositionOfAnkle = FindAnkle(
                             PositionOfpHip,
                             LengthOfThigh,
                             LengthOfShin,
                             DirectionOfSpine,
                             DirectionOfMovement,
                             RotationOfLeg,
                             StretchOfLeg
                           )
*/

#declare LegLength = LengthOfThigh + LengthOfShin;

#if (vlength(PositionOfAnkle - PositionOfpHip) > LegLength)
  #debug "\n\nError: The ankle is to far away from the hip.\n\n"
#end // if

#declare PositionOfKnee  = FindKnee(
                             PositionOfpHip,
                             PositionOfAnkle,
                             LengthOfThigh,
                             LengthOfShin,
                             DirectionOfMovement
                           );

#declare sr = 8;
#declare cr = sr*0.7;

sphere { // Hip
  PositionOfpHip, sr
  pigment { color Yellow}
}

sphere { // Ankle
  PositionOfAnkle, sr
  pigment { color Orange }
}

sphere { // Knee
  PositionOfKnee,  sr pigment { color Red }
}

cylinder { // Thigh
  PositionOfpHip, PositionOfKnee, cr
  pigment { color Magenta }
}

cylinder { // Shin
  PositionOfKnee, PositionOfAnkle, cr
  pigment { color Cyan }
}

plane { y, 0 pigment { color White } }

global_settings { ambient_light color White }

light_source { 1000*<-1, 1, -2> color 2*White }

camera {
  location <0, 1, -2>*90
  look_at <0, 3, 0>*20
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Need Help jointing a leg for IK
Date: 26 Sep 2000 19:13:57
Message: <39D12D77.D981B5CE@hotmail.com>
Tor Olav Kristensen wrote:

> ...
> Is it something like the code below that you need ?
> ...

I was curious about how John VanSickle did his FindKnee
macro.

So I  had a look at it - and found that his is very similar to mine.

But I learned from his code that my test for correctness of the
ankle position relative to the hip position is not comprehensive
enough.

This part in my code:

#declare LegLength = LengthOfThigh + LengthOfShin;

#if (vlength(PositionOfAnkle - PositionOfpHip) > LegLength)
  #debug "\n\nError: The ankle is to far away from the hip.\n\n"
#end // if

should be replaced by this:

#declare Dist = vlength(PositionOfAnkle - PositionOfpHip);

#if (Dist > LengthOfThigh + LengthOfShin)
  #debug "\n\nError: The ankle is too far away from the hip.\n\n"
#end // if

#if (Dist < abs(LengthOfThigh - LengthOfShin))
  #debug "\n\nError: The ankle is too close to the hip.\n\n"
#end // if


Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

From: Rune
Subject: Re: Need Help jointing a leg for IK
Date: 27 Sep 2000 08:58:27
Message: <39d1eef3@news.povray.org>
"Tor Olav Kristensen" wrote:
>
> Is it something like the code below that you need ?
>
> It's not very advanced though.
> (It's "quick and dirty", but I hope it can give you some ideas.)

The limitation of your solution is that it only works if the leg is made of
just spheres and cylinders. (You can't even texture it.)

For a solution where any objects can be used, see the post I posted for H.
E. Day a few days ago in povray.binaries.scene-files

Greetings,

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated August 7)
/ Also visit http://www.povrayusers.org


Post a reply to this message

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