/* * This source file is part of the Reclus program. * Copyright (C) 2005 Giovanni Baldini. * * Reclus is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Reclus is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Reclus; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import processing.opengl.*; float h_rot = 0, v_rot = 0, zoom = 0; boolean active_zoom = false, show_name = false; Cluster cluster = new Cluster(new Star(0, 0, 0, "black_hole")); String raw_data[] = loadStrings("data.txt"); void setup(){ size(900, 700, OPENGL); framerate(60); bezierDetail(30); smooth(); emissive(255, 0, 255); ambient(0, 0, 255); PFont font; font = loadFont("Meta.vlw.gz"); textFont(font, 16); } void draw(){ noStroke(); background(0, 15, 45); fill(200, 100); rect(width-12, 6, 8, height-6); if(cluster.birth > 0){ fill(200, 100); rect(width-11, 7, 6, (height-8)*(cluster.present-cluster.birth)/(cluster.death-cluster.birth)); } fill(255); translate(width/2, height/2, zoom); sphere(20); rotateX(v_rot); rotateY(h_rot); fill(255, 180, 255); stroke(255, 180, 255, 128); lights(); cluster.draw(); } void mouseDragged(){ float movement_ratio = 220.0; v_rot += (pmouseY-mouseY)/movement_ratio; h_rot += (mouseX-pmouseX)/movement_ratio; } void mouseReleased(){} void keyPressed(){ if(key == 'a') zoom += 15; if(key == 'z') zoom -= 15; if(key == ' ') show_name = !show_name; } Link[] append(Link[] a, Link b){ int i; Link[] c = new Link[a.length+1]; for(i=0;i