Functions | |
template<typename group_type , typename real_type > | |
size_t | evaluate_constraints (group_type &group, real_type const &fps, bool const &use_stabilization, bool const &use_friction, bool const &use_bounce, bool const &use_erp) |
template<typename group_type , typename idx_vector_type > | |
void | get_dependencies_vector (group_type const &group, size_t const &m, idx_vector_type &pi) |
template<typename group_type , typename vector_type > | |
void | get_factors_vector (group_type const &group, size_t const &m, vector_type &mu) |
template<typename group_type , typename matrix_type > | |
void | get_jacobian_matrix (group_type const &group, size_t const &m, matrix_type &J) |
template<typename group_type , typename vector_type > | |
void | get_limit_vectors (group_type const &group, size_t const &m, vector_type &lo, vector_type &hi) |
template<typename group_type , typename vector_type > | |
void | get_regularization_vector (group_type const &group, size_t const &m, vector_type &gamma) |
template<typename group_type , typename vector_type > | |
void | get_stabilization_vector (group_type const &group, size_t const &m, vector_type &b) |
size_t OpenTissue::mbd::detail::evaluate_constraints | ( | group_type & | group, | |
real_type const & | fps, | |||
bool const & | use_stabilization, | |||
bool const & | use_friction, | |||
bool const & | use_bounce, | |||
bool const & | use_erp | |||
) |
Evaluate Constraints. This method evaluates each constraint to determine whether is is active or not, and to set up any parameter values. Upon return the total number of active constraint variables (ie. number of rows in the jacobian) is returned.
fps | Frames per second. | |
use_stabilization | Boolean flag indicating whether stabiliation should be turned off or on. | |
use_friction | Boolean flag indicating whether friction should be turned off on all contact points in group. | |
use_bounce | Boolean flag indicating whether collision law should be turned off on all contact points in group (This makes all contacts completely inelastic). | |
use_erp |
void OpenTissue::mbd::detail::get_dependencies_vector | ( | group_type const & | group, | |
size_t const & | m, | |||
idx_vector_type & | pi | |||
) |
Get Dependencies Vector. For some variables their upper and lower founds are modelled as a linear dependency on some other variable.
That is for the $j$'th variable we might have
lo_j = -mu_j x_i hi_j = mu_j x_i
This method extract the index of the depedent variable. That is
pi_j = i
If the j'th entry stores the maximum possible value of the underlying data-type in the vector then it means that there are no dpendencies.
Further it is assumed that the vector library used provides a vector proxy function called subrange, which is capable of returning a vector range. (see for instance in Boost uBLAS for an example).
group | The group corresponding to the A-matrix. | |
m | The number of active constraints in the group (i.e. the number of rows in the Jacobian matrix). | |
dep | Upon return this vectors holds the indices of the dependent constraints. |
void OpenTissue::mbd::detail::get_factors_vector | ( | group_type const & | group, | |
size_t const & | m, | |||
vector_type & | mu | |||
) |
Get Factors Vector.
For some variables their upper and lower founds are modelled as a linear dependency on some other variable.
That is for the $j$'th variable we might have
lo_j = -mu_j x_i hi_j = mu_j x_i
This method extract the linear dependency factors mu_j
Further it is assumed that the vector library used provides a vector proxy function called subrange, which is capable of returning a vector range. (see for instance in Boost uBLAS for an example).
group | The group corresponding to the A-matrix. | |
m | The number of active constraints in the group (i.e. the number of rows in the Jacobian matrix). | |
mu | Upon return this vectors holds the values of the linear scaling factor of the dependent constraints. |
void OpenTissue::mbd::detail::get_jacobian_matrix | ( | group_type const & | group, | |
size_t const & | m, | |||
matrix_type & | J | |||
) |
Extract Jacobian. The evaluate_constraints() method is supposed to be invoked prior to this method.
Further it is assumed that the vector library used provides a vector proxy function called subrange, which is capable of returning a vector range. (see for instance in Boost uBLAS for an example).
group | The group corresponding to the A-matrix. | |
m | The number of active constraints in the group (i.e. the number of rows in the Jacobian matrix). | |
J | Upon return this argument holds the Jacobian Matrix. |
void OpenTissue::mbd::detail::get_limit_vectors | ( | group_type const & | group, | |
size_t const & | m, | |||
vector_type & | lo, | |||
vector_type & | hi | |||
) |
Get Constraint Limits.
Further it is assumed that the vector library used provides a vector proxy function called subrange, which is capable of returning a vector range. (see for instance in Boost uBLAS for an example).
group | The group corresponding to the A-matrix. | |
m | The number of active constraints in the group (i.e. the number of rows in the Jacobian matrix). | |
lo | Upon return this vectors holds the values of the lower constraint limit. Vector must have size m, where m is total number of jacobian rows. | |
hi | Upon return this vectors holds the values of the upper constraint limit. Vector must have size m, where m is total number of jacobian rows. |
void OpenTissue::mbd::detail::get_regularization_vector | ( | group_type const & | group, | |
size_t const & | m, | |||
vector_type & | gamma | |||
) |
Extract Initial Regularization (Damping) Terms. In our specific case we have A = J M^{-1} J^T and we want to alter A by adding positive values to the diagonal. That is:
A' = A + gamma I
This method determines a value of gamma by asking each constraint in the system what values the constraint would prefer.
This is termed constraint force mixing by the ODE community.
The evaluate_constraints() method is supposed to be invoked prior to this method.
Further it is assumed that the vector library used provides a vector proxy function called subrange, which is capable of returning a vector range. (see for instance in Boost uBLAS for an example).
group | The group corresponding to the A-matrix. | |
m | The number of active constraints in the group (i.e. the number of rows in the Jacobian matrix). | |
gamma | Upon return this vector holds the amount of damping for each constraint variable. |
void OpenTissue::mbd::detail::get_stabilization_vector | ( | group_type const & | group, | |
size_t const & | m, | |||
vector_type & | b | |||
) |
Get Stabilization Terms. The evaluate_constraints() method is supposed to be invoked prior to this function.
This function extracts a vector $ b_{text{stabilization}}$. This vector makes it possible to add extra terms to the b-vector in the linear relation
y = A x + b
Where $ y$ measures the relative velocities of the constraints, and vector x is a Lagrange multiplier vector. Thus, one have
b^{} = b + b_{text{stabilization}}
And the linear relation then becomes
y = A x + b^{}
The vector $ b_{text{stabilization}}$ can be used for constraint stabilization and bounce (simple Newton Impact type of law).
Observe that for constanct points the kind of terms added to the vector $ b_{text{stabilization}}$ dependes on the arguments given to the method evaluate_constraints.
Further it is assumed that the vector library used provides a vector proxy function called subrange, which is capable of returning a vector range. (see for instance in Boost uBLAS for an example).
group | The group corresponding to the A-matrix. | |
m | The number of active constraints in the group (i.e. the number of rows in the Jacobian matrix). | |
b | Upon return this vector holds a measuer of constraint error for each constraint variable. This vector can for instance be used for constraint stabilization. |