Package jgromacs.data
Class Point3D
- java.lang.Object
-
- jgromacs.data.Point3D
-
- All Implemented Interfaces:
java.lang.Cloneable
public class Point3D extends java.lang.Object implements java.lang.Cloneable
Objects of this class represent a single 3D point
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Returns an identical Point3D objectPoint3D
crossProduct(Point3D other)
Returns the cross product of this vector and another vectordouble
distance(Point3D other)
Returns the Euclidean distance between this point and another pointboolean
equals(java.lang.Object other)
Returns true if the two 3D points are identicaldouble
getX()
Returns the X coordinate of pointdouble
getY()
Returns the Y coordinate of pointdouble
getZ()
Returns the Z coordinate of pointint
hashCode()
Returns hash codedouble
innerProduct(Point3D other)
Returns the inner product of this vector and another vectordouble
length()
Returns the length of the vectorPoint3D
minus(Point3D other)
Subtracts another vector from this vectorPoint3D
multiplyByScalar(double scalar)
Returns this vector multiplied by a scalarPoint3D
plus(Point3D other)
Adds another vector to this vectorvoid
setX(double x)
Sets the X coordinate of pointvoid
setY(double y)
Sets the Y coordinate of pointvoid
setZ(double z)
Sets the Z coordinate of pointjava.lang.String
toString()
Returns the String representation of pointPoint3D
transformByMatrix(Jama.Matrix matrix)
Returns the resulting vector of a matrix transformation
-
-
-
Method Detail
-
getX
public double getX()
Returns the X coordinate of point- Returns:
- X coordinate
-
setX
public void setX(double x)
Sets the X coordinate of point- Parameters:
x
- X coordinate
-
getY
public double getY()
Returns the Y coordinate of point- Returns:
- Y coordinate
-
setY
public void setY(double y)
Sets the Y coordinate of point- Parameters:
y
- Y coordinate
-
getZ
public double getZ()
Returns the Z coordinate of point- Returns:
- Z coordinate
-
setZ
public void setZ(double z)
Sets the Z coordinate of point- Parameters:
z
- Z coordinate
-
distance
public double distance(Point3D other)
Returns the Euclidean distance between this point and another point- Parameters:
other
- another point- Returns:
- distance between points
-
plus
public Point3D plus(Point3D other)
Adds another vector to this vector- Parameters:
other
- another vector- Returns:
- result vector
-
minus
public Point3D minus(Point3D other)
Subtracts another vector from this vector- Parameters:
other
- another vector- Returns:
- result vector
-
innerProduct
public double innerProduct(Point3D other)
Returns the inner product of this vector and another vector- Parameters:
other
- another vector- Returns:
- inner product
-
crossProduct
public Point3D crossProduct(Point3D other)
Returns the cross product of this vector and another vector- Parameters:
other
- another vector- Returns:
- cross product
-
multiplyByScalar
public Point3D multiplyByScalar(double scalar)
Returns this vector multiplied by a scalar- Parameters:
scalar
- scalar value- Returns:
- result vector
-
length
public double length()
Returns the length of the vector- Returns:
- length of vector
-
transformByMatrix
public Point3D transformByMatrix(Jama.Matrix matrix)
Returns the resulting vector of a matrix transformation- Parameters:
matrix
- 3x3 transformation matrix- Returns:
- transformed vector
-
toString
public java.lang.String toString()
Returns the String representation of point- Overrides:
toString
in classjava.lang.Object
- Returns:
- String representation
-
clone
public java.lang.Object clone()
Returns an identical Point3D object- Overrides:
clone
in classjava.lang.Object
- Returns:
- clone of the point
-
equals
public boolean equals(java.lang.Object other)
Returns true if the two 3D points are identical- Overrides:
equals
in classjava.lang.Object
- Parameters:
other
- the other point
-
hashCode
public int hashCode()
Returns hash code- Overrides:
hashCode
in classjava.lang.Object
-
-