public class Point3Vector extends Object implements EuclidConstants
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;
| Modifier and Type | Field and Description |
|---|---|
protected List<Point3> |
vector |
C_AMP, C_APOS, C_ATSIGN, C_BACKSLASH, C_BACKSPACE, C_CARET, C_COLON, C_COMMA, C_DEL, C_DOLLAR, C_EQUALS, C_FORMFEED, C_HASH, C_LANGLE, C_LBRAK, C_LCURLY, C_LSQUARE, C_MINUS, C_NBSP, C_NEWLINE, C_NL, C_PERCENT, C_PERIOD, C_PIPE, C_PLUS, C_POUND, C_QUERY, C_QUOT, C_RANGLE, C_RBRAK, C_RCURLY, C_RETURN, C_RSQUARE, C_SEMICOLON, C_SHRIEK, C_SLASH, C_SPACE, C_STAR, C_TAB, C_TILDE, C_UNDER, EPS, F_S, NONWHITEPUNC, NONWHITEPUNC0, NONWHITEPUNC0REGEX, ONE_THIRD, PUNC, S_AMP, S_APOS, S_ATSIGN, S_BACKSLASH, S_CARET, S_COLON, S_COMMA, S_DOLLAR, S_EMPTY, S_EQUALS, S_FORMFEED, S_HASH, S_LANGLE, S_LBRAK, S_LCURLY, S_LSQUARE, S_MINUS, S_NEWLINE, S_NL, S_PERCENT, S_PERIOD, S_PIPE, S_PLUS, S_POUND, S_QUERY, S_QUOT, S_RANGLE, S_RBRAK, S_RCURLY, S_RETURN, S_RSQUARE, S_SEMICOLON, S_SHRIEK, S_SLASH, S_SPACE, S_STAR, S_TAB, S_TILDE, S_UNDER, S_WHITEREGEX, TWO_THIRDS, U_S, WHITESPACE| Constructor and Description |
|---|
Point3Vector()
constructor.
|
Point3Vector(double[] flarray)
constructor.
|
Point3Vector(int n,
double[] x,
double[] y,
double[] z)
from three parallel arrays of x, y and z - by REFERENCE
|
Point3Vector(Point3Vector pv)
copy constructor from Point3Vector COPIES pv
|
Point3Vector(RealArray m)
constructor from RealArray - by REFERENCE
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Point3 p)
add point.
|
void |
addElement(Point3 p)
add point.
|
Transform3 |
align3PointVectors(Point3Vector ref)
fit two sets of three points.
|
Transform3 |
alignUsing3Points(Point3Vector ref)
fit two coordinates of same length and alignment.
|
Angle |
angle(int i1,
int i2,
int i3)
get angle between 3 points.
|
Angle |
angle(IntSet is)
get angle between 3 points
|
Plane3 |
bestPlane()
Deprecated.
doesn't work
|
RealSquareMatrix |
calculateNonMassWeightedInertialTensor() |
RealSquareMatrix |
calculateNonMassWeightedInertialTensorOld()
get inertial tensor.
|
RealSquareMatrix |
calculateRotationToInertialAxes() |
RealArray |
deviationsFromPlane(Plane3 p)
get deviations of coordinates from plane
|
double |
distance(int i1,
int i2)
get distance between 2 points.
|
double |
distance(IntSet is)
get distance between 2 points.
|
Point3 |
elementAt(int i)
get Point3 element.
|
RealArray |
extractRealArray() |
Transform3 |
fitTo(Point3Vector ref)
fit two coordinates of same length and alignment
CURRENTLY NOT VALIDATED
|
Point3 |
get(int i)
get Point3 element.
|
int[] |
get3SeparatedPoints()
get three widely separated points.
|
double[] |
getArray()
get array.
|
Point3 |
getCentroid()
get centroid of all points
|
double |
getCoordinate(int i,
Axis.Axis3 j)
get a single coordinate value
|
RealSquareMatrix |
getDistanceMatrix()
distance matrix
|
int |
getFurthestPointFrom(Point3 p)
get point furthest from another.
|
Line3 |
getLine(int i1,
int i2)
get the line between two points
|
Point3 |
getPoint3(int i)
get a single point by REFERENCE
|
List<Point3> |
getPoint3List()
get points as list.
|
int |
getPointMakingSmallestAngle(Point3 p1,
Point3 p2)
get point making smallest angle with two others.
|
RealRange |
getRange(Axis.Axis3 ax)
get range of one coordinate
|
Real3Range |
getRange3()
get range of all 3 coordinates
|
double |
getSigmaDeltaSquared(Point3Vector v)
gets sums of squared distances between points.
|
RealArray |
getXYZ()
get the coordinate coordinate array as doubles x,y,z,x,y,z,
|
RealArray |
getXYZ(Axis.Axis3 axis)
get a single coordinate array for example all x-coordinates
|
void |
inertialAxes(RealArray eigval,
RealSquareMatrix eigvect,
EuclidRuntimeException illCond)
Deprecated.
(doesn't work)
|
Double |
innerProduct() |
boolean |
isEqualTo(Point3Vector p)
is equal.
|
void |
moveToCentroid()
centre molecule on origin.
|
Point3Vector |
multiplyBy(double scale)
multiply all coords.
|
void |
multiplyByEquals(double scale)
multiply all coords - alters this.
|
Point3Vector |
plus(Point3Vector pv2)
form the point+point sum for two vectors of points
|
Point3Vector |
plus(Vector3 v)
translate by a vector - do NOT modify
this |
void |
plusEquals(Vector3 v)
translate by a vector - modify
this |
static void |
removeNullValues(Point3Vector a,
Point3Vector b)
removes null values if both vectors have them at same position.
|
double |
rms(Point3Vector c)
rms between two molecules - per atom
|
Transform3 |
roughAlign(Point3Vector ref)
fit two coordinates of same length and alignment.
|
void |
setElementAt(Point3 p,
int i)
insert point.
|
void |
setElementAt(Vector3 v,
int i)
sets a given coordinate (i) to vector
|
int |
size()
size of vector.
|
Point3Vector |
subArray(IntSet is)
create a NEW subset of the points; points are COPIED
|
Point3Vector |
subtract(Point3Vector pv2)
form the point+point difference for two vectors of points
|
Point3Vector |
subtract(Vector3 v)
translate negatively.
|
Angle |
torsion(int i1,
int i2,
int i3,
int i4)
get torsion angle between 4 points.
|
Angle |
torsion(IntSet is)
get torsion angle between 4 points.
|
String |
toString()
to string.
|
void |
transform(Transform3 t)
transform all coordinates.
|
void |
transform(Transform3 t,
IntSet is)
transform subset of coordinates - MODIFIES Vector
|
public Point3Vector()
public Point3Vector(double[] flarray)
throws EuclidRuntimeException
flarray - EuclidRuntimeExceptionpublic Point3Vector(int n,
double[] x,
double[] y,
double[] z)
throws EuclidRuntimeException
n - x - y - z - EuclidRuntimeExceptionpublic Point3Vector(RealArray m) throws EuclidRuntimeException
m - EuclidRuntimeException - size of flarray must be multiple of 3public Point3Vector(Point3Vector pv)
pv - public int size()
public boolean isEqualTo(Point3Vector p)
p - public double[] getArray()
public void add(Point3 p)
p - the pointpublic void setElementAt(Point3 p, int i)
p - point to inserti - position to insert atpublic Point3 elementAt(int i)
i - serial of the element to getpublic Point3 get(int i)
i - serial of the element to getpublic void addElement(Point3 p)
p - public void setElementAt(Vector3 v, int i) throws EuclidRuntimeException
v - i - EuclidRuntimeException - i is >= number of current points (cann use this to
increase size of Point3Vector)public RealRange getRange(Axis.Axis3 ax)
ax - public Real3Range getRange3()
public double getSigmaDeltaSquared(Point3Vector v) throws EuclidRuntimeException
v - the other vectorEuclidRuntimeException - vectors not of same lengthpublic Point3Vector subArray(IntSet is) throws EuclidRuntimeException
is - EuclidRuntimeException - an element of is is outside range of thispublic Point3Vector multiplyBy(double scale)
scale - public void multiplyByEquals(double scale)
scale - public Point3Vector plus(Point3Vector pv2) throws EuclidRuntimeException
pv2 - EuclidRuntimeException - pv2 is different size from thispublic Point3Vector subtract(Point3Vector pv2) throws EuclidRuntimeException
pv2 - EuclidRuntimeException - pv2 is different size from thispublic Line3 getLine(int i1, int i2)
i1 - i2 - public Point3 getCentroid()
public Point3Vector plus(Vector3 v)
thisv - public void plusEquals(Vector3 v)
thisv - public Point3Vector subtract(Vector3 v)
v - vector to subtractpublic void moveToCentroid()
public static void removeNullValues(Point3Vector a, Point3Vector b)
a - b - public RealSquareMatrix calculateNonMassWeightedInertialTensorOld()
public RealSquareMatrix calculateRotationToInertialAxes()
public void transform(Transform3 t)
t - public void transform(Transform3 t, IntSet is)
t - is - public double distance(int i1,
int i2)
i1 - index of first pointi2 - index of second pointpublic double distance(IntSet is) throws EuclidRuntimeException
is - of exactly 2 integersEuclidRuntimeException - is must have exactly 2 pointspublic Angle angle(int i1, int i2, int i3) throws EuclidRuntimeException
i1 - serial of first pointi2 - serial of second pointi3 - serial of third pointEuclidRuntimeException - two points are coincident or identicalpublic Angle angle(IntSet is) throws EuclidRuntimeException
is - of exactly 3 integersEuclidRuntimeException - is must have exactly 3 pointsEuclidRuntimeException - two points are coincident or identicalpublic Angle torsion(int i1, int i2, int i3, int i4) throws EuclidRuntimeException
i1 - serial of first pointi2 - serial of second pointi3 - serial of third pointi4 - serial of fourth pointEuclidRuntimeException - either 2 points are identical or coincident or 3
successive points are colinearpublic Angle torsion(IntSet is) throws EuclidRuntimeException
is - of exactly 3 integersEuclidRuntimeException - is must have exactly 4 pointsEuclidRuntimeException - either 2 points are identical or coincident or 3
successive points are colinearpublic RealSquareMatrix getDistanceMatrix()
public RealSquareMatrix calculateNonMassWeightedInertialTensor()
public void inertialAxes(RealArray eigval, RealSquareMatrix eigvect, EuclidRuntimeException illCond) throws EuclidRuntimeException
eigval - eigvect - illCond - EuclidRuntimeException - must have at least 3 pointspublic Plane3 bestPlane() throws EuclidRuntimeException
EuclidRuntimeException - must have at least 3 pointspublic RealArray deviationsFromPlane(Plane3 p)
p - public Point3 getPoint3(int i)
i - public RealArray getXYZ()
public double getCoordinate(int i,
Axis.Axis3 j)
i - j - public RealArray getXYZ(Axis.Axis3 axis)
axis - public double rms(Point3Vector c)
c - public int getFurthestPointFrom(Point3 p)
p - point to avoid (need not be in this)public int getPointMakingSmallestAngle(Point3 p1, Point3 p2)
p1 - point to avoid (need not be in this)p2 - point to avoid (need not be in this)public Transform3 alignUsing3Points(Point3Vector ref) throws EuclidRuntimeException
ref - EuclidRuntimeException - some unusual geometry (for example one coordinate set is
linear, has coincident points, etc.)public int[] get3SeparatedPoints()
throws EuclidRuntimeException
EuclidRuntimeException - this or ref do not have 3 points or one has colinear or
coincident pointspublic Transform3 align3PointVectors(Point3Vector ref) throws EuclidRuntimeException
ref - reference pointsEuclidRuntimeException - this or ref do not have 3 points or one has colinear or
coincident pointspublic Transform3 roughAlign(Point3Vector ref) throws EuclidRuntimeException
ref - EuclidRuntimeException - some unusual geometry (for example one coordinate set is
linear, has coincident points, etc.)public Transform3 fitTo(Point3Vector ref) throws EuclidRuntimeException
ref - EuclidRuntimeException - some unusual geometry (for example one coordinate set is
linear, has coincident points, etc.)public RealArray extractRealArray()
public Double innerProduct()
Copyright © 1994–2024 Peter Murray-Rust. All rights reserved.