public final class RotationAxis
extends java.lang.Object
A superposition of two structures is generally represented as a rotation matrix plus a translation vector. However, it can also be represented as an axis of rotation plus some translation.
This class calculates the rotation axis and stores it as four properties:
getRotationAxis()
)
getAngle()
)
getRotationPos()
)
getScrewTranslation()
)
The axis of rotation is poorly defined and numerically unstable for small
angles. Therefore it's direction is left as null for angles less than
MIN_ANGLE
.
Constructor and Description |
---|
RotationAxis(AFPChain afpChain)
Calculate the rotation axis for the first block of an AFPChain
|
RotationAxis(Atom axis,
Atom pos,
double theta)
Create a rotation axis from a vector, a point, and an angle.
|
RotationAxis(Matrix rotation,
Atom translation)
Determine the location of the rotation axis based on a rotation matrix and a translation vector
|
Modifier and Type | Method and Description |
---|---|
double |
getAngle()
The rotation angle
|
static double |
getAngle(AFPChain afpChain)
Calculate the rotation angle for a structure
|
static double |
getAngle(Matrix rotation)
Calculate the rotation angle for a given matrix
|
Matrix |
getFullMatrix()
Returns a matrix that describes both rotation and translation.
|
java.lang.String |
getJmolScript(Atom[] atoms)
Returns a Jmol script which will display the axis of rotation.
|
Atom |
getOtherTranslation()
Deprecated.
|
double |
getProjectedDistance(Atom point)
Get the distance from a point to the axis of rotation
|
Atom |
getProjectedPoint(Atom point)
Projects a given point onto the axis of rotation
|
Atom |
getRotationAxis()
Get a unit vector along the rotation axis
|
Matrix |
getRotationMatrix()
Get the rotation matrix corresponding to this axis
|
Matrix |
getRotationMatrix(double theta)
Get the rotation matrix corresponding to a rotation about this axis
|
Atom |
getRotationPos()
Get a position on the rotation axis.
|
Atom |
getScrewTranslation()
Get the component of translation parallel to the axis of rotation
|
int |
guessOrderFromAngle(double threshold,
int maxOrder)
Returns the rotation order o that gives the lowest value of
|2PI / o - theta ,
given that the value is strictly lower than threshold , for orders o=1,...,maxOrder . |
boolean |
isDefined() |
void |
rotate(Atom[] atoms,
double theta) |
public RotationAxis(AFPChain afpChain) throws StructureException
afpChain
- StructureException
java.lang.NullPointerException
- if afpChain does not contain a valid rotation matrix and shift vectorpublic RotationAxis(Atom axis, Atom pos, double theta)
axis
- A vector parallel to the axis of rotationpos
- A point on the axis of rotationtheta
- The angle to rotate (radians)public double getAngle()
public Atom getRotationAxis()
public Atom getRotationPos()
public Atom getScrewTranslation()
@Deprecated public Atom getOtherTranslation()
public Matrix getRotationMatrix()
public Matrix getRotationMatrix(double theta)
theta
- The amount to rotatepublic int guessOrderFromAngle(double threshold, int maxOrder)
|2PI / o - theta
,
given that the value is strictly lower than threshold
, for orders o=1,...,maxOrder
.public Matrix getFullMatrix()
public java.lang.String getJmolScript(Atom[] atoms)
As the rotation angle gets smaller, the axis of rotation becomes poorly defined and would need to get farther and farther away from the protein. This is not particularly useful, so we arbitrarily draw it parallel to the translation and omit the arc.
atoms
- Some atoms from the protein, used for determining the bounds
of the axis.jmol.evalString()
public Atom getProjectedPoint(Atom point)
point
- public double getProjectedDistance(Atom point)
point
- public void rotate(Atom[] atoms, double theta)
public static double getAngle(AFPChain afpChain) throws StructureException
afpChain
- StructureException
- If the alignment doesn't contain any blocksjava.lang.NullPointerException
- If the alignment doesn't have a rotation matrix setpublic static double getAngle(Matrix rotation)
rotation
- Rotation matrixpublic boolean isDefined()