The Physiologist's Friend Simulation API

ch.unizh.ini.friend.stimulus
Interface Stimulus

All Superinterfaces:
Updateable
All Known Subinterfaces:
ColorStimulus
All Known Implementing Classes:
AbstractStimulus, BarStimulus, ColorStimulusImpl, ConcreteStimulus, EdgeStimulus, GratingStimulus, SpotStimulus

public interface Stimulus
extends Updateable

Interface that a stimulus has to implement.

A stimulus has a background and foreground brightness, a set of shapes, and a transformation. Methods here give access to these chanacteristics of the stimulus.

A stimulus can be transformed using its transformation (getTransforms(), e.g.:

 
 Stimulus s; // initialized elsewhere
 s.getTransforms().translate(1,1);
 
 
Stimulus coordinate system is defined in TangentScreen as square coordinate systems with maximum value TangentScreen.SCREEN_DIMENSION in each direction. Screen is this high and wide and 0,0 is in the center of the screen.

These coordinates are scaled on rendering to the size of the TangentScreen.

Version:
$Revision: 1.18 $
Author:
Christof Marti/Tobi Delbruck

Field Summary
static float BACKGROUND_BRIGHTNESS
          the default background brightness: 0.25f
static String BRIGHTEN_BACKGROUND
          a command that a stimulus will accept.
static String BRIGHTEN_FOREGROUND
          a command that a stimulus will accept.
static String DARKEN_BACKGROUND
          a command that a stimulus will accept.
static String DARKEN_FOREGROUND
          a command that a stimulus will accept.
static float FOREGROUND_BRIGHTNESS
          the default foreground brightness: 0.75f
static float RESIZE_RATIO
          ratio by which to resize dimensions of stimulus
static float ROTATE_BY
          unit angle by which to rotate stimulus in radians: 0.5235987901687622f
 
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 darkenBackground()
          make background darker
 void darkenForeground()
          make foreground darker
 void expand()
          expand by ratio RESIZE_RATIO in both dimensions
 void fatten()
          fatten by ratio 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 untransformed shapes making up this stimulus
 ShapeList getTransformedShapes()
          get list of transformed shapes.
 SeparateTransforms getTransforms()
          return transforms on this stimulus.
 boolean isVisible()
          is stimulus hidden by its foreground brightness being set to the background?
 void lengthen()
          lengthen by ratio RESIZE_RATIO
 void removeShape(Transformable shape)
          remove a shape from the list of shapes
 void rotate(int n)
          rotate by n*ROTATE_BY
 void rotateCCW()
          rotate CCW by ROTATE_BY
 void rotateCW()
          rotate CW by 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 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()
          shorten by ratio RESIZE_RATIO
 void shrink()
          shrink by ratio RESIZE_RATIO in both dimensions
 void thin()
          thin by ratio RESIZE_RATIO
 
Methods inherited from interface ch.unizh.ini.friend.simulation.Updateable
compute, update
 

Field Detail

FOREGROUND_BRIGHTNESS

static final float FOREGROUND_BRIGHTNESS
the default foreground brightness: 0.75f

See Also:
Constant Field Values

BACKGROUND_BRIGHTNESS

static final float BACKGROUND_BRIGHTNESS
the default background brightness: 0.25f

See Also:
Constant Field Values

BRIGHTEN_FOREGROUND

static final String BRIGHTEN_FOREGROUND
a command that a stimulus will accept. Used for menu action event handlers.

See Also:
Constant Field Values

DARKEN_FOREGROUND

static final String DARKEN_FOREGROUND
a command that a stimulus will accept. Used for menu action event handlers.

See Also:
Constant Field Values

BRIGHTEN_BACKGROUND

static final String BRIGHTEN_BACKGROUND
a command that a stimulus will accept. Used for menu action event handlers.

See Also:
Constant Field Values

DARKEN_BACKGROUND

static final String DARKEN_BACKGROUND
a command that a stimulus will accept. Used for menu action event handlers.

See Also:
Constant Field Values

RESIZE_RATIO

static final float RESIZE_RATIO
ratio by which to resize dimensions of stimulus


ROTATE_BY

static final float ROTATE_BY
unit angle by which to rotate stimulus in radians: 0.5235987901687622f

See Also:
Constant Field Values
Method Detail

setForegroundExcitationDensity

void setForegroundExcitationDensity(float foregroundExcitationDensity)
Sets the foreground excitation density of the stimulus.

Parameters:
foregroundExcitationDensity - The new excitation density.

getForegroundExcitationDensity

float getForegroundExcitationDensity()
Returns the foreground excitation density of the stimulus.

Returns:
The excitation density.

setBackgroundExcitationDensity

void setBackgroundExcitationDensity(float backgroundExcitationDensity)
Sets the background excitation density of the stimulus.

Parameters:
backgroundExcitationDensity - The new excitation density.

getBackgroundExcitationDensity

float getBackgroundExcitationDensity()
Returns the background excitation density of the stimulus.

Returns:
The excitation density.

brightenForeground

void brightenForeground()
make foreground brighter


darkenForeground

void darkenForeground()
make foreground darker


brightenBackground

void brightenBackground()
make background brighter


darkenBackground

void darkenBackground()
make background darker


flipContrast

void flipContrast()
swap brightness of foreground and background


setVisible

void setVisible(boolean flag)
set state of stimulus to be hidden or shown. Stimulus is hidden by setting its brightness the same as the background.


isVisible

boolean isVisible()
is stimulus hidden by its foreground brightness being set to the background?


getTransforms

SeparateTransforms getTransforms()
return transforms on this stimulus. This method can be used to modify the transformation of the stimulus. E.g.:
     Stimulus s;  // initialized elsewhere
     s.getTransforms().translateTo(1f,2f);
     


setTransforms

void setTransforms(SeparateTransforms transforms)
set the transforms of this stimulus. This can be used, e.g., to set the transforms of a new stimulus to the same as the previous one.

Parameters:
transforms - the transforms to set for the stimulus

getShapes

ShapeList getShapes()
return list of untransformed shapes making up this stimulus


getTransformedShapes

ShapeList getTransformedShapes()
get list of transformed shapes. All the transformations of the stimulus are applied to the returned shapes.


setShapes

void setShapes(ShapeList list)
set list of shapes making up stimulus


addShape

void addShape(Transformable shape)
add a shape to the list of shapes making up the stimulus


removeShape

void removeShape(Transformable shape)
remove a shape from the list of shapes


clearShapes

void clearShapes()
clear the list of shapes


shorten

void shorten()
shorten by ratio RESIZE_RATIO


lengthen

void lengthen()
lengthen by ratio RESIZE_RATIO


fatten

void fatten()
fatten by ratio RESIZE_RATIO


thin

void thin()
thin by ratio RESIZE_RATIO


expand

void expand()
expand by ratio RESIZE_RATIO in both dimensions


shrink

void shrink()
shrink by ratio RESIZE_RATIO in both dimensions


rotateCW

void rotateCW()
rotate CW by ROTATE_BY


rotateCCW

void rotateCCW()
rotate CCW by ROTATE_BY


rotate

void rotate(int n)
rotate by n*ROTATE_BY

Parameters:
n - number of ROTATE_BY units to rotate

http://www.ini.unizh.ch/~tobi/friend