git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15369 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2016-07-27 14:04:56 +00:00
parent 8c04540e8a
commit ddd85f006c
17 changed files with 527 additions and 389 deletions

View File

@ -607,6 +607,51 @@ void inertia_triangle(double *idiag, double *quat, double mass,
inertia[5] = tensor[0][1];
}
/* ----------------------------------------------------------------------
Build rotation matrix for a small angle rotation around the X axis
------------------------------------------------------------------------- */
void BuildRxMatrix(double R[3][3], const double angle)
{
const double angleSq = angle * angle;
const double cosAngle = (1.0 - angleSq * 0.25) / (1.0 + angleSq * 0.25);
const double sinAngle = angle / (1.0 + angleSq * 0.25);
R[0][0] = 1.0; R[0][1] = 0.0; R[0][2] = 0.0;
R[1][0] = 0.0; R[1][1] = cosAngle; R[1][2] = -sinAngle;
R[2][0] = 0.0; R[2][1] = sinAngle; R[2][2] = cosAngle;
}
/* ----------------------------------------------------------------------
Build rotation matrix for a small angle rotation around the Y axis
------------------------------------------------------------------------- */
void BuildRyMatrix(double R[3][3], const double angle)
{
const double angleSq = angle * angle;
const double cosAngle = (1.0 - angleSq * 0.25) / (1.0 + angleSq * 0.25);
const double sinAngle = angle / (1.0 + angleSq * 0.25);
R[0][0] = cosAngle; R[0][1] = 0.0; R[0][2] = sinAngle;
R[1][0] = 0.0; R[1][1] = 1.0; R[1][2] = 0.0;
R[2][0] = -sinAngle; R[2][1] = 0.0; R[2][2] = cosAngle;
}
/* ----------------------------------------------------------------------
Build rotation matrix for a small angle rotation around the Y axis
------------------------------------------------------------------------- */
void BuildRzMatrix(double R[3][3], const double angle)
{
const double angleSq = angle * angle;
const double cosAngle = (1.0 - angleSq * 0.25) / (1.0 + angleSq * 0.25);
const double sinAngle = angle / (1.0 + angleSq * 0.25);
R[0][0] = cosAngle; R[0][1] = -sinAngle; R[0][2] = 0.0;
R[1][0] = sinAngle; R[1][1] = cosAngle; R[1][2] = 0.0;
R[2][0] = 0.0; R[2][1] = 0.0; R[2][2] = 1.0;
}
/* ---------------------------------------------------------------------- */
}