æ±æ¥æ¬å¤§éç½(æ±åé¢æ±å¤§éç½)ã«ãã被害ãåããããæ¹ã
ã«ã¯å¿ãããè¦èãç³ãä¸ãã¾ã。
以å、æ¥æ¬å ¨å½ã³ã³ããåºèåå¸å°å³ãProcessingã§ä½ã£ãã、ä»åã®å°éã®éæºã¨ãã®å¤§ããã«ã¤ãã¦è¦è¦çã«è¡¨ããå°å³ãä½æãã。å°ãã§ãä½ãã®å½¹ã«ç«ã¦ã°è¯ãã®ã ã。
éæºã¨ãã®å¤§ãããæ¥æ¬å°å³ä¸ã«åã¨ãã¦è¡¨ç¾ãã¦ãã。åã®å¤§ããã¯ãã°ããã¥ã¼ãã¨éæºã®æ·±ãã«ä¾åãã¦ãã(ããã¯å¤§ã¾ããªç®å®ã§ãã、æºããå°åãé度・ã¨ãã«ã®ã¼ã«æ£ç¢ºã«å¯¾å¿ãã¦ããããã§ã¯ãªã)。ã¾ã、éæºã®æ·±ãã«ãã£ã¦åã®è²ãå¤ãã、æµ ããã°èµ¤ã«、æ·±ããã°ç·ã«è¿ã¥ã。æµ·ã®è²ã¯æå»ãç¾ãã¦ãã、æ£åãæãæããéã§è¡¨ç¾ãã、æ·±å¤ã§ããã°çã£é»ã¨ãªã。ãã¼ã¿ã«ã¤ãã¦ã¯、æ¥æ¬æ°è±¡åä¼ãæä¾ãã¦ãã3æ9æ¥ãã20æ¥ã¾ã§ã®å°éæ å ±ãå©ç¨ããã¦é ãã。
æä½æ¹æ³ã¯、ã¹ãã¼ã¹ãã¼ã§ãã¼ãº、'N'ãã¼ã§3æéé²ã、'B'ãã¼ã§3æéæ»ã。'+'ãã¼ã§æéã®é²ã¿ãéããªã、'-'ãã¼ã§é ããªã。ãã¦ã¹ã®å·¦ã¯ãªãã¯ã§ãã©ãã°ããã°å°å³ãåãããã¨ãã§ã、å³ã¯ãªãã¯ã§ä¸ä¸ã«ãã©ãã°ããã°æ¡å¤§・縮å°ã¨ãªã。
å¯è¦åå°å³ãã、3æ11æ¥14æ46åã®ãã°ããã¥ã¼ã9.0ã®å°éã®èµ·ããäºæ¥ã»ã©åãã、ä¸é¸æ²ã§ä¸è¦æ¨¡ã®å°éãé »çºãã¦ãããã¨ãåãã。ã¨ããã、M9.0ã®å°éã®æ°æéåããã¯æºããå ¨ã¦é絶ã、åµã®åã®éããã®æ§ç¸ã¨ãªã。ããã¦、M9.0ã®å°éã®ç´å¾ããã¯ã²ã£ãããªãã«æºããç¶ã、æ°æ¥ãã¦ããæ²éåãã¦ãã¦ãã。ãã 、M6ç¨åº¦ã®å°éã¯æªã ã«èµ·ãã£ã¦ããã®ã§、å®å¿ããã«ã¯ã¾ã æ©ããããããªã。æè¿ã®å°éã§ã¯ç¦å³¶çæ²ãè¨åçæ²ã«å¤ã、ããã¨åä¸ãã¦ããæ§åãåãã。
以ä¸、ã½ã¼ã¹ã³ã¼ãã示ã。
earthquake.pde
/* earthquake.pde by nox, 2011.3.22 */ String convData = "quake.tsv.gz"; String japanMap = "japan.svg"; PShape mapShape; int totalCount; Place[] places; int placeCount = 0; final float minX = -0.19834; final float maxX = 0.2425; final float minY = -0.1875; final float maxY = 0.1845; PImage mapImage; PFont font; float offsetX = 0.0; float offsetY = 0.0; int centerX = 0; int centerY = 0; float zoom = 1.0; int mxStart, myStart, myPos; int startTime, currentTime, stopTime; int month_, day_, hour_, minute_; boolean is_paused = false; int speed = 10; public void setup() { mapShape = loadShape(japanMap); smooth(); loop(); size(int(mapShape.width), int(mapShape.height), JAVA2D); // 539, 563 shapeMode(CORNER); mapShape.disableStyle(); font = loadFont("CourierNewPSMT-14.vlw"); textMode(SCREEN); textFont(font); readData(); startTime = millis(); loop(); } public void draw() { if (!mousePressed) currentTime = millis() - startTime; int currentDate = currentTime + (hour_ * 60 + minute_) * speed; int mon_ = month_; int d_ = day_ + currentDate / (24 * 60 * speed); int h_ = currentDate / (60 * speed) % 24; int m_ = currentDate / speed % 60; if (d_ >= 21 || d_ <= 8 || h_ < 0 || m_ < 0) startTime = millis(); background(color(0, 0, (720 - abs(h_ * 60 + m_ - 720)) * 0.1)); noStroke(); fill(32); shape(mapShape, int(offsetX * zoom) + centerX, int(offsetY * zoom) + centerY); fill(127); String timeFormat = nf(mon_, 2) + "/" + nf(d_, 2) + " " + nf(h_, 2) + ":" + nf(m_, 2) + " speed: " + nf(10.0 / speed, 1, 2); text(timeFormat, 15, 20); for (int i = 0; i < placeCount; i++) places[i].draw(); } float TX(float x) { float offset = width * (1.0 - zoom) * 0.5; return map(x, minX, maxX, offset, width - offset); } float TY(float y) { float offset = height * (1.0 - zoom) * 0.5; return map(y, minY, maxY, height - offset, offset); } void mousePressed() { if (!is_paused) { mxStart = int(mouseX - offsetX * zoom); myStart = int(mouseY - offsetY * zoom); myPos = mouseY; stopTime(); loop(); } } void mouseReleased() { if (!is_paused) startTime(); } void mouseDragged() { if (is_paused) return; if (mouseButton == LEFT) { offsetX = (mouseX - mxStart) / zoom; offsetY = (mouseY - myStart) / zoom; } else if (mouseButton == RIGHT) { if (mouseY - myPos > 4) { float zoomOut = 9.8 / 10.0; mapShape.scale(zoomOut); zoom *= zoomOut; centerX = int(width * (1.0 - zoom) * 0.5); centerY = int(height * (1.0 - zoom) * 0.5); myPos = mouseY; } else if (mouseY - myPos < -4) { float zoom_in = 10.0 / 9.8; mapShape.scale(zoom_in); zoom *= zoom_in; centerX = int(width * (1.0 - zoom) * 0.5); centerY = int(height * (1.0 - zoom) * 0.5); myPos = mouseY; } } } void startTime() { startTime += millis() - stopTime; loop(); } void stopTime() { noLoop(); stopTime = millis(); } void keyPressed() { if (key == ' ') { if (is_paused) { startTime(); is_paused = false; } else { stopTime(); is_paused = true; } } else if (key == 'n' || key == 'N') startTime -= 180 * speed; else if (key == 'b' || key == 'B') startTime += 180 * speed; else if (key == '+' && speed > 3) speed -= 1; else if (key == '-' && speed < 30) speed += 1; } void readData() { new Slurper(); } Place parsePlace(String line) { String pieces[] = split(line, '\t'); int mins = int(pieces[0]); int mon = int(pieces[1]); int d = int(pieces[2]); int h = int(pieces[3]); int m = int(pieces[4]); float x = float(pieces[5]); float y = float(pieces[6]); float magnitude = float(pieces[7]); float depth = float(pieces[8]); String name = pieces[9]; return new Place(mins, mon, d, h, m, x, y, magnitude, depth, name); }
Place.pde
class Place { int mins; int mon, d, h, m; float x, y; float magnitude; float depth; String name; public Place(int mins, int mon, int d, int h, int m, float x, float y, float magnitude, float depth, String name) { this.mins = mins; this.mon = mon; this.d = d; this.h = h; this.m = m; this.x = x; this.y = y; this.magnitude = magnitude; this.depth = depth; this.name = name; } public void draw() { int xx = (int)TX(this.x) + int(offsetX * zoom); int yy = (int)TY(this.y) + int(offsetY * zoom); int a = mins * speed + 255 - currentTime; if (magnitude == 0.0 || a < 0 || a > 255) return; float r = pow(5.0, (magnitude / 2.7)) / sqrt(depth / 10 + 1); float m = r * ((255 - a) / 50.0) * zoom; fill(color(255 - this.depth * 2, this.depth * 2, 0), a); ellipse(xx, yy, m, m); } }
Slurper.pde
class Slurper implements Runnable { Slurper() { Thread thread = new Thread(this); thread.start(); } public void run() { try { BufferedReader reader = createReader(convData); String line = reader.readLine(); totalCount = int(line); places = new Place[totalCount]; line = reader.readLine(); places[placeCount++] = parsePlace(line); month_ = places[0].mon; day_ = places[0].d; hour_ = places[0].h; minute_ = places[0].m; while ((line = reader.readLine()) != null) places[placeCount++] = parsePlace(line); } catch (IOException e) { e.printStackTrace(); } } }
以å、æ¥æ¬å ¨å½ã³ã³ããåºèåå¸å°å³ãProcessingã§ä½ã£ãã、ä»åã®å°éã®éæºã¨ãã®å¤§ããã«ã¤ãã¦è¦è¦çã«è¡¨ããå°å³ãä½æãã。å°ãã§ãä½ãã®å½¹ã«ç«ã¦ã°è¯ãã®ã ã。
éæºã¨ãã®å¤§ãããæ¥æ¬å°å³ä¸ã«åã¨ãã¦è¡¨ç¾ãã¦ãã。åã®å¤§ããã¯ãã°ããã¥ã¼ãã¨éæºã®æ·±ãã«ä¾åãã¦ãã(ããã¯å¤§ã¾ããªç®å®ã§ãã、æºããå°åãé度・ã¨ãã«ã®ã¼ã«æ£ç¢ºã«å¯¾å¿ãã¦ããããã§ã¯ãªã)。ã¾ã、éæºã®æ·±ãã«ãã£ã¦åã®è²ãå¤ãã、æµ ããã°èµ¤ã«、æ·±ããã°ç·ã«è¿ã¥ã。æµ·ã®è²ã¯æå»ãç¾ãã¦ãã、æ£åãæãæããéã§è¡¨ç¾ãã、æ·±å¤ã§ããã°çã£é»ã¨ãªã。ãã¼ã¿ã«ã¤ãã¦ã¯、æ¥æ¬æ°è±¡åä¼ãæä¾ãã¦ãã3æ9æ¥ãã20æ¥ã¾ã§ã®å°éæ å ±ãå©ç¨ããã¦é ãã。
æä½æ¹æ³ã¯、ã¹ãã¼ã¹ãã¼ã§ãã¼ãº、'N'ãã¼ã§3æéé²ã、'B'ãã¼ã§3æéæ»ã。'+'ãã¼ã§æéã®é²ã¿ãéããªã、'-'ãã¼ã§é ããªã。ãã¦ã¹ã®å·¦ã¯ãªãã¯ã§ãã©ãã°ããã°å°å³ãåãããã¨ãã§ã、å³ã¯ãªãã¯ã§ä¸ä¸ã«ãã©ãã°ããã°æ¡å¤§・縮å°ã¨ãªã。
å¯è¦åå°å³ãã、3æ11æ¥14æ46åã®ãã°ããã¥ã¼ã9.0ã®å°éã®èµ·ããäºæ¥ã»ã©åãã、ä¸é¸æ²ã§ä¸è¦æ¨¡ã®å°éãé »çºãã¦ãããã¨ãåãã。ã¨ããã、M9.0ã®å°éã®æ°æéåããã¯æºããå ¨ã¦é絶ã、åµã®åã®éããã®æ§ç¸ã¨ãªã。ããã¦、M9.0ã®å°éã®ç´å¾ããã¯ã²ã£ãããªãã«æºããç¶ã、æ°æ¥ãã¦ããæ²éåãã¦ãã¦ãã。ãã 、M6ç¨åº¦ã®å°éã¯æªã ã«èµ·ãã£ã¦ããã®ã§、å®å¿ããã«ã¯ã¾ã æ©ããããããªã。æè¿ã®å°éã§ã¯ç¦å³¶çæ²ãè¨åçæ²ã«å¤ã、ããã¨åä¸ãã¦ããæ§åãåãã。
以ä¸、ã½ã¼ã¹ã³ã¼ãã示ã。
earthquake.pde
/* earthquake.pde by nox, 2011.3.22 */ String convData = "quake.tsv.gz"; String japanMap = "japan.svg"; PShape mapShape; int totalCount; Place[] places; int placeCount = 0; final float minX = -0.19834; final float maxX = 0.2425; final float minY = -0.1875; final float maxY = 0.1845; PImage mapImage; PFont font; float offsetX = 0.0; float offsetY = 0.0; int centerX = 0; int centerY = 0; float zoom = 1.0; int mxStart, myStart, myPos; int startTime, currentTime, stopTime; int month_, day_, hour_, minute_; boolean is_paused = false; int speed = 10; public void setup() { mapShape = loadShape(japanMap); smooth(); loop(); size(int(mapShape.width), int(mapShape.height), JAVA2D); // 539, 563 shapeMode(CORNER); mapShape.disableStyle(); font = loadFont("CourierNewPSMT-14.vlw"); textMode(SCREEN); textFont(font); readData(); startTime = millis(); loop(); } public void draw() { if (!mousePressed) currentTime = millis() - startTime; int currentDate = currentTime + (hour_ * 60 + minute_) * speed; int mon_ = month_; int d_ = day_ + currentDate / (24 * 60 * speed); int h_ = currentDate / (60 * speed) % 24; int m_ = currentDate / speed % 60; if (d_ >= 21 || d_ <= 8 || h_ < 0 || m_ < 0) startTime = millis(); background(color(0, 0, (720 - abs(h_ * 60 + m_ - 720)) * 0.1)); noStroke(); fill(32); shape(mapShape, int(offsetX * zoom) + centerX, int(offsetY * zoom) + centerY); fill(127); String timeFormat = nf(mon_, 2) + "/" + nf(d_, 2) + " " + nf(h_, 2) + ":" + nf(m_, 2) + " speed: " + nf(10.0 / speed, 1, 2); text(timeFormat, 15, 20); for (int i = 0; i < placeCount; i++) places[i].draw(); } float TX(float x) { float offset = width * (1.0 - zoom) * 0.5; return map(x, minX, maxX, offset, width - offset); } float TY(float y) { float offset = height * (1.0 - zoom) * 0.5; return map(y, minY, maxY, height - offset, offset); } void mousePressed() { if (!is_paused) { mxStart = int(mouseX - offsetX * zoom); myStart = int(mouseY - offsetY * zoom); myPos = mouseY; stopTime(); loop(); } } void mouseReleased() { if (!is_paused) startTime(); } void mouseDragged() { if (is_paused) return; if (mouseButton == LEFT) { offsetX = (mouseX - mxStart) / zoom; offsetY = (mouseY - myStart) / zoom; } else if (mouseButton == RIGHT) { if (mouseY - myPos > 4) { float zoomOut = 9.8 / 10.0; mapShape.scale(zoomOut); zoom *= zoomOut; centerX = int(width * (1.0 - zoom) * 0.5); centerY = int(height * (1.0 - zoom) * 0.5); myPos = mouseY; } else if (mouseY - myPos < -4) { float zoom_in = 10.0 / 9.8; mapShape.scale(zoom_in); zoom *= zoom_in; centerX = int(width * (1.0 - zoom) * 0.5); centerY = int(height * (1.0 - zoom) * 0.5); myPos = mouseY; } } } void startTime() { startTime += millis() - stopTime; loop(); } void stopTime() { noLoop(); stopTime = millis(); } void keyPressed() { if (key == ' ') { if (is_paused) { startTime(); is_paused = false; } else { stopTime(); is_paused = true; } } else if (key == 'n' || key == 'N') startTime -= 180 * speed; else if (key == 'b' || key == 'B') startTime += 180 * speed; else if (key == '+' && speed > 3) speed -= 1; else if (key == '-' && speed < 30) speed += 1; } void readData() { new Slurper(); } Place parsePlace(String line) { String pieces[] = split(line, '\t'); int mins = int(pieces[0]); int mon = int(pieces[1]); int d = int(pieces[2]); int h = int(pieces[3]); int m = int(pieces[4]); float x = float(pieces[5]); float y = float(pieces[6]); float magnitude = float(pieces[7]); float depth = float(pieces[8]); String name = pieces[9]; return new Place(mins, mon, d, h, m, x, y, magnitude, depth, name); }
Place.pde
class Place { int mins; int mon, d, h, m; float x, y; float magnitude; float depth; String name; public Place(int mins, int mon, int d, int h, int m, float x, float y, float magnitude, float depth, String name) { this.mins = mins; this.mon = mon; this.d = d; this.h = h; this.m = m; this.x = x; this.y = y; this.magnitude = magnitude; this.depth = depth; this.name = name; } public void draw() { int xx = (int)TX(this.x) + int(offsetX * zoom); int yy = (int)TY(this.y) + int(offsetY * zoom); int a = mins * speed + 255 - currentTime; if (magnitude == 0.0 || a < 0 || a > 255) return; float r = pow(5.0, (magnitude / 2.7)) / sqrt(depth / 10 + 1); float m = r * ((255 - a) / 50.0) * zoom; fill(color(255 - this.depth * 2, this.depth * 2, 0), a); ellipse(xx, yy, m, m); } }
Slurper.pde
class Slurper implements Runnable { Slurper() { Thread thread = new Thread(this); thread.start(); } public void run() { try { BufferedReader reader = createReader(convData); String line = reader.readLine(); totalCount = int(line); places = new Place[totalCount]; line = reader.readLine(); places[placeCount++] = parsePlace(line); month_ = places[0].mon; day_ = places[0].d; hour_ = places[0].h; minute_ = places[0].m; while ((line = reader.readLine()) != null) places[placeCount++] = parsePlace(line); } catch (IOException e) { e.printStackTrace(); } } }
ã³ã¡ã³ã