public final class RotationAxis extends 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(javax.vecmath.Matrix4d transform)
Create a rotation axis from a Matrix4d containing a rotational
component and a translational component.
|
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
|
static double |
getAngle(javax.vecmath.Matrix3d transform)
Quickly compute the rotation angle from a rotation matrix.
|
static double |
getAngle(javax.vecmath.Matrix4d transform)
Quickly compute the rotation angle from a rotation matrix.
|
javax.vecmath.AxisAngle4d |
getAxisAngle4d()
Returns the rotation axis and angle in a single javax.vecmath.AxisAngle4d object
|
Pair<Atom> |
getAxisEnds(Atom[] atoms)
Find a segment of the axis that covers the specified set of atoms.
|
Matrix |
getFullMatrix()
Returns a matrix that describes both rotation and translation.
|
String |
getJmolScript(Atom[] atoms)
Returns a Jmol script which will display the axis of rotation.
|
String |
getJmolScript(Atom[] atoms,
int axisID)
Returns a Jmol script which will display the axis of rotation.
|
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
|
double |
getTranslation() |
javax.vecmath.Vector3d |
getVector3dScrewTranslation() |
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 {@code o=1,... |
boolean |
isDefined() |
void |
rotate(Atom[] atoms,
double theta) |
public RotationAxis(AFPChain afpChain) throws StructureException
afpChain
- StructureException
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 RotationAxis(Matrix rotation, Atom translation)
rotation
- translation
- public RotationAxis(javax.vecmath.Matrix4d transform)
transform
- public double getAngle()
public Atom getRotationAxis()
public javax.vecmath.AxisAngle4d getAxisAngle4d()
public Atom getRotationPos()
public Atom getScrewTranslation()
public javax.vecmath.Vector3d getVector3dScrewTranslation()
public double getTranslation()
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 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 Pair<Atom> getAxisEnds(Atom[] atoms)
Projects the input atoms onto the rotation axis and returns the bounding points.
In the case of a pure translational axis, the axis location is undefined so the center of mass will be used instead.
atoms
- public String getJmolScript(Atom[] atoms, int axisID)
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.axisID
- in case of representing more than one axis in the same jmol
panel, indicate the ID number.jmol.evalString()
public Atom getProjectedPoint(Atom point)
point
- public double getProjectedDistance(Atom point)
point
- public static double getAngle(AFPChain afpChain) throws StructureException
afpChain
- StructureException
- If the alignment doesn't contain any blocksNullPointerException
- If the alignment doesn't have a rotation matrix setpublic static double getAngle(Matrix rotation)
rotation
- Rotation matrixpublic boolean isDefined()
public static double getAngle(javax.vecmath.Matrix4d transform)
transform
- 4D transformation matrix. Translation components are ignored.public static double getAngle(javax.vecmath.Matrix3d transform)
transform
- 3D rotation matrixCopyright © 2000–2019 BioJava. All rights reserved.