Processing Forum
- import controlP5.*;
- ControlP5 cp5;
- ControlWindow controlWindow;
- import twitter4j.*;
- import java.util.List;
- Twitter twitter;
- public int PersX = 100;
- public int PersY = 100;
- public float Zoom = 1.00;
- float Taille = 20;
- int num = 180;
- float RADIUS = 550;
- float SCALE = 150.0;
- float cameraZ= (height/2.0) / tan(PI*60.0/360.0);
- int globKonexID = 0;
- int nbAgent = 1;
- Neuron n[];
- Agent Particules[];
- void setup() {
- size(displayWidth, displayHeight, P3D);
- twitter = initTwitter();
- //////INTERFACE CONTROL
- cp5 = new ControlP5(this);
- controlWindow = cp5.addControlWindow("controlP5window", 100, 100, 300, 200)
- .hideCoordinates()
- .setBackground(color(150))
- ;
- cp5.addSlider("PersX")
- .setRange(0, 200)
- .setPosition(40, 40)
- .setSize(200, 20)
- .setWindow(controlWindow)
- ;
- cp5.addSlider("PersY")
- .setRange(0, 200)
- .setPosition(40, 80)
- .setSize(200, 20)
- .setWindow(controlWindow)
- ;
- cp5.addSlider("Zoom")
- .setRange(0, 2)
- .setPosition(40, 120)
- .setSize(200, 20)
- .setWindow(controlWindow)
- ;
- n = new Neuron[num];
- for (int i = 0;i<n.length;i++) {
- n[i] = new Neuron(i);
- }
- for (int i = 0;i<n.length;i++) {
- n[i].makeConnections();
- }
- noSmooth();
- stroke(1.0);
- for (int i = 0;i<n[0].k.length;i++)
- n[0].makeSignal(i);
- }
- Twitter initTwitter() {
- ConfigurationBuilder cb = new ConfigurationBuilder();
- cb.setDebugEnabled(true)
- .setOAuthConsumerKey("pPPRbR3XMdzt0K9zc0Xp1w")
- .setOAuthConsumerSecret("Wx4at79icYfxlETpJ8ELQ3L4ll094K4AgoRT6lM4o")
- .setOAuthAccessToken("105489042-wwGThZOa2B98Nl6V2pkJhDPyqErZLLLVXdEQ733X")
- .setOAuthAccessTokenSecret("7tu9xIuaU6fheGqt7U1VmlzL7ysifyxhup6uJQEqZ7c");
- TwitterFactory tf = new TwitterFactory(cb.build());
- return tf.getInstance();
- }
- void draw() {
- float time = millis()*0.001;
- background(0);
- camera( 2550, -1850, 100, 0, 0, 0, 0, 10, 0 ); // Cammera
- ///PERSPECTIVE
- float fov = PI/4.0;
- float cameraZ = (height/2.0) / tan(fov/2.0);
- perspective(fov*Zoom, float(width*PersX)/float(height*PersY), cameraZ/100.0, cameraZ*100.0);
- ////
- rotate (-time*.2, time*.1, -time*.0, -time*.1); //ROTATION DU TOUT
- for (int i = 0;i<n.length;i++) {
- n[i].draw();
- }
- }
- ////////////////////////// >>