net.nexttext.property
Class PVectorProperty

java.lang.Object
  extended by net.nexttext.property.Property
      extended by net.nexttext.property.PVectorProperty
All Implemented Interfaces:
java.lang.Cloneable

public class PVectorProperty
extends Property

A PVector property of a TextObject or a Behaviour.

Note that defensive copies of the current value and and original value of the properties are always created when getting or setting the property.

Also note that every wrapper method around vector arithmetic operations will fire a property change event. Maybe we want to consider removing these wrappers to lower the event overhead.

See Also:
PVector

Constructor Summary
PVectorProperty(float x, float y)
          Creates a PVectorProperty from 2 float, using 0 as the z coordinate.
PVectorProperty(float x, float y, float z)
          Creates a PVectorProperty from 3 floats.
PVectorProperty(processing.core.PVector value)
          Constructor.
PVectorProperty(processing.core.PVector original, processing.core.PVector value)
          Construct a property with specified original and future values.
 
Method Summary
 void add(processing.core.PVector v1)
          Wrapper around vector addition of Vector3 class
 PVectorProperty clone()
          Get a new property with the same values as this one.
 void cross(processing.core.PVector v1)
          Wrapper around vector cross product of Vector3 class
 float dot(processing.core.PVector v1)
          Wrapper around vector dot product of Vector3 class
 processing.core.PVector get()
          Returns the value of this property.
 processing.core.PVector getOriginal()
          Returns a copy of the original value of this property
 float getX()
           
 float getY()
           
 float getZ()
           
 void matrix(processing.core.PVector v1)
          Wrapper around vector matrix product of Vector3 class
 void normalize()
          Wrapper around vector normalization of Vector3 class
 void reset()
          Replaces the value of this property by its original value.
 void rotate(float angle)
          Wrapper around vector rotation of Vector3 class
 void scalar(float s)
          Wrapper around vector scalar product of Vector3 class
 void set(processing.core.PVector newValue)
          Sets the value of this property.
 void setOriginal(processing.core.PVector newValue)
          Set the original value of the property.
 void sub(processing.core.PVector v1)
          Wrapper around vector substraction of Vector3 class
 java.lang.String toString()
          Wrapper around toString() function of Vector3 class.
 
Methods inherited from class net.nexttext.property.Property
addChangeListener, getName, setName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PVectorProperty

public PVectorProperty(processing.core.PVector value)
Constructor. Creates a new PVectorProperty based on the object passed as a parameter. The current and original values for that property will both be a copy of the parameter value.


PVectorProperty

public PVectorProperty(float x,
                       float y,
                       float z)
Creates a PVectorProperty from 3 floats.


PVectorProperty

public PVectorProperty(float x,
                       float y)
Creates a PVectorProperty from 2 float, using 0 as the z coordinate.


PVectorProperty

public PVectorProperty(processing.core.PVector original,
                       processing.core.PVector value)
Construct a property with specified original and future values.

The provided vectors are copied. This function is used for the special purpose of calculating an absolute position from the natively stored relative positions.

Method Detail

getOriginal

public processing.core.PVector getOriginal()
Returns a copy of the original value of this property


setOriginal

public void setOriginal(processing.core.PVector newValue)
Set the original value of the property.


get

public processing.core.PVector get()
Returns the value of this property.

Returns:
A copy of the value of this property.

set

public void set(processing.core.PVector newValue)
Sets the value of this property. The object passed as a newValue will be copied before it is assigned to the property's value.


reset

public void reset()
Replaces the value of this property by its original value.

Specified by:
reset in class Property

getX

public float getX()

getY

public float getY()

getZ

public float getZ()

add

public void add(processing.core.PVector v1)
Wrapper around vector addition of Vector3 class


sub

public void sub(processing.core.PVector v1)
Wrapper around vector substraction of Vector3 class


cross

public void cross(processing.core.PVector v1)
Wrapper around vector cross product of Vector3 class


matrix

public void matrix(processing.core.PVector v1)
Wrapper around vector matrix product of Vector3 class


scalar

public void scalar(float s)
Wrapper around vector scalar product of Vector3 class


dot

public float dot(processing.core.PVector v1)
Wrapper around vector dot product of Vector3 class


normalize

public void normalize()
Wrapper around vector normalization of Vector3 class


rotate

public void rotate(float angle)
Wrapper around vector rotation of Vector3 class


toString

public java.lang.String toString()
Wrapper around toString() function of Vector3 class.

Overrides:
toString in class java.lang.Object

clone

public PVectorProperty clone()
Description copied from class: Property
Get a new property with the same values as this one.

The name is copied because that's what makes it a Property and not just a value.

PropertyChangeListeners are not copied to the new Property.

Overrides:
clone in class Property