FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Automated Systems
(Moderator: REAS)
   Monster Scanner
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Monster Scanner  (Read 1066 times)
Leroy.Mungo

WWW
Monster Scanner
« on: Nov 29th, 2002, 5:20pm »

// Monster_Scanner by Magnus Torstensson
// a radar/sonar kind of thing
// applet and more info can be found at:
// http://people.interaction-ivrea.it/m.torstensson/monster_scanner.asp
 
 
int centerPoint;
float  myRotSpeed = 0.025;
float  myGrowSpeed = 0.40;
 
float myRadius;
int thingSize;
 
int points = 100;
 
float a = 0.0; // Walking through the angles
float r = 0.0; // Walking through the radius
 
float[] alpha = new float[points];
float[] radius = new float[points];
float[] size = new float[points];
 
void setup() {
  size(200 , 200);
  background(255,255,255);
 
   
 
  centerPoint = width/2;
  myRadius = float(width/2);
  thingSize = width/40;
 
  ellipseMode(CENTER_RADIUS);
 
   
 
  for(int i=0; i<points; i++) {
    alpha[i] = random(0, TWO_PI);
    radius[i] = random(10, myRadius);
    size[i] = random(0, thingSize);
  }
}
 
void mradar() {
  noStroke();
  fill(204, 102, 0);
  for(int i=0; i<points; i++) {
 
    if ((alpha[i] > a - PI/10) && (alpha[i] < a + PI/10)) {
 rect(centerPoint+cos(alpha[i])*radius[i], centerPoint+sin(alpha[i])*radius[i], size[i], size[i]);
    }
  }
}
 
void msonar(){
  stroke(162, 0, 0);
  ellipse(width/2, height/2, r, r);
  noStroke();
  fill(204, 102, 230);
  for(int i=0; i<points; i++) {
    if ((radius[i] > r - 5) && (radius[i] < r + 5)) {
 ellipse(centerPoint+cos(alpha[i])*radius[i], centerPoint+sin(alpha[i])*radius[i], size[i], size[i]);
    }
  }
}
 
void updateVariables() {
  a += myRotSpeed; // Sets the speed of the rotation
  if (a > TWO_PI) {
    a = 0.0;
  }
 
  r += myGrowSpeed; // Sets the speed of growing circle
  if (r > myRadius) {
    r = 0.0;
  }
}
 
void loop() {
  updateVariables();
  noStroke();
  fill(20,0,67);
  ellipse(centerPoint, centerPoint, centerPoint, centerPoint);
 
  if (mouseX < centerPoint){
    mradar();
  }
  else {
    msonar();
  }
 
}
 
 
fdb

illililli@mac.com WWW
Re: Monster Scanner
« Reply #1 on: Dec 12th, 2002, 8:37pm »

i read the information about it, and it seems like a fun project. It is something that generates lots of ideas and a sense of nostalgia.  
 
Also, the implementation is fun, but perhaps maybe a bit too spartan. How does a child know that there are no monsters? I only see blobby things, that might be monsters or not. Will the device be self-explanatory or will the child have to learn how it works?  
 
A very interesting project, that goes straight to the heart of every person who has ever been a kid. I wish I had one of those when I was little.
 
Pages: 1 

« Previous topic | Next topic »