Constructor and Description |
---|
PointSet() |
PointSet(int n)
creates a point set consisting of n uniformly distributed points in the unit square
|
Modifier and Type | Method and Description |
---|---|
static PointSet |
createUnitSquareCorners()
creates a point set of 4 corners of a unit square (0,0), (1,0), (0,1), (1,1)
|
Point |
getCentroid()
returns the centroid of the pointset
|
Point[] |
getClosestPair()
O(n^2) Brute force algorithm for the closest pair
|
Point |
getNextExtremePoint(Point p)
returns next extreme point of the point set (counterclockwise)
|
Point |
leftExtremePoint()
returns the leftmost point (in case of ties, the topmost one is returned
|
int |
leftExtremePointIndx()
returns the index of the leftmost point (in case of ties, index of the topmost one is returned)
|
void |
toConsole(int dec)
prints points on the console
|
void |
translate(Vector v)
translates all points by the specified vector
|
append, append, binarySearch, clear, contains, delete, deleteFirst, deleteIndex, deleteLast, findIndex, get, getElements, getFirst, getLast, getSize, insert, isEmpty, isEqual, isMember, iterator, main, partition, randomPermutation, reverse, set, shift, sort, swap
public PointSet()
public PointSet(int n)
public static PointSet createUnitSquareCorners()
public Point getCentroid()
public Point[] getClosestPair()
public int leftExtremePointIndx()
public Point leftExtremePoint()
public Point getNextExtremePoint(Point p)
public void translate(Vector v)
public void toConsole(int dec)