Class ProjectionXlateWrapper

java.lang.Object
  extended by ProjectionXlateWrapper
All Implemented Interfaces:
IProjection

public class ProjectionXlateWrapper
extends java.lang.Object
implements IProjection

Adapter to take one interface of type IProjection and make a IProjection which maps its inputs to a translation of the results of the wrapped IProjection on the same inputs

Since:
1.0

Method Summary
 int getScreenComp(int i, double[] arrLfState, int nIdxOff)
          Finds the ith component in screen coordinates of a vector indicated by the portion of the array arrLfState starting at nIdxOff; Fails if nIdxOff >= 2, or if wrapped projection is null.
 int height()
           
 int left()
           
 void resize(int nNewWidth, int nNewHeight)
           
 void scaleProjection(int nNewX, int nNewY)
           
 int scaleRadius(double lfRad)
          Simple scale function for 2d circles etc.
 int[] scaleVector(double[] arrLfVec, int nIdxOff)
          Scales (possibly including rotation and flip) a vector, without applying global translation
 int top()
           
 int width()
           
 void xlateProjection(int nXOff, int nYOff)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

resize

public void resize(int nNewWidth,
                   int nNewHeight)
Specified by:
resize in interface IProjection

scaleProjection

public void scaleProjection(int nNewX,
                            int nNewY)
Specified by:
scaleProjection in interface IProjection

xlateProjection

public void xlateProjection(int nXOff,
                            int nYOff)
Specified by:
xlateProjection in interface IProjection

getScreenComp

public int getScreenComp(int i,
                         double[] arrLfState,
                         int nIdxOff)
Finds the ith component in screen coordinates of a vector indicated by the portion of the array arrLfState starting at nIdxOff; Fails if nIdxOff >= 2, or if wrapped projection is null.

Specified by:
getScreenComp in interface IProjection
Parameters:
i - which component of screen coordinates to get (0=x, 1=y)
arrLfState - global state vector in sim coordinates
nIdxOff - offset index in arrLfState of the coord we're looking for
Returns:
ith component in screen coordinates

scaleVector

public int[] scaleVector(double[] arrLfVec,
                         int nIdxOff)
Scales (possibly including rotation and flip) a vector, without applying global translation

Specified by:
scaleVector in interface IProjection
Parameters:
arrLfVec - array containing vector to scale (transform)
nIdxOff - offset of begining of vector to scale in arrLfVec
Returns:
integer array containing scaled vector discretized to pixel differences.

scaleRadius

public int scaleRadius(double lfRad)
                throws java.lang.Exception
Simple scale function for 2d circles etc.

Specified by:
scaleRadius in interface IProjection
Throws:
java.lang.Exception

width

public int width()
Specified by:
width in interface IProjection

height

public int height()
Specified by:
height in interface IProjection

top

public int top()
Specified by:
top in interface IProjection

left

public int left()
Specified by:
left in interface IProjection