This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

anar+

by   LaBelle + Nembrini
©2008

built with ( )
   examples index
Rotate: middle click or key[1]
Zoom in|out: wheel button or key[2]
AutoRotate: key[5]
(First Click inside the applet to enable keys)

This applet use OpenGL, you might have to install extra jogl libraries once to view this applet. You may have a look at image capture and video at the bottom of this page. You might accept security security permenently to remove the security prompts on each pages.



sourcecode


   PDE Download:   Test04sParticles.pde
   JAVA Download:   Test04sParticles.java


Click on anar+ terms to get the documentation.

import processing.opengl.*;
import anar.*;
 
 
 
 
 
/*
 * Example for Anar library by Guillaume LaBelle + Julien Nembrini
 * http://anar.ch
 */
 
 
boolean record = false;
 
 
Obj     form;
 
Sliders mySliders;
 
 
void setup(){
    size(1000,500,OPENGL);
  Anar.init(this);
  Anar.drawAxis(true);
  Pts.globalRender = new RenderPtsAll();
 
  createSimulation();
}
 
 
void createSimulation(){
  form = new Obj();
 
 
  Anar.sliders(Particle.affinityCf = new Param(2.32f, -5,5));
  Anar.sliders(Particle.repulseCf = new Param(0.007f, -.01f,.01f));
  Anar.sliders(Particle.gravityCf = new Param(0.023f, -.1f,.1f));
 
 
  // GRID
  // /////////////////////////////
 
  float w = 100;
  float h = 30;
  Particle[][] grid = new Particle[12][7];
 
  for (int i = 0; i<grid.length; i++)
    for (int j = 0; j<grid[i].length; j++){
      float xpos = i* (w/grid.length);
      float ypos = j* (h/grid[i].length);
 
      grid[i][j] = new Particle(xpos,ypos,0);
    }
 
  // /////////////////////////////
  // AFFINITY
 
  for (int i = 1; i<grid.length; i++)
    for (int j = 0; j<grid[i].length; j++)
      Particle.affinity(grid[i-1][j],grid[i][j]);
 
  for (int i = 0; i<grid.length; i++)
    for (int j = 1; j<grid[i].length; j++)
      Particle.affinity(grid[i][j-1],grid[i][j]);
 
 
  // /////////////////////////////
  // PIN
 
  for (int i = 0; i<grid.length; i += 3){
    grid[i][0].pin = true;
    grid[i][grid[i].length-1].pin = true;
  }
 
 
  // Particle.affinity((Particle)particlePts.pt(3),(Particle)particlePts.pt(6),100);
 
 
}
 
 
void draw(){
  background(155);
  Particle.updateSim();
  Particle.drawSimulation();
 
 
  // Anar.camTarget(form);
 
 
}
 
 
 



screenshots