|
The Physiologist's Friend Simulation API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.unizh.ini.friend.stimulus.AbstractStimulus
public abstract class AbstractStimulus
Provides default implementations for a stimulus, including it's foreground and background brightness, its shapes' container, and the transform applied to the shapes.
Field Summary | |
---|---|
protected float |
backgroundExcitationDensity
The background excitation density. |
static float |
BRIGHTNESS_CHANGE_RATIO
factor to change brightness of foreground or background by for brightenForeground() , etc. |
protected float |
foregroundExcitationDensity
The foreground excitation density. |
protected float |
newBackgroundExcitationDensity
The new background excitation density. |
protected float |
newForegroundExcitationDensity
The new foreground excitation density. |
protected ShapeList |
newShape
the new set of shapes |
protected ShapeList |
shapes
the list of original (untransformed) shapes making up the stimulus |
SeparateTransforms |
transforms
The transforms of the stimulus. |
Fields inherited from interface ch.unizh.ini.friend.stimulus.Stimulus |
---|
BACKGROUND_BRIGHTNESS, BRIGHTEN_BACKGROUND, BRIGHTEN_FOREGROUND, DARKEN_BACKGROUND, DARKEN_FOREGROUND, FOREGROUND_BRIGHTNESS, RESIZE_RATIO, ROTATE_BY |
Constructor Summary | |
---|---|
AbstractStimulus()
|
Method Summary | |
---|---|
void |
addShape(Transformable shape)
add a shape to the list of shapes making up the stimulus |
void |
brightenBackground()
make background brighter |
void |
brightenForeground()
make foreground brighter |
void |
clearShapes()
clear the list of shapes |
void |
compute(float dt)
Computes the new state of this component of the simulation. |
void |
darkenBackground()
make background darker |
void |
darkenForeground()
make foreground darker |
void |
expand()
expand by ratio Stimulus.RESIZE_RATIO in both dimensions |
void |
fatten()
fatten by ratio Stimulus.RESIZE_RATIO |
void |
flipContrast()
swap brightness of foreground and background |
float |
getBackgroundExcitationDensity()
Returns the background excitation density of the stimulus. |
float |
getForegroundExcitationDensity()
Returns the foreground excitation density of the stimulus. |
ShapeList |
getShapes()
return list of original (untransformed) shapes making up this stimulus |
ShapeList |
getTransformedShapes()
return transformed shapes. |
SeparateTransforms |
getTransforms()
return transforms operating on this stimulus |
boolean |
isVisible()
is stimulus hidden by its foreground brightness being set to the background? |
void |
lengthen()
lengthen by ratio Stimulus.RESIZE_RATIO |
void |
removeShape(Transformable shape)
remove a shape from the list of shapes |
void |
rotate(int n)
rotate by n *Stimulus.ROTATE_BY |
void |
rotateCCW()
rotate CCW by Stimulus.ROTATE_BY |
void |
rotateCW()
rotate CW by Stimulus.ROTATE_BY |
void |
setBackgroundExcitationDensity(float backgroundExcitationDensity)
Sets the background excitation density of the stimulus. |
void |
setForegroundExcitationDensity(float foregroundExcitationDensity)
Sets the foreground excitation density of the stimulus. |
void |
setShapes(ShapeList list)
set list of untransformed shapes making up stimulus. |
void |
setTransforms(SeparateTransforms transforms)
set the transforms of this stimulus. |
void |
setVisible(boolean flag)
set state of stimulus to be hidden or shown. |
void |
shorten()
make shorter by ratio Stimulus.RESIZE_RATIO |
void |
shrink()
shrink by ratio Stimulus.RESIZE_RATIO in both dimensions |
void |
thin()
thin by ratio Stimulus.RESIZE_RATIO |
String |
toString()
String representation of stimulus |
void |
update()
Updates the actual state to the newly computed - aka double-buffering. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected float foregroundExcitationDensity
protected float backgroundExcitationDensity
protected float newForegroundExcitationDensity
protected float newBackgroundExcitationDensity
public static final float BRIGHTNESS_CHANGE_RATIO
brightenForeground()
, etc.
protected ShapeList shapes
protected ShapeList newShape
public SeparateTransforms transforms
Constructor Detail |
---|
public AbstractStimulus()
Method Detail |
---|
public float getBackgroundExcitationDensity()
getBackgroundExcitationDensity
in interface Stimulus
public float getForegroundExcitationDensity()
getForegroundExcitationDensity
in interface Stimulus
public void setBackgroundExcitationDensity(float backgroundExcitationDensity)
setBackgroundExcitationDensity
in interface Stimulus
backgroundExcitationDensity
- The new excitation density.public void setForegroundExcitationDensity(float foregroundExcitationDensity)
setForegroundExcitationDensity
in interface Stimulus
foregroundExcitationDensity
- The new excitation density.public void brightenForeground()
brightenForeground
in interface Stimulus
public void darkenForeground()
darkenForeground
in interface Stimulus
public void brightenBackground()
brightenBackground
in interface Stimulus
public void darkenBackground()
darkenBackground
in interface Stimulus
public void flipContrast()
flipContrast
in interface Stimulus
public void setVisible(boolean flag)
setVisible
in interface Stimulus
public boolean isVisible()
isVisible
in interface Stimulus
public void compute(float dt)
compute
in interface Updateable
dt
- The time that has passed since the last invocation.public void update()
update
in interface Updateable
public ShapeList getShapes()
getShapes
in interface Stimulus
public void setShapes(ShapeList list)
ShapeList
is wrapped inside a new set of SeparateTransforms
, so
any existing transformations are lost. Hence this method
resets the transform applied to the shapes.
setShapes
in interface Stimulus
list
- the shapes to usepublic void addShape(Transformable shape)
addShape
in interface Stimulus
public void removeShape(Transformable shape)
removeShape
in interface Stimulus
public void clearShapes()
clearShapes
in interface Stimulus
public SeparateTransforms getTransforms()
getTransforms
in interface Stimulus
public void setTransforms(SeparateTransforms transforms)
setTransforms
in interface Stimulus
transforms
- the transforms to set for the stimuluspublic ShapeList getTransformedShapes()
getTransformedShapes
in interface Stimulus
public String toString()
toString
in class Object
public void lengthen()
Stimulus.RESIZE_RATIO
lengthen
in interface Stimulus
public void shorten()
Stimulus.RESIZE_RATIO
shorten
in interface Stimulus
public void fatten()
Stimulus.RESIZE_RATIO
fatten
in interface Stimulus
public void thin()
Stimulus.RESIZE_RATIO
thin
in interface Stimulus
public void expand()
Stimulus.RESIZE_RATIO
in both dimensions
expand
in interface Stimulus
public void shrink()
Stimulus.RESIZE_RATIO
in both dimensions
shrink
in interface Stimulus
public void rotateCCW()
Stimulus.ROTATE_BY
rotateCCW
in interface Stimulus
public void rotateCW()
Stimulus.ROTATE_BY
rotateCW
in interface Stimulus
public void rotate(int n)
n
*Stimulus.ROTATE_BY
rotate
in interface Stimulus
n
- number of Stimulus.ROTATE_BY
units to rotate
|
http://www.ini.unizh.ch/~tobi/friend | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |