RyanJuckett.com

Analytic Two-Bone IK in 2D - Describing the problem with math Print E-mail
  
Monday, 29 December 2008 07:46
Article Index
Analytic Two-Bone IK in 2D
Defining the problem
The solvable domain
Math review
Describing the problem with math
Solving for angle 2
Solving for angle 1
Writing the code
All Pages

 

Describing the problem with math

To solve the problem, we need to write it out in equation form. Our unknown variables are \theta_1 and \theta_2. Our known variables are d_1, d_2, x and y. We are going to create two equations that define x and y in terms of the two bones.

 

Based on the right triangle ratios for \sin\theta and cos\theta, we can use the following equations to extract the adjacent and opposite sides of a right triangle.

 

\mathrm{opposite} = (\sin \theta) ( \mathrm{hypotenuse} )

\mathrm{adjacent} = (\cos \theta) ( \mathrm{hypotenuse} )

fig_3

figure 3

 

By breaking the problem into a couple right triangles as seen in figure 3, we can now define x as a sum of the adjacent sides and y as a sum of opposite sides.

 

x = d_1 \cos \theta_1 + d_2 \cos(\theta_1 + \theta_2)

y = d_1 \sin \theta_1 + d_2 \sin(\theta_1 + \theta_2)



Last Updated ( Sunday, 02 May 2010 06:32 )
 

Creative Commons License
RyanJuckett.com site content by Ryan Juckett is licensed under a Creative Commons Attribution 3.0 United States License.