Computation as an Expressive Medium - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Computation as an Expressive Medium

Description:

do nifty drawing effects. The Methods and Classes. setup() draw() keyPressed() Vehicle ... field is a 2D array of float values ... Do nifty drawing effects ... – PowerPoint PPT presentation

Number of Views:66
Avg rating:3.0/5.0
Slides: 10
Provided by: jasonalder
Category:

less

Transcript and Presenter's Notes

Title: Computation as an Expressive Medium


1
Computation as an Expressive Medium
  • Lab 11 Looking through the Braitenberg Vehicle
    code
  • Annie Lausier

2
Braitenberg! (It's so fun to say. Try it!)
  • Look through the sections of the code
  • How-to tips to
  • change the behavior of vehicle
  • add another set of sources
  • put sources on vehicles
  • do nifty drawing effects

3
The Methods and Classes
SensoryField
Vehicle
Sensor
Sensor()
Vehicle()
get()
drawMe()
drawMe()
setup()
SensoryField()
addSource()
moveMe()
setLocation()
draw()
deleteSource()
getSense()
checkCollision()
keyPressed()
getSource()
checkBounds()
Source
Source()
mousePressed()
numSources()
setVelocityL()
drawMe()
mouseReleased()
update()
setVelocityR()
setLocation()
updateGround()
doSenseLogic()
hitTest()
updateAll()
getValue()
Wheel
Wheel()
getVisible()
drawMe()
getInfluence()
setVisible()
setVelocity()
drawMe()
4
The Vehicle
Vehicle
Sensor
Sensor()
Vehicle()
drawMe()
drawMe()
2x
moveMe()
setLocation()
getSense()
checkCollision()
checkBounds()
setVelocityL()
Wheel
Wheel()
setVelocityR()
2x
drawMe()
doSenseLogic()
setVelocity()
5
The SensoryField
SensoryField
get()
Source
SensoryField()
Source()
addSource()
drawMe()
deleteSource()
setLocation()
getSource()
hitTest()
update()
getValue()

getInfluence()
ArrayList sources
float field
field is a 2D array of float values from 0 to
255(we translate these values to a color to
draw the ground)
6
Change the vehicle behavior?
  • Keys can adjust type of vehicles
  • Can create new Vehicle subclass to make new kind
    of vehicle

7
Add another type of source?
  • Create a new SensoryField class
  • Things to watch for
  • almost all the methods reference ONLY
    lightsGround
  • You'll have to change the Vehicle's Sensors'
    getSense methods (or add more sensors on the
    Vehicle)
  • doSenseLogic() will probably need to be changed,
    so that the wheels get a combination of inputs
  • defining the pixels of PImage ground will need to
    somehow show sources differently

8
Put a source on a vehicle
  • You need the Sources to be in a SensoryField of
    their own so you'll want a pointer field in
    Vehicle (perhaps just an id that references the
    Vehicle's particular Source in the SensoryField
    ArrayList)
  • And don't forget to change the source location
    when the Vehicle moves (instead of when the mouse
    drags)
  • Things to watch for
  • If a Vehicle has a Source and can sense that same
    type of Source on other Vehicles, then you need
    to make sure that it subtracts the value of its
    own Source when sensing (the getReading under the
    x, y of the Sensor)
  • Sources are currently added or subtracted from
    the SensoryField when user presses number keys
    make this different for your new SensoryField,
    since Sources are tied to Vehicles instead of
    free-floating.

9
Do nifty drawing effects
  • Now that you have a 2D array, you don't have to
    draw to a PImage ground
  • You could draw rect()s or ellipse()s or use some
    other kind of icon to represent each "pixel" in
    the ground of your source

Image from carnivore.webcam.sniffingusing
Safari .html icons for each pixel.
Write a Comment
User Comments (0)
About PowerShow.com