Simulation von Bürgern
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

citizen.pde 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*asd*/
  2. import gab.opencv.*;
  3. OpenCV opencv;
  4. PImage img_streets;
  5. PImage img_houses;
  6. PGraphics pg_map;
  7. boolean b_isRaining;
  8. class Citizen{
  9. int i_xSpawn, i_ySpawn, i_xPos, i_yPos;
  10. String s_clan;
  11. Citizen(){
  12. }
  13. void spawn(){
  14. i_xSpawn = int(random(0,width));
  15. i_ySpawn = int(random(0,height));
  16. i_xPos = i_xSpawn;
  17. i_yPos = i_ySpawn;
  18. //if(random(0,1) > .5)
  19. // berufsfeld: webdesigner, pädagoge, schmuckdesigner, schmied
  20. // berufsstatus: beamter, selbstständiger, unternehmer, angestellter, grundschüler, gymnasiast, hauptschüler, realschüler, azubi, student, rentner
  21. // identität: gelbhemd, lokal, regional, national, international, fremd,
  22. }
  23. void update(){
  24. }
  25. void display(){
  26. }
  27. }
  28. Citizen mensch;
  29. //distributionArea =
  30. void setup(){
  31. size(777,777);
  32. textSize(30);
  33. fill(0);
  34. opencv = new OpenCV( this );
  35. img_streets = loadImage(dataPath("map/streets.png"));
  36. img_houses = loadImage(dataPath("map/houses_with_borders.png"));
  37. surface.setResizable(true);
  38. surface.setSize(img_streets.width,img_streets.height);
  39. blendMode(MULTIPLY);
  40. generate_Spawns();
  41. mensch = new Citizen();
  42. mensch.spawn();
  43. }
  44. SpawnArea[] spawnAreas;
  45. class SpawnArea{
  46. //simplified hull?
  47. SpawnArea(){
  48. }
  49. }
  50. void generate_Spawns(){
  51. img_houses.loadPixels();
  52. //needs proper blob-detection
  53. for(int y = 0; y < img_houses.height; y++){
  54. for(int x = 0; x < img_houses.width; x++){
  55. float r = red(img_houses.pixels[(y*img_houses.width)+x]);
  56. if(r == 187) point(x, y);
  57. }
  58. }
  59. img_houses.updatePixels();
  60. }
  61. void draw(){
  62. background(255);
  63. image(img_streets,0,0,img_streets.width, img_streets.height);
  64. image(img_houses,0,0,img_houses.width, img_houses.height);
  65. mensch.update();
  66. text(int(frameRate),0,30);
  67. }