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

Constructor Index

 o Point3Vector()
 o Point3Vector(double[])
Formed by feeding in an existing array to a 3xn matrix.
 o Point3Vector(int)
create a Vector with given number of points
 o Point3Vector(int, double[], double[], double[])
from three parallel arrays of x, y and z - by REFERENCE
 o Point3Vector(Point3Vector)
copy constructor from Point3Vector COPIES pv
 o Point3Vector(RealArray)
constructor from RealArray - by REFERENCE

Method Index

 o addElement(Point3)
 o angle(int, int, int)
get angle between 3 points
 o angle(IntSet)
get angle between 3 points
 o bestPlane()
get best plane
 o deviationsFromPlane(Plane3)
get deviations of coordinates from plane
 o distance(int, int)
get distance between 2 points
 o distance(IntSet)
get distance between 2 points
 o fitTo(Point3Vector)
fit two coordinates of same length and alignment CURRENTLY NOT VALIDATED
 o getCentroid()
get centroid of all points
 o getCoordinate(int, Choice3)
get a single coordinate value
 o getDistanceMatrix()
distance matrix
 o getLine(int, int)
get the line between two points
 o getPoint3(int)
get a single point by REFERENCE
 o getRange(Choice3)
get range of one coordinate
 o getRange3()
get range of all 3 coordinates
 o getXYZ()
get the coordinate coordinate array as doubles x,y,z,x,y,z, ...
 o getXYZ(Choice3)
get a single coordinate array - e.g.
 o inertialAxes(RealArray, RealSquareMatrix, IllConditionedMatrixException)
get Inertial axes; do not throw exception for pathological cases, but return it.
 o inertialTensor()
get inertial tensor (second moments)
 o moveToCentroid()
centre molecule on origin - translate to centroid MODIFIES PV
 o plus(Point3Vector)
form the point+point sum for two vectors of points
 o plus(Vector3)
translate by a vector - do NOT modify this
 o rms(Point3Vector)
rms between two molecules - per atom
 o roughAlign(Point3Vector)
fit two coordinates of same length and alignment - rough private method fit this to ref (i.e.
 o setElementAt(Vector3, int)
sets a given coordinate (i) to v.
 o subArray(IntSet)
create a NEW subset of the points; points are COPIED
 o subtract(Point3Vector)
form the point+point difference for two vectors of points
 o subtract(Vector3)
translate negatively
 o torsion(int, int, int, int)
get torsion angle between 4 points
 o torsion(IntSet)
get torsion angle between 4 points
 o transform(Transform3)
transform all coordinates MODIFIES Vector
 o transform(Transform3, IntSet)
transform subset of coordinates - MODIFIES Vector

Constructors

 o Point3Vector
  public Point3Vector()
 o Point3Vector
  public Point3Vector(int size)
create a Vector with given number of points
 o 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
 o Point3Vector
  public Point3Vector(int n,
                      double x[],
                      double y[],
                      double z[])
from three parallel arrays of x, y and z - by REFERENCE
 o Point3Vector
  public Point3Vector(RealArray m) throws InvalidArgumentException
constructor from RealArray - by REFERENCE
Throws: InvalidArgumentException
size of flarray must be multiple of 3
 o Point3Vector
  public Point3Vector(Point3Vector pv)
copy constructor from Point3Vector COPIES pv

Methods

 o addElement
  public void addElement(Point3 p)
 o 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)
 o getRange
  public RealRange getRange(Choice3 ax)
get range of one coordinate
 o getRange3
  public Real3Range getRange3()
get range of all 3 coordinates
 o 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
 o 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
 o 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
 o getLine
  public Line3 getLine(int i1,
                       int i2)
get the line between two points
 o getCentroid
  public Point3 getCentroid()
get centroid of all points
 o plus
  public Point3Vector plus(Vector3 v)
translate by a vector - do NOT modify this
 o subtract
  public Point3Vector subtract(Vector3 v)
translate negatively
 o moveToCentroid
  public void moveToCentroid()
centre molecule on origin - translate to centroid MODIFIES PV
 o inertialTensor
  public RealSquareMatrix inertialTensor()
get inertial tensor (second moments)
 o transform
  public void transform(Transform3 t)
transform all coordinates MODIFIES Vector
 o transform
  public void transform(Transform3 t,
                        IntSet is)
transform subset of coordinates - MODIFIES Vector
 o distance
  public double distance(int i1,
                         int i2)
get distance between 2 points
 o distance
  public double distance(IntSet is) throws InvalidArgumentException
get distance between 2 points
Throws: InvalidArgumentException
is must have exactly 2 points
 o 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
 o 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
 o 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
 o 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
 o getDistanceMatrix
  public RealSquareMatrix getDistanceMatrix()
distance matrix
 o 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
 o bestPlane
  public Plane3 bestPlane() throws ArrayTooSmallException
get best plane
Throws: ArrayTooSmallException
must have at least 3 points
 o deviationsFromPlane
  public RealArray deviationsFromPlane(Plane3 p)
get deviations of coordinates from plane
 o getPoint3
  public Point3 getPoint3(int i)
get a single point by REFERENCE
 o getXYZ
  public RealArray getXYZ()
get the coordinate coordinate array as doubles x,y,z,x,y,z, ...
 o getCoordinate
  public double getCoordinate(int i,
                              Choice3 j)
get a single coordinate value
 o getXYZ
  public RealArray getXYZ(Choice3 axis)
get a single coordinate array - e.g. all x-coordinates
 o rms
  public double rms(Point3Vector c)
rms between two molecules - per atom
 o 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
 o 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