org.openmali.vecmath2
Class Vector2i

java.lang.Object
  extended by org.openmali.vecmath2.TupleNi<Tuple2i>
      extended by org.openmali.vecmath2.Tuple2i
          extended by org.openmali.vecmath2.Vector2i
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class Vector2i
extends Tuple2i
implements java.io.Externalizable

A 2 element vector that is represented by signed integer x,y coordinates. Inspired by Kenji Hiranabe's Vector2i implementation

See Also:
Serialized Form

Field Summary
static Vector2i ZERO
           
 
Fields inherited from class org.openmali.vecmath2.TupleNi
isDirty, N, roTrick, values
 
Constructor Summary
  Vector2i()
          Constructs and initializes a Point3i to (0,0,0).
protected Vector2i(boolean readOnly)
          Constructs and initializes a Point3i to (0,0,0).
protected Vector2i(boolean readOnly, int[] values, boolean[] isDirty, boolean copy)
          Constructs and initializes a Point3i from the specified array.
protected Vector2i(boolean readOnly, int x, int y)
          Constructs and initializes a Point3i from the specified xyz coordinates.
protected Vector2i(boolean readOnly, Tuple2i tuple)
          Constructs and initializes a Point3i from the specified Point3i.
  Vector2i(int[] values)
          Constructs and initializes a Point3i from the specified array.
  Vector2i(int x, int y)
          Constructs and initializes a Point3i from the specified xyz coordinates.
  Vector2i(Tuple2i tuple)
          Constructs and initializes a Point3i from the specified Point3i.
 
Method Summary
 Vector2i asReadOnly()
          
 Vector2i clone()
          Creates and returns a copy of this object.
static Vector2i fromPool()
          Allocates an Vector2i instance from the pool.
static Vector2i fromPool(int x, int y)
          Allocates an Vector2i instance from the pool.
static Vector2i fromPool(Tuple2i tuple)
          Allocates an Vector2i instance from the pool.
 Vector2i getReadOnly()
          
static Vector2i newReadOnly()
          Constructs and initializes a Point3i to (0,0,0).
static Vector2i newReadOnly(int[] values)
          Constructs and initializes a Point3i from the specified array.
static Vector2i newReadOnly(int x, int y)
          Constructs and initializes a Point3i from the specified xyz coordinates.
static Vector2i newReadOnly(Tuple2i tuple)
          Constructs and initializes a Point3i from the specified Point3i.
static void toPool(Vector2i o)
          Stores the given Vector2i instance in the pool.
 
Methods inherited from class org.openmali.vecmath2.Tuple2i
add, addX, addY, div, divX, divY, equals, equals, getX, getY, hashCode, mul, mulX, mulY, scale, set, setX, setY, sub, subX, subY, toPool, toString, x, x, y, y
 
Methods inherited from class org.openmali.vecmath2.TupleNi
absolute, absolute, add, add, clamp, clamp, clampMax, clampMax, clampMin, clampMin, deserialize, get, get, get, getSerializationBufferSize, getSize, getValue, isDirty, isReadOnly, negate, negate, readExternal, scale, scale, scaleAdd, scaleAdd, serialize, set, set, set, setClean, setValue, setZero, sub, sub, writeExternal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 

Field Detail

ZERO

public static final Vector2i ZERO
Constructor Detail

Vector2i

protected Vector2i(boolean readOnly,
                   int x,
                   int y)
Constructs and initializes a Point3i from the specified xyz coordinates.

Parameters:
x - the x coordinate
y - the y coordinate

Vector2i

protected Vector2i(boolean readOnly,
                   int[] values,
                   boolean[] isDirty,
                   boolean copy)
Constructs and initializes a Point3i from the specified array.

Parameters:
readOnly -
values - the values array (must be at least size 2)
isDirty - the isDirty-value
copy - copy the array?

Vector2i

protected Vector2i(boolean readOnly,
                   Tuple2i tuple)
Constructs and initializes a Point3i from the specified Point3i.

Parameters:
tuple - the Point3i containing the initialization x y z data

Vector2i

protected Vector2i(boolean readOnly)
Constructs and initializes a Point3i to (0,0,0).


Vector2i

public Vector2i(int x,
                int y)
Constructs and initializes a Point3i from the specified xyz coordinates.

Parameters:
x - the x coordinate
y - the y coordinate

Vector2i

public Vector2i(int[] values)
Constructs and initializes a Point3i from the specified array.

Parameters:
values - the array of length 3 containing xyz in order

Vector2i

public Vector2i(Tuple2i tuple)
Constructs and initializes a Point3i from the specified Point3i.

Parameters:
tuple - the Point3i containing the initialization x y z data

Vector2i

public Vector2i()
Constructs and initializes a Point3i to (0,0,0).

Method Detail

clone

public Vector2i clone()
Creates and returns a copy of this object.

Overrides:
clone in class Tuple2i
Returns:
a clone of this instance.
See Also:
Cloneable

asReadOnly

public Vector2i asReadOnly()

Overrides:
asReadOnly in class Tuple2i
Returns:
a new instance sharing the values array with this instance. The new instance is read-only. Changes to this instance will be reflected in the new read-only-instance.
See Also:
TupleNi.getReadOnly()

getReadOnly

public Vector2i getReadOnly()

Overrides:
getReadOnly in class Tuple2i
Returns:
a single instance sharing the values array with this instance (one unique instance per 'master-instance'). The instance is read-only. Changes to this instance will be reflected in the read-only-instance.
See Also:
TupleNi.asReadOnly()

newReadOnly

public static Vector2i newReadOnly(int x,
                                   int y)
Constructs and initializes a Point3i from the specified xyz coordinates.

Parameters:
x - the x coordinate
y - the y coordinate

newReadOnly

public static Vector2i newReadOnly(int[] values)
Constructs and initializes a Point3i from the specified array.

Parameters:
values - the array of length 3 containing xyz in order

newReadOnly

public static Vector2i newReadOnly(Tuple2i tuple)
Constructs and initializes a Point3i from the specified Point3i.

Parameters:
tuple - the Point3i containing the initialization x y z data

newReadOnly

public static Vector2i newReadOnly()
Constructs and initializes a Point3i to (0,0,0).


fromPool

public static Vector2i fromPool()
Allocates an Vector2i instance from the pool.


fromPool

public static Vector2i fromPool(int x,
                                int y)
Allocates an Vector2i instance from the pool.


fromPool

public static Vector2i fromPool(Tuple2i tuple)
Allocates an Vector2i instance from the pool.


toPool

public static void toPool(Vector2i o)
Stores the given Vector2i instance in the pool.

Parameters:
o -