Class pmr.euclid.Int2Vector
All Packages Class Hierarchy This Package Previous Next Index
Class pmr.euclid.Int2Vector
java.lang.Object
|
+----java.util.Vector
|
+----pmr.euclid.EuclidVector
|
+----pmr.euclid.Int2Vector
- public class Int2Vector
- extends EuclidVector
Int2Vector - a (Java) Vector of Int2s. (Note that 'Vector' is
used by Java to describe an array of objects - there is no relationship
to geometrical vectors in this package.)
Support is also given for the two component arrays as IntArrays
Default is an empty (Java) Vector;
- Author:
- (C) P. Murray-Rust, 1996
-
Int2Vector()
-
-
Int2Vector(int)
- create a Vector with given number of points
-
Int2Vector(int, int[], int[])
- from two parallel arrays of x, y - by REFERENCE
-
Int2Vector(Int2Vector)
- copy constructor from Int2Vector COPIES pv
-
Int2Vector(int[])
- Formed by feeding in an existing array to a 2xn matrix.
-
Int2Vector(IntArray)
- constructor from IntArray - by REFERENCE
-
addElement(Int2)
-
-
getClosestPoint(Int2)
- get the closest point (both ranges are assumed to have the same scales
-
getCoordinate(int, Choice2)
- get a single coordinate value
-
getInt2(int)
- get the i'th Int2
-
getPoint(Int2, int, int)
- get the index of the first point within a box centered on p
(i.e.
-
getRange(Choice2)
- get range of one coordinate
-
getRange2()
- get range of both coordinates
-
getXorY(Choice2)
- get a single coordinate array - e.g.
-
getXY()
- get the coordinate coordinate array as ints x,y,x,y, ...
-
makeString()
- we are not allowed a toString() here, as Vector is a final class
-
multiplyBy(int)
- multiply all coordinates be a given scalar (i.e.
-
plus(Int2)
- add a Int2 to all elements of 'this'; MODIFIES 'this'
-
setElementAt(Int2, int)
-
-
sortAscending(Choice2)
- sort ARRAY on X or Y coordinate; returns new array
-
sortDescending(Choice2)
- sort ARRAY on X or Y coordinate; returns new array
-
sortXYAscending()
- sort X and Y within each point; MODIFIES array
-
sortXYDescending()
- sort X and Y within each point; MODIFIES array
-
subArray(IntSet)
- create a NEW subset of the points; points are COPIED
-
subSet(Int2Range)
- create a subset of the points within a box
-
subtract(Int2)
- translate negatively; MODIFIES 'this'
-
swapXY()
- swap all X and Y coordinates; MODIFIES array
-
translateBy(Int2)
- translate by a vector, synonym for 'plus'; MODIFIES 'this'
Int2Vector
public Int2Vector()
Int2Vector
public Int2Vector(int size)
- create a Vector with given number of points
Int2Vector
public Int2Vector(int flarray[]) throws InvalidArgumentException
- Formed by feeding in an existing array to a 2xn matrix.
THE COLUMN IS THE FASTEST MOVING INDEX, i.e. the matrix is filled
as flarray(0,0, flarray(0,1). Primarily for compatibility with other apps
- Throws: InvalidArgumentException
- array must have even number of elements
Int2Vector
public Int2Vector(int n,
int x[],
int y[])
- from two parallel arrays of x, y - by REFERENCE
Int2Vector
public Int2Vector(IntArray m) throws InvalidArgumentException
- constructor from IntArray - by REFERENCE
- Throws: InvalidArgumentException
- array must have even number of elements
Int2Vector
public Int2Vector(Int2Vector pv)
- copy constructor from Int2Vector COPIES pv
addElement
public void addElement(Int2 p)
setElementAt
public void setElementAt(Int2 v,
int i) throws ArrayIndexOutOfBoundsException
- Throws: ArrayIndexOutOfBoundsException
- v does not have an i'th element
getRange
public IntRange getRange(Choice2 ax)
- get range of one coordinate
getRange2
public Int2Range getRange2()
- get range of both coordinates
subArray
public Int2Vector subArray(IntSet is) throws BadSubscriptException
- create a NEW subset of the points; points are COPIED
- Throws: BadSubscriptException
- an element of is is out of range of this
subSet
public IntSet subSet(Int2Range r)
- create a subset of the points within a box
getClosestPoint
public int getClosestPoint(Int2 p)
- get the closest point (both ranges are assumed to have the same scales
getPoint
public int getPoint(Int2 p,
int width,
int height)
- get the index of the first point within a box centered on p
(i.e. p+- width/2, height/2) or -1 if none
translateBy
public void translateBy(Int2 v)
- translate by a vector, synonym for 'plus'; MODIFIES 'this'
plus
public void plus(Int2 p)
- add a Int2 to all elements of 'this'; MODIFIES 'this'
subtract
public void subtract(Int2 v)
- translate negatively; MODIFIES 'this'
multiplyBy
public void multiplyBy(int f)
- multiply all coordinates be a given scalar (i.e. expands
scale)
getInt2
public Int2 getInt2(int i)
- get the i'th Int2
getXY
public IntArray getXY()
- get the coordinate coordinate array as ints x,y,x,y, ...
getCoordinate
public int getCoordinate(int i,
Choice2 j)
- get a single coordinate value
getXorY
public IntArray getXorY(Choice2 axis)
- get a single coordinate array - e.g. all x-coordinates
swapXY
public void swapXY()
- swap all X and Y coordinates; MODIFIES array
sortXYAscending
public void sortXYAscending()
- sort X and Y within each point; MODIFIES array
sortXYDescending
public void sortXYDescending()
- sort X and Y within each point; MODIFIES array
sortAscending
public Int2Vector sortAscending(Choice2 ax)
- sort ARRAY on X or Y coordinate; returns new array
sortDescending
public Int2Vector sortDescending(Choice2 ax)
- sort ARRAY on X or Y coordinate; returns new array
makeString
public String makeString()
- we are not allowed a toString() here, as Vector is a final class
All Packages Class Hierarchy This Package Previous Next Index