jgromacs.data
Class Point3D

java.lang.Object
  extended by 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


Constructor Summary
Point3D()
          Constructs a new Point3D object
Point3D(double x, double y, double z)
          Constructs a new Point3D object with the given coordinates
 
Method Summary
 java.lang.Object clone()
          Returns an identical Point3D object
 Point3D crossProduct(Point3D other)
          Returns the cross product of this vector and another vector
 double distance(Point3D other)
          Returns the Euclidean distance between this point and another point
 boolean equals(java.lang.Object other)
          Returns true if the two 3D points are identical
 double getX()
          Returns the X coordinate of point
 double getY()
          Returns the Y coordinate of point
 double getZ()
          Returns the Z coordinate of point
 int hashCode()
          Returns hash code
 double innerProduct(Point3D other)
          Returns the inner product of this vector and another vector
 double length()
          Returns the length of the vector
 Point3D minus(Point3D other)
          Subtracts another vector from this vector
 Point3D multiplyByScalar(double scalar)
          Returns this vector multiplied by a scalar
 Point3D plus(Point3D other)
          Adds another vector to this vector
 void setX(double x)
          Sets the X coordinate of point
 void setY(double y)
          Sets the Y coordinate of point
 void setZ(double z)
          Sets the Z coordinate of point
 java.lang.String toString()
          Returns the String representation of point
 Point3D transformByMatrix(jama.Matrix matrix)
          Returns the resulting vector of a matrix transformation
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Point3D

public Point3D()
Constructs a new Point3D object


Point3D

public Point3D(double x,
               double y,
               double z)
Constructs a new Point3D object with the given coordinates

Parameters:
x - X coordinate
y - Y coordinate
z - Z coordinate
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 class java.lang.Object
Returns:
String representation

clone

public java.lang.Object clone()
Returns an identical Point3D object

Overrides:
clone in class java.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 class java.lang.Object
Parameters:
other - the other point

hashCode

public int hashCode()
Returns hash code

Overrides:
hashCode in class java.lang.Object