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:   OOG1zFacadeArray.pde
   JAVA Download:   OOG1zFacadeArray.java


Click on anar+ terms to get the documentation.

import processing.opengl.*;
import anar.*;
 
 
 
import processing.core.*;
 
 
 
 
 
 
 
Obj myObj;
Sliders mySliders;
 
Pt[] ref;
 
void setup() {
  size(800, 400, OPENGL);
Anar.init(this);
 
initForm();
}
 
 
void initForm() {
//Create a new Object to store our shape
myObj = new Obj();  
 
//Create parameter array to store individual rotations values
Param[][] myArray = new Param[25][25];
 
Obj module;
 
PImage gauss = loadImage("gaussian.jpg");
loadPixels();
 
for (int i=0; i<myArray.length; i++) {
  for (int j=0; j<myArray[i].length; j++) {
    float z = 0;
//      for (int k=0; k<4; k++) {
//        z += PI/2*exp(-(sq(i-myArray.length/2 + rand[i][j])+sq(j-myArray[0].length/2 + rand[i][j])));
//      }
    myArray[i][j] = new Param(PI/2*red(gauss.pixels[i+25*j])/255f);
    Transform t = new Transform();
    t.translate(edge*i,0,0);
    t.translate(0,0,edge*j);
 
    module = createModule(myArray[i][j]);
 
    //Apply the transformation
    module.apply(t);
 
    //Add the copy to myObj
    myObj.add(module);
  }
}
//Create sliders for the parameter array
Anar.camTarget(myObj);
}
 
int edge = 40;
 
Obj createModule(Param p) {
//Create the base points (here a square)
ref = new Pt[4];
ref[0] = Anar.Pt(-edge/2, 0, -edge/2);
ref[1] = Anar.Pt(edge/2, 0,-edge/2);
ref[2] = Anar.Pt(edge/2, 0, edge/2);
ref[3] = Anar.Pt(-edge/2, 0,edge/2);
 
//Create a new Face
Face mySquare = new Face();
 
//Store the local points inside the new face 
for (int i=0; i<ref.length; i++)
  mySquare.add(ref[i]);
 
mySquare.rotateX(p);
Obj ret = new Obj();
ret.add(mySquare);
return ret;
}  
 
 
void draw() {
background(150);
myObj.draw();
}
 



screenshots