|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractList<E> java.util.ArrayList<Point> ProGAL.geom3d.PointList
public class PointList
An ArrayList-wrapper for storing 3d points. Adds functionality specific to point-sets such as finding centroid, diameter or covariance.
Constructor Summary | |
---|---|
PointList()
Construct an empty point-list. |
|
PointList(java.util.Collection<Point> points)
|
|
PointList(Point[] elements)
Construc a point-list from an array of points. |
Method Summary | |
---|---|
PointList |
clone()
Get a shallow copy of this list. |
LineSegment |
diameterSqrt3Approx()
Get a segment seg between two points in the set such that
diameter/sqrt(3) <= seg . |
static PointList |
generatePointsInCube(int n)
Construct a point-list containing n uniformly distributed random points in the unit cube. |
static PointList |
generatePointsInCube(int n,
double xL,
double xH,
double yL,
double yH,
double zL,
double zH)
|
static PointList |
generatePointsOnSphere(int n)
Construct a point-list of n evenly distributed points (not random) on the unit sphere. |
static PointList |
generateRandomPointsOnSphere(int n)
Construct a point-list of n uniformly distributed random points on the unit sphere. |
Point |
getCentroid()
Get the centroid of the points. |
double |
getCoord(int k,
int i)
Returns the i'th coordinate of k'th point. |
Matrix3x3 |
getCovariance()
Get the covariance of the points. |
LineSegment |
getDiameter()
Get the diameter of the point set - trivial O(n^2) algorithm. |
Point |
getExtreme(Vector direction)
Get the most extreme point in the direction specified by the vector. |
Point |
getExtremeBack()
Get the deepest point (in case of ties the left topmost point is returned). |
Point |
getExtremeBottom()
Get the lowest point (in case of ties the bottom rightmost point is returned). |
Point |
getExtremeFront()
Get the frontmost point (in case of ties the front rightmost point is returned). |
int |
getExtremeIndex(int ix,
int iy,
int iz,
boolean high)
Get the index of the extreme point. |
int |
getExtremeIndex(Vector direction)
Get the most extreme point in the direction specified by the vector. |
Point |
getExtremeLeft()
Get the leftmost point (in case of ties the bottom lefttmost point is returned). |
Point |
getExtremeRight()
Get the rightmost point (in case of ties the top rightmost point is returned). |
Point |
getExtremeTop()
Get the highest point (in case of ties the left topmost point is returned). |
PointList |
getRandomPermutation()
Returns a new point-list containing all the elements in random order. |
double |
getStandardDeviation()
Get the standard deviation of the point set. |
PointList |
getSubList(int from,
int to)
Returns a sub-list of elements from (including) from to
(not including) to . |
double |
getVariance()
Get the variance of the points. |
void |
toConsole()
Writes this point-list to System.out . |
void |
toConsole(int dec)
Writes this point-list to System.out . |
Methods inherited from class java.util.ArrayList |
---|
add, add, addAll, addAll, clear, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
equals, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, removeAll, retainAll, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList |
Constructor Detail |
---|
public PointList()
public PointList(Point[] elements)
public PointList(java.util.Collection<Point> points)
Method Detail |
---|
public double getCoord(int k, int i)
public PointList getSubList(int from, int to)
from
to
(not including) to
. The returned sub-list is not a 'view'
of the sublist (such as AbstractList.subList), but a shallow copy of
the specified range.
public PointList getRandomPermutation()
public Point getCentroid()
public double getVariance()
public Matrix3x3 getCovariance()
public double getStandardDeviation()
public Point getExtreme(Vector direction)
public int getExtremeIndex(Vector direction)
public int getExtremeIndex(int ix, int iy, int iz, boolean high)
PointList3d list = new PointList3d(); list.add( new Point3d(0,0,0) ); list.add( new Point3d(1,0,0) ); list.add( new Point3d(0,1,0) ); list.add( new Point3d(0,0,1) ); System.out.println(list.getExtremeIndex(1,2,0,true)); System.out.println(list.getExtremeIndex(1,2,0,false));will print the indices 2 and 0.
public Point getExtremeRight()
public Point getExtremeLeft()
public Point getExtremeTop()
public Point getExtremeBottom()
public Point getExtremeFront()
public Point getExtremeBack()
public LineSegment getDiameter()
public LineSegment diameterSqrt3Approx()
seg
between two points in the set such that
diameter/sqrt(3) <= seg
. Requires O(n) time.
public PointList clone()
clone
in class java.util.ArrayList<Point>
public void toConsole()
System.out
.
public void toConsole(int dec)
System.out
.
public static PointList generatePointsInCube(int n)
public static PointList generatePointsInCube(int n, double xL, double xH, double yL, double yH, double zL, double zH)
public static PointList generateRandomPointsOnSphere(int n)
public static PointList generatePointsOnSphere(int n)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |