Class pmr.euclid.Point3Vector
All Packages Class Hierarchy This Package Previous Next Index
Class pmr.euclid.Point3Vector
java.lang.Object
|
+----java.util.Vector
|
+----pmr.euclid.EuclidVector
|
+----pmr.euclid.Point3Vector
- public class Point3Vector
- extends EuclidVector
Point3Vector - a (Java) Vector of Point3s. (Note that 'Vector' is
used by Java to describe an array of objects - there is no relationship
to geometrical vectors in this package.)
There are a large number of routines for manipulating 3-D coordinates.
Examples are distance, torsion, angle, planes, fitting, etc.
The routines have NOT been optimised. In the previous incarnation (C++)
all coordinates were handled by Point3s, etc because pointers are
fragile. In Java, however, a lot more intermediate information could
be passed through double[] arrays and this will be gradually converted.
All the routines compile and give answers. The answers were right in
the C++ version. Most seem to be right here, but the FITTING ROUTINES
ARE CURRENTLY NOT WORKING PROPERLY. This will be fixed...
Default is an empty (Java) Vector;
- Author:
- (C) P. Murray-Rust, 1996
-
Point3Vector()
-
-
Point3Vector(double[])
- Formed by feeding in an existing array to a 3xn matrix.
-
Point3Vector(int)
- create a Vector with given number of points
-
Point3Vector(int, double[], double[], double[])
- from three parallel arrays of x, y and z - by REFERENCE
-
Point3Vector(Point3Vector)
- copy constructor from Point3Vector COPIES pv
-
Point3Vector(RealArray)
- constructor from RealArray - by REFERENCE
-
addElement(Point3)
-
-
angle(int, int, int)
- get angle between 3 points
-
angle(IntSet)
- get angle between 3 points
-
bestPlane()
- get best plane
-
deviationsFromPlane(Plane3)
- get deviations of coordinates from plane
-
distance(int, int)
- get distance between 2 points
-
distance(IntSet)
- get distance between 2 points
-
fitTo(Point3Vector)
- fit two coordinates of same length and alignment
CURRENTLY NOT VALIDATED
-
getCentroid()
- get centroid of all points
-
getCoordinate(int, Choice3)
- get a single coordinate value
-
getDistanceMatrix()
- distance matrix
-
getLine(int, int)
- get the line between two points
-
getPoint3(int)
- get a single point by REFERENCE
-
getRange(Choice3)
- get range of one coordinate
-
getRange3()
- get range of all 3 coordinates
-
getXYZ()
- get the coordinate coordinate array as doubles x,y,z,x,y,z, ...
-
getXYZ(Choice3)
- get a single coordinate array - e.g.
-
inertialAxes(RealArray, RealSquareMatrix, IllConditionedMatrixException)
- get Inertial axes; do not throw exception for pathological cases,
but return it.
-
inertialTensor()
- get inertial tensor (second moments)
-
moveToCentroid()
- centre molecule on origin - translate to centroid MODIFIES PV
-
plus(Point3Vector)
- form the point+point sum for two vectors of points
-
plus(Vector3)
- translate by a vector - do NOT modify this
-
rms(Point3Vector)
- rms between two molecules - per atom
-
roughAlign(Point3Vector)
- fit two coordinates of same length and alignment - rough private method
fit this to ref (i.e.
-
setElementAt(Vector3, int)
- sets a given coordinate (i) to v.
-
subArray(IntSet)
- create a NEW subset of the points; points are COPIED
-
subtract(Point3Vector)
- form the point+point difference for two vectors of points
-
subtract(Vector3)
- translate negatively
-
torsion(int, int, int, int)
- get torsion angle between 4 points
-
torsion(IntSet)
- get torsion angle between 4 points
-
transform(Transform3)
- transform all coordinates MODIFIES Vector
-
transform(Transform3, IntSet)
- transform subset of coordinates - MODIFIES Vector
Point3Vector
public Point3Vector()
Point3Vector
public Point3Vector(int size)
- create a Vector with given number of points
Point3Vector
public Point3Vector(double flarray[]) throws InvalidArgumentException
- Formed by feeding in an existing array to a 3xn matrix.
flarray is in form (x, y, z, x, y, z ...)
- Throws: InvalidArgumentException
- size of flarray must be multiple of 3
Point3Vector
public Point3Vector(int n,
double x[],
double y[],
double z[])
- from three parallel arrays of x, y and z - by REFERENCE
Point3Vector
public Point3Vector(RealArray m) throws InvalidArgumentException
- constructor from RealArray - by REFERENCE
- Throws: InvalidArgumentException
- size of flarray must be multiple of 3
Point3Vector
public Point3Vector(Point3Vector pv)
- copy constructor from Point3Vector COPIES pv
addElement
public void addElement(Point3 p)
setElementAt
public void setElementAt(Vector3 v,
int i) throws ArrayIndexOutOfBoundsException
- sets a given coordinate (i) to v.
- Throws: ArrayIndexOutOfBoundsException
- i is >= number of current points (cann use this to increase size of Point3Vector)
getRange
public RealRange getRange(Choice3 ax)
- get range of one coordinate
getRange3
public Real3Range getRange3()
- get range of all 3 coordinates
subArray
public Point3Vector subArray(IntSet is) throws BadSubscriptException
- create a NEW subset of the points; points are COPIED
- Throws: BadSubscriptException
- an element of is is outside range of this
plus
public Point3Vector plus(Point3Vector pv2) throws UnequalLengthArraysException
- form the point+point sum for two vectors of points
- Throws: UnequalLengthArraysException
- pv2 is different size from this
subtract
public Point3Vector subtract(Point3Vector pv2) throws UnequalLengthArraysException
- form the point+point difference for two vectors of points
- Throws: UnequalLengthArraysException
- pv2 is different size from this
getLine
public Line3 getLine(int i1,
int i2)
- get the line between two points
getCentroid
public Point3 getCentroid()
- get centroid of all points
plus
public Point3Vector plus(Vector3 v)
- translate by a vector - do NOT modify this
subtract
public Point3Vector subtract(Vector3 v)
- translate negatively
moveToCentroid
public void moveToCentroid()
- centre molecule on origin - translate to centroid MODIFIES PV
inertialTensor
public RealSquareMatrix inertialTensor()
- get inertial tensor (second moments)
transform
public void transform(Transform3 t)
- transform all coordinates MODIFIES Vector
transform
public void transform(Transform3 t,
IntSet is)
- transform subset of coordinates - MODIFIES Vector
distance
public double distance(int i1,
int i2)
- get distance between 2 points
distance
public double distance(IntSet is) throws InvalidArgumentException
- get distance between 2 points
- Throws: InvalidArgumentException
- is must have exactly 2 points
angle
public Angle angle(int i1,
int i2,
int i3) throws ZeroLengthVectorException
- get angle between 3 points
- Throws: ZeroLengthVectorException
- two points are coincident or identical
angle
public Angle angle(IntSet is) throws InvalidArgumentException, ZeroLengthVectorException
- get angle between 3 points
- Throws: InvalidArgumentException
- is must have exactly 3 points
- Throws: ZeroLengthVectorException
- two points are coincident or identical
torsion
public Angle torsion(int i1,
int i2,
int i3,
int i4) throws ZeroLengthVectorException
- get torsion angle between 4 points
- Throws: ZeroLengthVectorException
- either 2 points are identical or coincident or 3 successive points are colinear
torsion
public Angle torsion(IntSet is) throws InvalidArgumentException, ZeroLengthVectorException
- get torsion angle between 4 points
- Throws: InvalidArgumentException
- is must have exactly 4 points
- Throws: ZeroLengthVectorException
- either 2 points are identical or coincident or 3 successive points are colinear
getDistanceMatrix
public RealSquareMatrix getDistanceMatrix()
- distance matrix
inertialAxes
public void inertialAxes(RealArray eigval,
RealSquareMatrix eigvect,
IllConditionedMatrixException illCond) throws ArrayTooSmallException
- get Inertial axes; do not throw exception for pathological cases,
but return it. Axes (lengths and unit vectors) are returned
through the arguments eigval and eigvect.
- Throws: ArrayTooSmallException
- must have at least 3 points
bestPlane
public Plane3 bestPlane() throws ArrayTooSmallException
- get best plane
- Throws: ArrayTooSmallException
- must have at least 3 points
deviationsFromPlane
public RealArray deviationsFromPlane(Plane3 p)
- get deviations of coordinates from plane
getPoint3
public Point3 getPoint3(int i)
- get a single point by REFERENCE
getXYZ
public RealArray getXYZ()
- get the coordinate coordinate array as doubles x,y,z,x,y,z, ...
getCoordinate
public double getCoordinate(int i,
Choice3 j)
- get a single coordinate value
getXYZ
public RealArray getXYZ(Choice3 axis)
- get a single coordinate array - e.g. all x-coordinates
rms
public double rms(Point3Vector c)
- rms between two molecules - per atom
roughAlign
public Transform3 roughAlign(Point3Vector ref) throws IllConditionedMatrixException, ArrayTooSmallException
- fit two coordinates of same length and alignment - rough private method
fit this to ref (i.e. 1 is moving molecule, 2 is fixed)
pick three points in molecule 2 which are well separated (use best plane
projection). Find the plane of these three and use the normal, together
with one of the points, to define two coordinate axes. Do the same for
the other molecule and fit the two sets of axes. This is rough, but
will be a good starting point for most molecules.
CURRENTLY NOT VALIDATED (i.e. broken)
- Throws: IllConditionedMatrixException
- some unusual geometry (e.g. one coordinate set is linear, has coincident points, etc.)
- Throws: ArrayTooSmallException
- must have at least 3 points
fitTo
public Transform3 fitTo(Point3Vector ref) throws ArrayTooSmallException, IllConditionedMatrixException
- fit two coordinates of same length and alignment
CURRENTLY NOT VALIDATED
- Throws: IllConditionedMatrixException
- some unusual geometry (e.g. one coordinate set is linear, has coincident points, etc.)
- Throws: ArrayTooSmallException
- must have at least 3 points
All Packages Class Hierarchy This Package Previous Next Index