|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.sdsc.mbt.util.Algebra
This class provides a number of algebreic methods for computing various distances and angles between 3D virtex coordinates (double[3]).
Bond
,
BondFactory
Field Summary | |
static int |
X_AXIS
|
static int |
Y_AXIS
|
static int |
Z_AXIS
|
Constructor Summary | |
Algebra()
|
Method Summary | |
static double |
angle(double[] v1,
double[] v2,
double[] v3)
Calculate the angle formed by three virtex coordinates. |
static void |
angleAxisRotate(double[] angleAxis,
double[] point)
Rotate the point by the given angle-axis {angle,x,y,z} rotation vector. |
static double[] |
crossProduct(double[] v1,
double[] v2)
|
static void |
crossProduct(double[] v1,
double[] v2,
double[] result)
Compute the vector cross product between v1 and v2 storing the output in result. |
static void |
crossProduct(float[] v1,
float[] v2,
float[] result)
|
static double |
dihedralAngle(double[] v1,
double[] v2,
double[] v3,
double[] v4)
Calculate the dihedral angle defined by four virtex coordinates. |
static double |
distance(double[] v1,
double[] v2)
Compute the distance between two virtex coordinates. |
static double |
distance(Vec3d v1,
Vec3d v2)
Compute the distance between coordinates using double values |
static float |
distance(Vec3f v1,
Vec3f v2)
Compute the distance between coordinates using float values |
static double |
dotProduct(double[] v1,
double[] v2)
Return the vector dot product between v1 and v2. |
static float |
dotProduct(float[] v1,
float[] v2)
|
static double |
getAngle(Vec3d v2,
Vec3d v1,
Vec3d v3)
Calculates the angle formed by the three points. |
static double |
getAngleBetweenVectors(double[] a,
double[] b)
|
static Vec3d |
getAtomCoordinates(Atom atom)
Returns coordinates of the given Atom in 3d space. |
static double |
getDihedralAngle(Vec3d v3,
Vec3d v1,
Vec3d v2,
Vec3d v4)
Calculates the dihedral angle defined by four points |
static double[][] |
getInverseMatrix(double[][] a)
|
static double[] |
getNormalizedVector(double[] inVector)
|
static double[] |
getNormalizedVector(double[] start,
double[] end)
|
static double[] |
getReverseVector(double[] vector)
|
static double[] |
getVector(double[] start,
double[] end)
|
static double[] |
getVectorDifference(double[] vector1,
double[] vector2)
subtract function |
static double[] |
getVectorSum(double[] vector1,
double[] vector2)
|
static double[] |
getViewPoint(double[] target,
double distance)
Calculate the position of the view point on Z axis, given the center of the viewed structure and the required distance |
static void |
main(java.lang.String[] args)
|
static void |
matrixRotate(double[] matrix,
double[] point)
Rotate the point by the given 16-element rotation matrix. |
static Vec3d |
midpoint(Vec3d a,
Vec3d b)
Compute the midpoint between two points. |
static double[] |
multiplyMatrices(double[][] a,
double[][] b)
|
static double[] |
multiplySquareMatrices(double[] a,
double[] b)
Calculate a product of two matrices and return the result |
static void |
normalizeVector(double[] vector)
Compute the normalized vector in place. |
static void |
normalizeVector(double[] inVector,
double[] outVector)
Compute the normalized inVector storing the result in outVector. |
static void |
normalizeVector(float[] vector)
|
static void |
normalizeVector(float[] inVector,
float[] outVector)
|
static void |
orthogonalize(float[] vector1,
float[] vector2)
Orthogonalize one vector to another. |
static void |
reverseVector(double[] vector)
|
static void |
rotationToMatrix(double[] rotation,
double[] matrix)
Convert the angle-axis {angle,x,y,z} rotation vector to a 16-element rotation matrix. |
static void |
scalarMultiply(double[] vector,
double scalar)
Multiply a vector times a scalar. |
static void |
scalarMultiply(float[] vector,
float scalar)
Multiply a vector times a scalar. |
static void |
setVectorLength(double[] vector,
double length)
|
static double[] |
solveSystemOfEquations(double[] system)
This method solves a system of three equations with three unknowns and returns an array of x,y,z values |
static void |
subtractVectors(double[] vector1,
double[] vector2)
Subtract one vector from another. |
static void |
subtractVectors(float[] vector1,
float[] vector2)
Subtract one vector from another. |
static double |
vectorLength(double[] vector)
Return the cartesian length of the vector. |
static float |
vectorLength(float[] vector)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int X_AXIS
public static final int Y_AXIS
public static final int Z_AXIS
Constructor Detail |
public Algebra()
Method Detail |
public static double distance(double[] v1, double[] v2)
v1--v2
v1
- First virtex coordinate as double[3].v2
- Second virtex coordinate as double[3].
public static double angle(double[] v1, double[] v2, double[] v3)
v1 v3 \ / v2
v1
- An end virtex coordinate as double[3].v2
- The middle virtex coordinate as double[3].v3
- An end virtex coordinate as double[3].
public static double dihedralAngle(double[] v1, double[] v2, double[] v3, double[] v4)
v1 v4 \ / v2--v3
v1
- An end virtex coordinate as double[3].v2
- An interior virtex coordinate as double[3].v3
- An interior virtex coordinate as double[3].v4
- An end virtex coordinate as double[3].
public static Vec3d midpoint(Vec3d a, Vec3d b)
public static double distance(Vec3d v1, Vec3d v2)
public static float distance(Vec3f v1, Vec3f v2)
public static Vec3d getAtomCoordinates(Atom atom)
atom
-
public static double getAngle(Vec3d v2, Vec3d v1, Vec3d v3)
v2
- coordinates of the middle pointv1
- coordinates of an end pointv3
- coordinates of an end point
public static double getDihedralAngle(Vec3d v3, Vec3d v1, Vec3d v2, Vec3d v4)
v3
- coordinates of an end pointv1
- coordinates of the second point in the sequencev2
- coordinates of the third pointv4
- coordinates of the other end point
public static void crossProduct(double[] v1, double[] v2, double[] result)
v1
- First vector argument.v2
- Second vector argument.result
- The vector in which the result will be stored.public static void crossProduct(float[] v1, float[] v2, float[] result)
public static double[] crossProduct(double[] v1, double[] v2)
public static double dotProduct(double[] v1, double[] v2)
v1
- First vector argument.v2
- Second vector argument.
public static float dotProduct(float[] v1, float[] v2)
public static void normalizeVector(double[] inVector, double[] outVector)
inVector
- The input vector argument.outVector
- The output vector.public static double[] getNormalizedVector(double[] inVector)
public static void normalizeVector(double[] vector)
vector
- The vector to be normalized in-place.public static void normalizeVector(float[] vector)
public static void normalizeVector(float[] inVector, float[] outVector)
public static float vectorLength(float[] vector)
public static double vectorLength(double[] vector)
vector
- The input vector.
public static void reverseVector(double[] vector)
public static double[] getReverseVector(double[] vector)
public static void setVectorLength(double[] vector, double length)
public static void angleAxisRotate(double[] angleAxis, double[] point)
angleAxis
- The angle-axis rotation vector.point
- The point to be rotated in-place.public static void matrixRotate(double[] matrix, double[] point)
matrix
- The 16-element rotation matrix.point
- The point to be rotated in-place.public static void rotationToMatrix(double[] rotation, double[] matrix)
rotation
- The angle-axis rotation vector.matrix
- The resulting 16-element rotation matrix.public static double[] getViewPoint(double[] target, double distance)
target
- distance
-
public static double[] multiplyMatrices(double[][] a, double[][] b)
public static double[] multiplySquareMatrices(double[] a, double[] b)
public static double[] solveSystemOfEquations(double[] system)
system
- linear array of all 12 constituents: a1, b1, c1, d1, a2, b2.. etc
public static double getAngleBetweenVectors(double[] a, double[] b)
public static double[] getVector(double[] start, double[] end)
public static double[] getNormalizedVector(double[] start, double[] end)
public static void main(java.lang.String[] args)
public static double[][] getInverseMatrix(double[][] a)
public static void scalarMultiply(float[] vector, float scalar)
vector
- The vector to be scaled in-place.public static void scalarMultiply(double[] vector, double scalar)
vector
- The vector to be scaled in-place.public static void orthogonalize(float[] vector1, float[] vector2)
vector1
- The vector to be orthogonalized.vector2
- The reference vector for orthogonalization.
java.lang.NullPointerException
- for null vector.
java.lang.IllegalArgumentException
- for zero vector.public static void subtractVectors(double[] vector1, double[] vector2)
vector1
- The vector to be modified.vector2
- The vector to subtract.public static void subtractVectors(float[] vector1, float[] vector2)
vector1
- The vector to be modified.vector2
- The vector to subtract.public static double[] getVectorDifference(double[] vector1, double[] vector2)
vector1
- vector2
-
public static double[] getVectorSum(double[] vector1, double[] vector2)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |