src/FABRIKSolver.cpp
FABRIKSolver::FABRIKSolver()
   : mNumIterations(15)
   , mConvergenceThreshold(0.00001f)
{

}
// Forward and Backward Reaching Inverse Kinematics (FABRIK) is an algorithm that can be used to pose a chain of joints so that the last joint of the chain
// comes as close as possible to touching a target
// The three important concepts of FABRIK are:
// - The goal, which is the point in space that we are trying to touch
// - The IK chain, which is a list of all the joints that will need to rotate to reach the goal
// - The end effector, which is the last joint in the chain
// One iteration of the FABRIK algorithm looks like this in pseudocode:
// - Backward iteration
//   - Move the end effector to where the goal is
//   - Calculate a vector that goes from the joint that comes before the end effector to the end effector
//   - Move the joint that comes before the end effector along the vector from the previous step, maintaining its original distance to the end effector
//   - Repeat the previous steps with each sequential pair of joints until the root is reached. This will move the root out of its original position
// - Forward iteration
//   - Move the root back to its original position
//   - Calculate a vector that goes from the joint that comes after the root to the root
//   - Move the joint that comes after the root along the vector from the previous step, maintaining its original distance to root
//   - Repeat the previous steps with each sequential pair of joints until the end effector is reached.
// By doing backward and forward iterations many times, the algorithm may or may not achieve convergence
Forward and Backward Reaching Inverse Kinematics (FABRIK) is an algorithm that can be used to pose a chain of joints so that the last joint of the chain
comes as close as possible to touching a target
The three important concepts of FABRIK are:
The goal, which is the point in space that we are trying to touch
The IK chain, which is a list of all the joints that will need to rotate to reach the goal
The end effector, which is the last joint in the chain
One iteration of the FABRIK algorithm looks like this in pseudocode:
Backward iteration
Move the end effector to where the goal is
Calculate a vector that goes from the joint that comes before the end effector to the end effector
Move the joint that comes before the end effector along the vector from the previous step, maintaining its original distance to the end effector
Repeat the previous steps with each sequential pair of joints until the root is reached. This will move the root out of its original position
Forward iteration
Move the root back to its original position
Calculate a vector that goes from the joint that comes after the root to the root
Move the joint that comes after the root along the vector from the previous step, maintaining its original distance to root
Repeat the previous steps with each sequential pair of joints until the end effector is reached.
By doing backward and forward iterations many times, the algorithm may or may not achieve convergence
Forward and Backward Reaching Inverse Kinematics ( FABRIK ) is an algorithm that can be used to pose a chain of joints so that the last joint of the chain comes as close as possible to touching a target The three important concepts of FABRIK are : The goal which is the point in space that we are trying to touch The IK chain which is a list of all the joints that will need to rotate to reach the goal The end effector which is the last joint in the chain One iteration of the FABRIK algorithm looks like this in pseudocode : Backward iteration Move the end effector to where the goal is Calculate a vector that goes from the joint that comes before the end effector to the end effector Move the joint that comes before the end effector along the vector from the previous step maintaining its original distance to the end effector Repeat the previous steps with each sequential pair of joints until the root is reached . This will move the root out of its original position Forward iteration Move the root back to its original position Calculate a vector that goes from the joint that comes after the root to the root Move the joint that comes after the root along the vector from the previous step maintaining its original distance to root Repeat the previous steps with each sequential pair of joints until the end effector is reached . By doing backward and forward iterations many times the algorithm may or may not achieve convergence
FABRIKSolver::FABRIKSolver()
   : mNumIterations(15)
   , mConvergenceThreshold(0.00001f)
{
}
FABRIKSolver :: FABRIKSolver ( ) : mNumIterations ( 15 ) , mConvergenceThreshold ( 0.00001f ) { }
Forward and Backward Reaching Inverse Kinematics (FABRIK) is an algorithm that can be used to pose a chain of joints so that the last joint of the chain
comes as close as possible to touching a target
The three important concepts of FABRIK are:
 The goal, which is the point in space that we are trying to touch
 The IK chain, which is a list of all the joints that will need to rotate to reach the goal
 The end effector, which is the last joint in the chain
One iteration of the FABRIK algorithm looks like this in pseudocode:
 Backward iteration
 Move the end effector to where the goal is
 Calculate a vector that goes from the joint that comes before the end effector to the end effector
 Move the joint that comes before the end effector along the vector from the previous step, maintaining its original distance to the end effector
 Repeat the previous steps with each sequential pair of joints until the root is reached.
Forward and Backward Reaching Inverse Kinematics ( FABRIK ) is an algorithm that can be used to pose a chain of joints so that the last joint of the chain comes as close as possible to touching a target The three important concepts of FABRIK are : The goal which is the point in space that we are trying to touch The IK chain which is a list of all the joints that will need to rotate to reach the goal The end effector which is the last joint in the chain One iteration of the FABRIK algorithm looks like this in pseudocode : Backward iteration Move the end effector to where the goal is Calculate a vector that goes from the joint that comes before the end effector to the end effector Move the joint that comes before the end effector along the vector from the previous step maintaining its original distance to the end effector Repeat the previous steps with each sequential pair of joints until the root is reached .