|
The Physiologist's Friend Simulation API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Stimulus
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
.
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 |
---|
static final float FOREGROUND_BRIGHTNESS
static final float BACKGROUND_BRIGHTNESS
static final String BRIGHTEN_FOREGROUND
static final String DARKEN_FOREGROUND
static final String BRIGHTEN_BACKGROUND
static final String DARKEN_BACKGROUND
static final float RESIZE_RATIO
static final float ROTATE_BY
Method Detail |
---|
void setForegroundExcitationDensity(float foregroundExcitationDensity)
foregroundExcitationDensity
- The new excitation density.float getForegroundExcitationDensity()
void setBackgroundExcitationDensity(float backgroundExcitationDensity)
backgroundExcitationDensity
- The new excitation density.float getBackgroundExcitationDensity()
void brightenForeground()
void darkenForeground()
void brightenBackground()
void darkenBackground()
void flipContrast()
void setVisible(boolean flag)
boolean isVisible()
SeparateTransforms getTransforms()
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);
void setTransforms(SeparateTransforms transforms)
transsforms
- the transforms to set for the stimulusShapeList getShapes()
ShapeList getTransformedShapes()
void setShapes(ShapeList list)
void addShape(Transformable shape)
void removeShape(Transformable shape)
void clearShapes()
void shorten()
RESIZE_RATIO
void lengthen()
RESIZE_RATIO
void fatten()
RESIZE_RATIO
void thin()
RESIZE_RATIO
void expand()
RESIZE_RATIO
in both dimensions
void shrink()
RESIZE_RATIO
in both dimensions
void rotateCW()
ROTATE_BY
void rotateCCW()
ROTATE_BY
void rotate(int n)
n
*ROTATE_BY
n
- number of 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 |