void aiXform::decompose(const Imath::M44d &mat, Imath::V3d &scale, Imath::V3d &shear, Imath::Quatd &rotation, Imath::V3d &translation) const
{
    Imath::M44d mat_remainder(mat);

    // Extract Scale, Shear
    Imath::extractAndRemoveScalingAndShear(mat_remainder, scale, shear, false);

    // Extract translation
    translation.x = mat_remainder[3][0];
    translation.y = mat_remainder[3][1];
    translation.z = mat_remainder[3][2];
    translation *= getConfig().scale_factor;

    // Extract rotation
    rotation = extractQuat(mat_remainder);
}
Exemple #2
0
const Matrix /* or null */ *GaussElimComputation::matrix_remainder(
    const Matrix *m)
{
  if (m->get_ring() != R)
    {
      ERROR("encountered different rings");
      return 0;
    }
  if (m->n_rows() != gens->rows()->rank())
    {
      ERROR("expected matrices to have same number of rows");
      return 0;
    }
  MatrixConstructor mat_remainder(m->rows(), m->cols(), m->degree_shift());
  for (int i = 0; i < m->n_cols(); i++)
    {
      vec f = R->copy_vec(m->elem(i));

      reduce(f);
      mat_remainder.set_column(i, f);
    }
  return mat_remainder.to_matrix();
}
Exemple #3
0
M2_bool GaussElimComputation::matrix_lift(
    const Matrix *m,
    const Matrix /* or null */ **result_remainder,
    const Matrix /* or null */ **result_quotient)
{
  if (m->get_ring() != R)
    {
      ERROR("encountered different rings");
      *result_remainder = 0;
      *result_quotient = 0;
      return false;
    }
  if (m->n_rows() != gens->rows()->rank())
    {
      ERROR("expected matrices to have same number of rows");
      *result_remainder = 0;
      *result_quotient = 0;
      return false;
    }
  MatrixConstructor mat_remainder(m->rows(), m->cols(), m->degree_shift());
  MatrixConstructor mat_quotient(Fsyz, m->cols(), 0);
  bool all_zeroes = true;
  for (int i = 0; i < m->n_cols(); i++)
    {
      vec f = R->copy_vec(m->elem(i));
      vec fsyz = NULL;

      reduce(f, fsyz);
      R->negate_vec_to(fsyz);
      if (f != 0) all_zeroes = false;
      mat_remainder.set_column(i, f);
      mat_quotient.set_column(i, fsyz);
    }
  *result_remainder = mat_remainder.to_matrix();
  *result_quotient = mat_quotient.to_matrix();
  return all_zeroes;
}