net.nexttext
Class CoordinateSystem

java.lang.Object
  extended by net.nexttext.CoordinateSystem

public class CoordinateSystem
extends java.lang.Object

A CoordinateSystem describe a set of three Axes positioned at some arbitrary origin in space.

  (origin)_ _ _ _ x
                |\
                | \
                |  \z
                y
 


Constructor Summary
CoordinateSystem()
          Creates a "default" CoordinateSystem where the origin is (0,0,0) and each axes is a unit vector.
CoordinateSystem(processing.core.PVector origin, float rotation)
          Creates a CoordinateSystem with the specified origin and rotation
CoordinateSystem(processing.core.PVector origin, float rotation, CoordinateSystem parentSystem)
          Creates a CoordinateSystem with the specified origin and rotation, then transforms it by the specified parent system.
 
Method Summary
 processing.core.PVector getOrigin()
          Returns a copy of the origin vector.
 java.lang.String toString()
           
 java.awt.Polygon transform(java.awt.Polygon inPoly)
          Transforms a polygon out of this coordinate system.
 processing.core.PVector transform(processing.core.PVector inV)
          Takes a vector local to this coordinate system and returns an equivalent vector transformed "out of" this system such that the vector is now relative to the parent system.
 processing.core.PVector transformInto(processing.core.PVector inV)
          Transforms a vector from the parent system such that it is now relative to this system.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CoordinateSystem

public CoordinateSystem()
Creates a "default" CoordinateSystem where the origin is (0,0,0) and each axes is a unit vector.


CoordinateSystem

public CoordinateSystem(processing.core.PVector origin,
                        float rotation)
Creates a CoordinateSystem with the specified origin and rotation


CoordinateSystem

public CoordinateSystem(processing.core.PVector origin,
                        float rotation,
                        CoordinateSystem parentSystem)
Creates a CoordinateSystem with the specified origin and rotation, then transforms it by the specified parent system. XXXBUG This description is not explicit enough.

Method Detail

getOrigin

public processing.core.PVector getOrigin()
Returns a copy of the origin vector.


transform

public processing.core.PVector transform(processing.core.PVector inV)
Takes a vector local to this coordinate system and returns an equivalent vector transformed "out of" this system such that the vector is now relative to the parent system.

Transforms a vector local to this coordinate system by aligning it with this system's axes and translating by this system's origin.

Parameters:
inV - the input vector; the vector will remain unchanged.
Returns:
the equivalent vector relative to the parent system.

transform

public java.awt.Polygon transform(java.awt.Polygon inPoly)
Transforms a polygon out of this coordinate system.

Polygons are 2D, so the transformation is done with the assumption that all Z values are 0.

Returns:
a new Polygon object.

transformInto

public processing.core.PVector transformInto(processing.core.PVector inV)
Transforms a vector from the parent system such that it is now relative to this system.

Parameters:
inV - the input vector; the vector will remain unchanged.
Returns:
the transformed vector

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object