public class PointSetUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
PointSetUtils.Random
A random number generator for use in
randomPointSet(int, int, Random) . |
Constructor and Description |
---|
PointSetUtils() |
Modifier and Type | Method and Description |
---|---|
static ArrayPointSet |
pointsFromStream(java.io.InputStream s)
Reads a point set from an input stream.
|
static ArrayPointSet |
randomPointSet(int d,
int n,
PointSetUtils.Random r)
Generates a random point set given a random number generator.
|
public static ArrayPointSet randomPointSet(int d, int n, PointSetUtils.Random r)
d
- dimension of the points in the point setn
- number of pointsr
- the random number generatorn
d
-dimensional pointspublic static final ArrayPointSet pointsFromStream(java.io.InputStream s)
The stream is assumed to be encoded in UTF-8 and should contain integers and double values, all separated by space or return. The first two numbers must be integers, specifying the number of points in the point set and the dimension. The following numbers are all doubles and specify the points by their Euclidean coordinates.
For example, the three two-dimensional points (0,0)
, (2,3)
, (4,5)
could
be stored as follows:
3 2 0 0 2 3 4 5
s
- the input stream to read from