View Full Version : Math of Pole Vector Position .. please give me the clue
forumg 01 January 2009, 06:19 AM Hi all!
I have a question about place of pole vector in mathematical way. Consider the arm, Shoulder, elbow and wrist, they make three points thus a plane, and pole vector (constraints place) must also lie in this plane right?
Can I find a good location by imagining a line that is perpendicular to the ik handle's line, which also goes through the elbow, and intersect with pole vector (constraints position).
In short I actually want to learn the math behind pole vector position. Any directions will be great.
Thanks!
g.


Mydrako
01 January 2009, 02:55 PM
i am not sure of the math behind the IK solution, but basically the pole vector need to line in the same plane as the 3 joints. To find a arbitrary position for the pole vector :
midpoint of A and C (MP) = (OA + OC) / 2
Pole Vector Position = MP + t ( OC  MP) where t is any number, more than 1 preferably so that the pole vector lie on the other side.
Hope this solve ur problem.
tonytouch
01 January 2009, 03:57 PM
here is how i find my "position in plane" :
 create a nurbsPlane
 select hipJoint and ankleJoint and pointConstraint the plane ( no "maintain Offset" )  now the plane is in the middle between startJoint and endEffector of your IKsystem
 select kneeJoint and nurbsPlane + aimConstraint ( use the ankleJoint or the hipJoint as upObject ) = now the nurbsPlane is "planar to the joints"
 select nurbsPlane and the knee_Control and do a geometryConstraint ( now the kneeCtrl is in the exact place )
 delete geometryConstraint and zero the rotation of the knee_Control
ShadowM8
01 January 2009, 07:41 PM
Well you are trying to go about this in a bit of a backwards way. The IK solution has a pole vector (either given by you as a numerical input or pointing to a 3d object in space) and then fits the resolution plane accordingly.
It seems like what you want to do is find a point that is on the resolution plane and can be a pole vector for an IK solution. If that’s the case then you can consider the pose of the shoulder joint to represent the resolution plane. Define a vector in local space of the shoulder joint that is far enough on that plane that the elbow will not intersect. For example if length of the upper arm is 10 then have the pole vector be [10, 20, 0] (it would be 0 along whichever axis is the plane normal) Then you need to get this position in global space so create a matrix with that position and multiply it by the inverse of the shoulder joint world matrix.
That should give you a possible position of a pole vector valid for that resolution plane.
abahena
01 January 2009, 08:03 PM
Check that script it will give you a clue.
http://www.highend3d.com/maya/downloads/mel_scripts/animation/getPoleVectorzerorotationonIKjoints4343.html
But if you want to learn the math behind and ik system you can check this pdf.
http://diegopark.googlepages.com/computerGraphics.pdf
forumg
01 January 2009, 04:19 AM
Thanks for all answers guys!
It seems like what you want to do is find a point that is on the resolution plane and can be a pole vector for an IK solution. If that’s the case then you can consider the pose of the shoulder joint to represent the resolution plane. Define a vector in local space of the shoulder joint that is far enough on that plane that the elbow will not intersect. For example if length of the upper arm is 10 then have the pole vector be [10, 20, 0] (it would be 0 along whichever axis is the plane normal) Then you need to get this position in global space so create a matrix with that position and multiply it by the inverse of the shoulder joint world matrix.
ShadowM8 you are right. :hmm: But I couldn't really understand how can I consider the pose of shoulder as a plane. I mean it is just one point, how can I determine a plane from just one point. Sorry if this is a easy thing, I will be glad if you tell me more..
(I am actually trying to make a seamless ik/fk arm using only ONE chain. As you can guess problem occurs while switching from fk to ik. I need to find a correct position for PV control, so arm will remain in the same position while switching from fk to ik.
So, If I can understand what you are telling, it will also solve the future problem for me, which is the position where all three arm joints lies on the same line.)
Thanks again!
g.
eek
01 January 2009, 05:15 PM
What you basically want to do is fire a vector somewhere between the shoulderwrist and the elbow.
We can use projection in the form of a dot product to find our magnitude down the vector shoulderwrist.
shoulderVector = normalize (elbow.pos  shoulder.pos)
wristVector = (wrist.pos  shoulder.pos)
normalize (Wrist.pos  Shoulder.pos) * (dot shoulderVector wristVector) + shoulder.pos
This will give you the vector between the shoulder and wrist, you use taken away from the the elbow pos to get you final direction.
You can also normalize the lengths of the joints shoulder/elbow into a range of one e.g 10, 10 = 0.5 ,0.5 then either do linear interpolation between the shoulderwrist using one of these values. Or sum the lengths together and use one of the normalize values as a magitude for it from the shoulder wrist direction e.g
10 + 20 = 30
10 / (10 + 20) = .33
m = 30 * .33
norm(Shoulder.pos  Wrist.pos) * m + shoulder.pos
Theres more methods using trig too, by getting the angles of the sides, then splitting the angle at the elbow and using it along with a right angle and the shoulder or wrist angle to get the length exactly between the shoulder and wrist.
Mydrako
01 January 2009, 03:38 AM
Nice use of math to solve this problem. Show how important math is in our field. :) Time to brush the dust off my linear algebra textbook ...
On a side note, if you dont want to use all the math, you can just parent a null which is in the same original position as the PV to the FK arm (shoulder joint), you can then just snap your IK PV to that null and the PV will always be in the correct position.
ShadowM8
01 January 2009, 07:21 AM
ShadowM8 you are right. :hmm: But I couldn't really understand how can I consider the pose of shoulder as a plane. I mean it is just one point, how can I determine a plane from just one point. Sorry if this is a easy thing, I will be glad if you tell me more..
Well your forearm is child of the shoulder and has a single degree of freedom rotating most commonly around Z axis, thus always keeping the wrist on the resolution plane. Therefore the pose of the shoulder is the plane you want to keep your wrist and elbow on.
So for an IK/FK switch I would usually have a reference locator for the up vector parented to my FK shoulder. That said if you want to be able to break the resolution plane while working in FK (for cartoon character for example) and still want the IK to snap to that exact pose than a more elaborate setup is needed for the IK that includes a breakable elbow joint.
I've attached an image that should illustrate what I mean. The plane is parented to the shoulder and the box locator illustrates the possible placement of the up vector.
forumg
01 January 2009, 09:21 AM
wow, thank you!!
eek your explanations makes it all clear now, I didn't tried yet, but at least now I have a clear idea how can I do that math.
ShadowM8 a big thank you goes to you too.. character I am playing with now is not cartoonish but still I will keep in mind breaking the joints for future. and thanks for the image.
And thanks for the other solution also Mydrako
I guess these will solve my problem.. but still I 'll let you guys know if I stuck again :)
probably I will be thanking you all day..
cheers!
g.
CGTalk Moderation
01 January 2009, 09:21 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.