Package org.openscience.cdk.stereo
Class StereoTool
- java.lang.Object
-
- org.openscience.cdk.stereo.StereoTool
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StereoTool.SquarePlanarShape
The shape that four atoms take in a plane.static class
StereoTool.StereoClass
Currently unused, but intended for the StereoTool to indicate what it 'means' by an assignment of some atoms to a class.static class
StereoTool.TetrahedralSign
The handedness of a tetrahedron, in terms of the point-plane distance of three of the corners, compared to the fourth.
-
Field Summary
Fields Modifier and Type Field Description static double
MAX_AXIS_ANGLE
The maximum angle in radians for two lines to be 'diaxial'.static double
MIN_COLINEAR_NORMAL
The maximum tolerance for the normal calculated during colinearity.static double
PLANE_TOLERANCE
-
Constructor Summary
Constructors Constructor Description StereoTool()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
allCoplanar(javax.vecmath.Vector3d planeNormal, javax.vecmath.Point3d pointInPlane, javax.vecmath.Point3d... points)
Check that all the points in the list are coplanar (in the same plane) as the plane defined by the planeNormal and the pointInPlane.static StereoTool.TetrahedralSign
getHandedness(IAtom baseAtomA, IAtom baseAtomB, IAtom baseAtomC, IAtom apexAtom)
Gets the tetrahedral handedness of four atoms - three of which form the 'base' of the tetrahedron, and the other the apex.static javax.vecmath.Vector3d
getNormal(javax.vecmath.Point3d ptA, javax.vecmath.Point3d ptB, javax.vecmath.Point3d ptC)
Given three points (A, B, C), makes the vectors A-B and A-C, and makes the cross product of these two vectors; this has the effect of making a third vector at right angles to AB and AC.static StereoTool.SquarePlanarShape
getSquarePlanarShape(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD)
Given four atoms (assumed to be in the same plane), returns the arrangement of those atoms in that plane.static ITetrahedralChirality.Stereo
getStereo(IAtom atom1, IAtom atom2, IAtom atom3, IAtom atom4)
Take four atoms, and return Stereo.CLOCKWISE or Stereo.ANTI_CLOCKWISE.static boolean
isColinear(javax.vecmath.Point3d ptA, javax.vecmath.Point3d ptB, javax.vecmath.Point3d ptC)
Checks the three supplied points to see if they fall on the same line.static boolean
isOctahedral(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD, IAtom atomE, IAtom atomF, IAtom atomG)
Checks these 7 atoms to see if they are at the points of an octahedron.static boolean
isSquarePlanar(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD)
Checks these four atoms for square planarity.static boolean
isTrigonalBipyramidal(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD, IAtom atomE, IAtom atomF)
Checks these 6 atoms to see if they form a trigonal-bipyramidal shape.static double
signedDistanceToPlane(javax.vecmath.Vector3d planeNormal, javax.vecmath.Point3d pointInPlane, javax.vecmath.Point3d point)
Given a normalized normal for a plane, any point in that plane, and a point, will return the distance between the plane and that point.
-
-
-
Field Detail
-
MAX_AXIS_ANGLE
public static final double MAX_AXIS_ANGLE
The maximum angle in radians for two lines to be 'diaxial'. Where 0.95 is about 172 degrees.- See Also:
- Constant Field Values
-
MIN_COLINEAR_NORMAL
public static final double MIN_COLINEAR_NORMAL
The maximum tolerance for the normal calculated during colinearity.- See Also:
- Constant Field Values
-
PLANE_TOLERANCE
public static final double PLANE_TOLERANCE
- See Also:
- Constant Field Values
-
-
Method Detail
-
isSquarePlanar
public static boolean isSquarePlanar(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD)
Checks these four atoms for square planarity.- Parameters:
atomA
- an atom in the planeatomB
- an atom in the planeatomC
- an atom in the planeatomD
- an atom in the plane- Returns:
- true if all the atoms are in the same plane
-
getSquarePlanarShape
public static StereoTool.SquarePlanarShape getSquarePlanarShape(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD)
Given four atoms (assumed to be in the same plane), returns the arrangement of those atoms in that plane.
The 'shapes' returned represent arrangements that look a little like the characters 'U', '4', and 'Z'.
- Parameters:
atomA
- an atom in the planeatomB
- an atom in the planeatomC
- an atom in the planeatomD
- an atom in the plane- Returns:
- the shape (U/4/Z)
-
allCoplanar
public static boolean allCoplanar(javax.vecmath.Vector3d planeNormal, javax.vecmath.Point3d pointInPlane, javax.vecmath.Point3d... points)
Check that all the points in the list are coplanar (in the same plane) as the plane defined by the planeNormal and the pointInPlane.- Parameters:
planeNormal
- the normal to the planepointInPlane
- any point know to be in the planepoints
- an array of points to test- Returns:
- false if any of the points is not in the plane
-
isOctahedral
public static boolean isOctahedral(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD, IAtom atomE, IAtom atomF, IAtom atomG)
Checks these 7 atoms to see if they are at the points of an octahedron.- Parameters:
atomA
- one of the axial atomsatomB
- the central atomatomC
- one of the equatorial atomsatomD
- one of the equatorial atomsatomE
- one of the equatorial atomsatomF
- one of the equatorial atomsatomG
- the other axial atom- Returns:
- true if the geometry is octahedral
-
isTrigonalBipyramidal
public static boolean isTrigonalBipyramidal(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD, IAtom atomE, IAtom atomF)
Checks these 6 atoms to see if they form a trigonal-bipyramidal shape.- Parameters:
atomA
- one of the axial atomsatomB
- the central atomatomC
- one of the equatorial atomsatomD
- one of the equatorial atomsatomE
- one of the equatorial atomsatomF
- the other axial atom- Returns:
- true if the geometry is trigonal-bipyramidal
-
getStereo
public static ITetrahedralChirality.Stereo getStereo(IAtom atom1, IAtom atom2, IAtom atom3, IAtom atom4)
Take four atoms, and return Stereo.CLOCKWISE or Stereo.ANTI_CLOCKWISE. The first atom is the one pointing towards the observer.- Parameters:
atom1
- the atom pointing towards the observeratom2
- the second atom (points away)atom3
- the third atom (points away)atom4
- the fourth atom (points away)- Returns:
- clockwise or anticlockwise
-
getHandedness
public static StereoTool.TetrahedralSign getHandedness(IAtom baseAtomA, IAtom baseAtomB, IAtom baseAtomC, IAtom apexAtom)
Gets the tetrahedral handedness of four atoms - three of which form the 'base' of the tetrahedron, and the other the apex. Note that it assumes a right-handed coordinate system, and that the points {A,B,C} are in a counter-clockwise order in the plane they share.- Parameters:
baseAtomA
- the first atom in the base of the tetrahedronbaseAtomB
- the second atom in the base of the tetrahedronbaseAtomC
- the third atom in the base of the tetrahedronapexAtom
- the atom in the point of the tetrahedron- Returns:
- the sign of the tetrahedron
-
isColinear
public static boolean isColinear(javax.vecmath.Point3d ptA, javax.vecmath.Point3d ptB, javax.vecmath.Point3d ptC)
Checks the three supplied points to see if they fall on the same line. It does this by finding the normal to an arbitrary pair of lines between the points (in fact, A-B and A-C) and checking that its length is 0.- Parameters:
ptA
-ptB
-ptC
-- Returns:
- true if the tree points are on a straight line
-
signedDistanceToPlane
public static double signedDistanceToPlane(javax.vecmath.Vector3d planeNormal, javax.vecmath.Point3d pointInPlane, javax.vecmath.Point3d point)
Given a normalized normal for a plane, any point in that plane, and a point, will return the distance between the plane and that point.- Parameters:
planeNormal
- the normalized plane normalpointInPlane
- an arbitrary point in that planepoint
- the point to measure- Returns:
- the signed distance to the plane
-
getNormal
public static javax.vecmath.Vector3d getNormal(javax.vecmath.Point3d ptA, javax.vecmath.Point3d ptB, javax.vecmath.Point3d ptC)
Given three points (A, B, C), makes the vectors A-B and A-C, and makes the cross product of these two vectors; this has the effect of making a third vector at right angles to AB and AC.
NOTE : the returned normal is normalized; that is, it has been divided by its length.
- Parameters:
ptA
- the 'middle' pointptB
- one of the end pointsptC
- one of the end points- Returns:
- the vector at right angles to AB and AC
-
-