Math Help needed: Polevector for Ik System

Blitz3D Forums/Blitz3D Programming/Math Help needed: Polevector for Ik System

Danny(Posted 2005) [#1]
I'm crap at trigonometry and have been trying to figure this one out for weeks.


(For those more familiar with character animation,
I've got the basic maths working for an Inverse Kinematics system for Blitz,
but I can't seem to figure out the maths for a pole-vector).


I have 3 pivot entities P1, P2 and P3 in 3d space.
These pivots are not connected, and could be anywhere basically :)
These three pivots create an imaginary plane in 3d space (see blue rectangles in image).

I then have 2 entities, let's say two cylinders, that have a FIXED length (see the yellow & magenta lines).
The yellow one has a fixed length of 0.5, and is anchored at Pivot1
The Magenta one has a fixed length of 0.7 and is anchored at Pivot3

What I'm trying to do is to 'reconstruct' the triangle P1-P4-P3, that is within the plane/space of the 2d blue rectangle (that's oriented in whatever angle in 3D).

So I need to know either the XYZ coordinate of P4 (the green dot) OR the Pitch/Yaw/Roll angles of the yellow / magenta cylinders.

In the image you'll see two situation where the 'imaginary plane' created by p1,p2 and p3 is of a different size & orientation in 3d. But the yellow and magenta lines still have the same exact length.

I hope this makes sense and is in any way clear. I'm working on an IK Animation system and got pretty far with procedural animation, but I need to solve this problem to be able to control a character's elbows for arm-animations and to control their knees / leg orientation for leg-animations like a walk, jump, crouch or run cycle.

Any help would be GREATLY appreciated!

Thanks,
Danny


BlackJumper(Posted 2005) [#2]
This might get you started...

4 Coplanar points
| x1  y1  z1  1|
| x2  y2  z2  1|
| x3  y3  z3  1| = 0
| x4  y4  z4  1|


Since you know that the vectors for P1 + Y = P4 and simultaneously P3 + M = P4 you can equate these and (I think) solve for the x,y,z of P4.

Here Y is the vector representing the Yellow line and M is the vector for the Magenta line.

the above matrix becomes
| x1      y1     z1     1|
| x2      y2     z2     1|
| x3      y3     z3     1| = 0
| x1+Yx   y1+Yy  z1+Yz  1|

and

| x1      y1     z1     1|
| x2      y2     z2     1|
| x3      y3     z3     1| = 0
| x3+Mx   y3+My  z3+Mz  1|


so... uh... now you need to do the math for the cross and dot products to calculate the determinant.


... this might help Determinant Expansion by Minors

My head hurts now... and I'm not sure if all that is doable :-)


markcw(Posted 2005) [#3]
would i sound really stupid if i said:

can you not just put an entity at the end
of one pivot, return its xyz position,
thus getting P4?


Jeppe Nielsen(Posted 2005) [#4]
This does what you need, I think:

Just use the PoleVector() function:





Danny(Posted 2005) [#5]
Thanks guys!
I'll need some time to digest all this. I'm pretty close to solving it, and hoping I can post a working character IK solution soon...

And cheers for that Code Jeppe! You even got the colors right ;)

l8r-
Danny