Package com.actelion.research.chem
Class Coordinates
- java.lang.Object
-
- com.actelion.research.chem.Coordinates
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<Coordinates>
public final class Coordinates extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<Coordinates>
Class to encapsulate 3D coordinates- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Coordinates()Coordinates(double x, double y, double z)Coordinates(Coordinates c)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(double dx, double dy, double dz)Coordinatesadd(Coordinates c)CoordinatesaddC(Coordinates c)Coordinatesbetween(Coordinates c1, Coordinates c2, double f)Updates this to contain a point on the straight line through c1 and c2.Coordinatescenter(Coordinates c)Calculates the center point between this and c and sets this to the center point.voidcenter(Coordinates c1, Coordinates c2)Updates this to contains the center between c1 and c2.intcompareTo(Coordinates o)doublecosAngle(Coordinates c)static CoordinatescreateBarycenter(Coordinates... coords)Coordinatescross(Coordinates c)doubledist()doubledistance(Coordinates c)doubledistanceSquared(Coordinates c)doubledistSq()doubledistSquareTo(Coordinates c)doubledot(Coordinates c)booleanequals(java.lang.Object o)doublegetAngle(Coordinates c)Gets the angle formed between the 2 vectors ([0,PI])doublegetAngleXY(Coordinates c)Calculates the angle of the line from this location to c projected into the x/y plane.doublegetDihedral(Coordinates c2, Coordinates c3, Coordinates c4)static doublegetDihedral(Coordinates c1, Coordinates c2, Coordinates c3, Coordinates c4)Calculates a signed torsion as an exterior spherical angle from a valid sequence of 4 points in space.doublegetLength()static CoordinatesgetMirror(Coordinates p, Coordinates c1, Coordinates c2, Coordinates c3)Get the mirror image of p through the plane defined by c1, c2, c3static doublegetRmsd(Coordinates[] c1, Coordinates[] c2)static doublegetRmsd(Coordinates[] c1, Coordinates[] c2, int l)booleaninsideBounds(Coordinates[] bounds)booleanisNaN()Coordinatesmax(Coordinates c)static Coordinatesmax(Coordinates[] c)Coordinatesmin(Coordinates c)static Coordinatesmin(Coordinates[] c)voidnegate()static Coordinatesrandom()Coordinatesrotate(double[][] m)Coordinatesrotate(Coordinates normal, double theta)CoordinatesrotateC(double[][] m)Coordinatesscale(double scale)CoordinatesscaleC(double scale)voidset(double x, double y, double z)Coordinatesset(Coordinates c)Copies x,y,z from c to thisCoordinatessub(Coordinates c)CoordinatessubC(Coordinates c)java.lang.StringtoString()java.lang.StringtoStringSpaceDelimited()Coordinatesunit()CoordinatesunitC()
-
-
-
Constructor Detail
-
Coordinates
public Coordinates()
-
Coordinates
public Coordinates(Coordinates c)
-
Coordinates
public Coordinates(double x, double y, double z)
-
-
Method Detail
-
set
public Coordinates set(Coordinates c)
Copies x,y,z from c to this- Parameters:
c-- Returns:
- this after copying c
-
set
public void set(double x, double y, double z)
-
getLength
public double getLength()
-
dist
public final double dist()
-
distSq
public final double distSq()
-
distanceSquared
public final double distanceSquared(Coordinates c)
-
distSquareTo
public final double distSquareTo(Coordinates c)
-
distance
public final double distance(Coordinates c)
-
dot
public final double dot(Coordinates c)
-
cross
public final Coordinates cross(Coordinates c)
-
getAngle
public final double getAngle(Coordinates c)
Gets the angle formed between the 2 vectors ([0,PI])- Parameters:
c-- Returns:
- angle in radian
-
getAngleXY
public double getAngleXY(Coordinates c)
Calculates the angle of the line from this location to c projected into the x/y plane. With Y facing upwards and X right, if the line points in Y direction, ten angle is 0.0 increasing in clockwise direction.- Parameters:
c-- Returns:
- -PI < angle < PI
-
getDihedral
public final double getDihedral(Coordinates c2, Coordinates c3, Coordinates c4)
-
subC
public final Coordinates subC(Coordinates c)
-
addC
public final Coordinates addC(Coordinates c)
-
scaleC
public final Coordinates scaleC(double scale)
-
sub
public final Coordinates sub(Coordinates c)
- Parameters:
c-- Returns:
- this after subtracting c
-
add
public final Coordinates add(Coordinates c)
- Parameters:
c-- Returns:
- this after subtracting c
-
add
public void add(double dx, double dy, double dz)
-
scale
public final Coordinates scale(double scale)
- Parameters:
scale-- Returns:
- this after scaling this
-
negate
public final void negate()
-
rotate
public Coordinates rotate(double[][] m)
- Parameters:
m-- Returns:
- this after rotating it with rotation matrix m
-
rotateC
public Coordinates rotateC(double[][] m)
- Parameters:
m-- Returns:
- new Coordinates created from this point rotated by rotation matrix m
-
rotate
public final Coordinates rotate(Coordinates normal, double theta)
-
unitC
public final Coordinates unitC()
- Returns:
- new Coordinates with a copy of this scaled to length=1.0
-
unit
public final Coordinates unit()
- Returns:
- this after scaling it to length=1.0
-
center
public Coordinates center(Coordinates c)
Calculates the center point between this and c and sets this to the center point.- Parameters:
c-- Returns:
- this after updating it to the center position
-
center
public void center(Coordinates c1, Coordinates c2)
Updates this to contains the center between c1 and c2.- Parameters:
c1-c2-
-
between
public Coordinates between(Coordinates c1, Coordinates c2, double f)
Updates this to contain a point on the straight line through c1 and c2.- Parameters:
c1-c2-f- location on line 0.0 -> c1, 1.0 -> c2- Returns:
- this after updating to be a point on the line
-
insideBounds
public final boolean insideBounds(Coordinates[] bounds)
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toStringSpaceDelimited
public final java.lang.String toStringSpaceDelimited()
-
equals
public final boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
isNaN
public final boolean isNaN()
-
min
public final Coordinates min(Coordinates c)
-
max
public final Coordinates max(Coordinates c)
-
cosAngle
public double cosAngle(Coordinates c)
-
min
public static final Coordinates min(Coordinates[] c)
-
max
public static final Coordinates max(Coordinates[] c)
-
createBarycenter
public static final Coordinates createBarycenter(Coordinates... coords)
-
getMirror
public static final Coordinates getMirror(Coordinates p, Coordinates c1, Coordinates c2, Coordinates c3)
Get the mirror image of p through the plane defined by c1, c2, c3- Parameters:
p-c1-c2-c3-- Returns:
-
getDihedral
public static final double getDihedral(Coordinates c1, Coordinates c2, Coordinates c3, Coordinates c4)
Calculates a signed torsion as an exterior spherical angle from a valid sequence of 4 points in space. Looking along the line from c2 to c3, the torsion angle is 0.0, if the projection of c2->c1 and c3->c4 point in the same direction. If the projection of vector c2-c1 is rotated in clockwise direction, the angle increases, i.e. has a positive value. http://en.wikipedia.org/wiki/Dihedral_angle- Parameters:
c1-c2-c3-c4-- Returns:
- torsion in the range: -pi <= torsion <= pi
-
compareTo
public int compareTo(Coordinates o)
- Specified by:
compareToin interfacejava.lang.Comparable<Coordinates>
-
random
public static final Coordinates random()
-
getRmsd
public static double getRmsd(Coordinates[] c1, Coordinates[] c2)
-
getRmsd
public static double getRmsd(Coordinates[] c1, Coordinates[] c2, int l)
-
-