net.nexttext
Class PLocatableVector

java.lang.Object
  extended by net.nexttext.PLocatableVector
All Implemented Interfaces:
Locatable

public class PLocatableVector
extends java.lang.Object
implements Locatable

The PLocatableVector encapsulates a PVector to use as a Locatable object.

The PVector class is part of the Processing core library so we are unable to have it implement the Locatable interface which is used by the behaviours. As a workaround, the PLocatableVector class is used, mainly internally to accept PVectors as argument.

Instead of extending from the PVector class, we store a PVector as variable. This allows to pass a PVector as argument to the constructor and store a pointer to it. This way modifying the PVector outside of the PLocatableVector object will change the value returned by the PLocatableVector object.


Constructor Summary
PLocatableVector()
          Default constructor -- x, y and z gets assigned the value 0 by default.
PLocatableVector(float x, float y)
          Constructs and initialize using xy properties ( z = 0 by default ).
PLocatableVector(float x, float y, float z)
          Constructs and initialize using xyz properties.
PLocatableVector(processing.core.PVector vector)
          Constructs and store pointer to the PVector.
 
Method Summary
 processing.core.PVector getLocation()
          A PLocatableVector implements the Locatable interface so that it can be used as a "location constant".
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PLocatableVector

public PLocatableVector()
Default constructor -- x, y and z gets assigned the value 0 by default.


PLocatableVector

public PLocatableVector(float x,
                        float y)
Constructs and initialize using xy properties ( z = 0 by default ).


PLocatableVector

public PLocatableVector(float x,
                        float y,
                        float z)
Constructs and initialize using xyz properties.


PLocatableVector

public PLocatableVector(processing.core.PVector vector)
Constructs and store pointer to the PVector.

Method Detail

getLocation

public processing.core.PVector getLocation()
A PLocatableVector implements the Locatable interface so that it can be used as a "location constant".

Specified by:
getLocation in interface Locatable
Returns:
The object's location in absolute coordinates.