jgromacs.data
Class PointList

java.lang.Object
  extended by jgromacs.data.PointList
All Implemented Interfaces:
java.lang.Cloneable

public class PointList
extends java.lang.Object
implements java.lang.Cloneable

Objects of this class represent a list of 3D points


Constructor Summary
PointList()
          Constructs a new PointList object
 
Method Summary
 void addPoint(Point3D point)
          Adds a new point to the point list
 void centerPoints()
          Centers the points (around the origin)
 java.lang.Object clone()
          Returns an identical PointList object
 boolean equals(java.lang.Object other)
          Returns true if the two point lists are identical
 jama.Matrix getAsMatrix()
          Returns point coordinates in a 3xN matrix
 Point3D getCentroid()
          Returns the centroid of points
 int getNumberOfPoints()
          Returns the number of points in the list
 Point3D getPoint(int i)
          Returns the point of index i
 java.util.ArrayList<Point3D> getPointsAsArrayList()
          Returns points in an ArrayList
 PointList getSubList(java.util.ArrayList<java.lang.Integer> indices)
          Returns a subset of points defined by an ArrayList of indices
 int hashCode()
          Returns hash code
 void loadFromMatrix(jama.Matrix M)
          Loads point coordinates from a 3xN matrix
 void removePoint(int i)
          Removes the point of index i from the point list
 void removePoint(Point3D point)
          Removes the given point from the point list
 void rotate(jama.Matrix rotationMatrix)
          Rotates the points by a given 3x3 rotation matrix
 void setPoint(int i, Point3D point)
          Replaces the point of index i with a given point
 void setPointFromArrayList(java.util.ArrayList<Point3D> points)
          Loads points from an ArrayList
 java.lang.String toString()
          Returns the String representation of point list
 java.lang.String toStringInfo()
          Returns summary information about the point list
 void translate(Point3D vector)
          Translates the points by a given vector
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PointList

public PointList()
Constructs a new PointList object

Method Detail

getPointsAsArrayList

public java.util.ArrayList<Point3D> getPointsAsArrayList()
Returns points in an ArrayList

Returns:
Points in an ArrayList

setPointFromArrayList

public void setPointFromArrayList(java.util.ArrayList<Point3D> points)
Loads points from an ArrayList

Parameters:
points - ArrayList of points

addPoint

public void addPoint(Point3D point)
Adds a new point to the point list

Parameters:
point - new point

getPoint

public Point3D getPoint(int i)
Returns the point of index i

Parameters:
i - index
Returns:
Point of index i

setPoint

public void setPoint(int i,
                     Point3D point)
Replaces the point of index i with a given point

Parameters:
i - index
point - new point

removePoint

public void removePoint(int i)
Removes the point of index i from the point list

Parameters:
i - index

removePoint

public void removePoint(Point3D point)
Removes the given point from the point list

Parameters:
point - point to remove

getNumberOfPoints

public int getNumberOfPoints()
Returns the number of points in the list

Returns:
Number of points

getSubList

public PointList getSubList(java.util.ArrayList<java.lang.Integer> indices)
Returns a subset of points defined by an ArrayList of indices

Parameters:
indices - ArrayList of indices
Returns:
subset of points

getAsMatrix

public jama.Matrix getAsMatrix()
Returns point coordinates in a 3xN matrix

Returns:
coordinate matrix

loadFromMatrix

public void loadFromMatrix(jama.Matrix M)
Loads point coordinates from a 3xN matrix

Parameters:
M - coordinate matrix

centerPoints

public void centerPoints()
Centers the points (around the origin)


getCentroid

public Point3D getCentroid()
Returns the centroid of points

Returns:
centroid point

rotate

public void rotate(jama.Matrix rotationMatrix)
Rotates the points by a given 3x3 rotation matrix

Parameters:
rotationMatrix - rotation matrix

translate

public void translate(Point3D vector)
Translates the points by a given vector

Parameters:
vector - translation vector

toString

public java.lang.String toString()
Returns the String representation of point list

Overrides:
toString in class java.lang.Object
Returns:
String representation

toStringInfo

public java.lang.String toStringInfo()
Returns summary information about the point list

Returns:
summary information

clone

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

Overrides:
clone in class java.lang.Object
Returns:
clone of the point list

equals

public boolean equals(java.lang.Object other)
Returns true if the two point lists are identical

Overrides:
equals in class java.lang.Object
Parameters:
other - the other point list

hashCode

public int hashCode()
Returns hash code

Overrides:
hashCode in class java.lang.Object