utility
Class Visualizer

java.lang.Object
  extended by com.cycling74.max.MaxObject
      extended by utility.Visualizer

public class Visualizer
extends com.cycling74.max.MaxObject

This class encapsulates a graphical animation that provides a visualization of a single particle moving around a space. The visualization relies on the client to dictate the position of the particle. The animation is driven by the client successively updating the particle's position.

Author:
mb

Field Summary
 
Fields inherited from class com.cycling74.max.MaxObject
EMPTY_STRING_ARRAY, NO_INLETS, NO_OUTLETS
 
Constructor Summary
Visualizer(int horizontalDimension, int verticalDimension)
           
 
Method Summary
static java.awt.Color chooseColorFromSpectrum(float normalizedHueAngle)
          Returns a color from the spectrum that spans from red to violet.
 void inlet(java.awt.Point p)
          Specify the next position of the particle and redraw the canvas.
 void setColor(java.awt.Color c)
           
 
Methods inherited from class com.cycling74.max.MaxObject
error, gc, getAttr, getAttrAtomArray, getAttrBool, getAttrBoolArray, getAttrByte, getAttrByteArray, getAttrChar, getAttrCharArray, getAttrDouble, getAttrDoubleArray, getAttrFloat, getAttrFloatArray, getAttributeInfo, getAttrInt, getAttrIntArray, getAttrLongArray, getAttrShort, getAttrShortArray, getAttrString, getAttrStringArray, getCodeSourcePath, getContext, getErrorStream, getInfoIdx, getInletAssist, getInletType, getLongAttr, getMaxBox, getName, getNumInlets, getNumOutlets, getOutletAssist, getOutletType, getParentPatcher, getPostStream, ouch, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outlet, outletBang, outletBangHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, outletHigh, post, postCodePath, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setName, showException, showException, toString, viewsource, zap
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Visualizer

public Visualizer(int horizontalDimension,
                  int verticalDimension)
Method Detail

inlet

public void inlet(java.awt.Point p)
Specify the next position of the particle and redraw the canvas.

Parameters:
p - the next position of the particle.

setColor

public void setColor(java.awt.Color c)

chooseColorFromSpectrum

public static java.awt.Color chooseColorFromSpectrum(float normalizedHueAngle)
Returns a color from the spectrum that spans from red to violet. A value of 0 returns red. The intermediate values span red, orange, yellow, green, blue, indigo. A value of 1 returns reddish-indigo (but mostly reddish). Hue angle in the HSV color model ranges over [0,2*Math.PI] in radians or [0,360] in degrees. See the HSV model illustration in wikipedia entry [http://en.wikipedia.org/wiki/HSL_and_HSV]. This method accepts a value over the interval [0,1].

Parameters:
normalizedHueAngle - a float on the closed interval [0,1]
Returns:
a color, as described above