org.openmali.vecmath2
Class Point2i

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

public class Point2i
extends Tuple2i
implements java.io.Externalizable

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

See Also:
Serialized Form

Field Summary
static Point2i ZERO
           
 
Fields inherited from class org.openmali.vecmath2.TupleNi
isDirty, N, roTrick, values
 
Constructor Summary
  Point2i()
          Constructs and initializes a Point3i to (0,0,0).
protected Point2i(boolean readOnly)
          Constructs and initializes a Point3i to (0,0,0).
protected Point2i(boolean readOnly, int[] values, boolean[] isDirty, boolean copy)
          Constructs and initializes a Point3i from the specified array.
protected Point2i(boolean readOnly, int x, int y)
          Constructs and initializes a Point3i from the specified xyz coordinates.
protected Point2i(boolean readOnly, Tuple2i tuple)
          Constructs and initializes a Point3i from the specified Point3i.
  Point2i(int[] values)
          Constructs and initializes a Point3i from the specified array.
  Point2i(int x, int y)
          Constructs and initializes a Point3i from the specified xyz coordinates.
  Point2i(Tuple2i tuple)
          Constructs and initializes a Point3i from the specified Point3i.
 
Method Summary
 Point2i asReadOnly()
          
 Point2i clone()
          Creates and returns a copy of this object.
static Point2i fromPool()
          Allocates an Point2i instance from the pool.
static Point2i fromPool(int x, int y)
          Allocates an Point2i instance from the pool.
static Point2i fromPool(Tuple2i tuple)
          Allocates an Point2i instance from the pool.
 Point2i getReadOnly()
          
static Point2i newReadOnly()
          Constructs and initializes a Point3i to (0,0,0).
static Point2i newReadOnly(int[] values)
          Constructs and initializes a Point3i from the specified array.
static Point2i newReadOnly(int x, int y)
          Constructs and initializes a Point3i from the specified xyz coordinates.
static Point2i newReadOnly(Tuple2i tuple)
          Constructs and initializes a Point3i from the specified Point3i.
static void toPool(Point2i o)
          Stores the given Point2i 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 Point2i ZERO
Constructor Detail

Point2i

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

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

Point2i

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

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

Point2i

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

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

Point2i

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

Parameters:
readOnly -

Point2i

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

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

Point2i

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

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

Point2i

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

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

Point2i

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

Method Detail

clone

public Point2i 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 Point2i 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 Point2i 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 Point2i 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 Point2i 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 Point2i 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 Point2i newReadOnly()
Constructs and initializes a Point3i to (0,0,0).


fromPool

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


fromPool

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


fromPool

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


toPool

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

Parameters:
o -