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


Click on anar+ terms to get the documentation.

import processing.opengl.*;
import anar.*;
 
 
 
 
 
 
 
 
 
 
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 a vertical translation defining the height of tower floors
Transform t = new Translate(0,0,10);
 
//Create parameter array to store individual rotations values
Param[] myArray = new Param[25];
 
Obj module = createModule();
 
for (int i=0; i<myArray.length; i++) {
  //Create individual rotations randomly
  myArray[i] = new Param(random(.4f), -3.14f, 3.14f);
 
  //Create transformation that include a translation 
  // and a new rotation on the axis Z created from p
  Transform tt = new Transform();
  tt.add(t);
  tt.rotateZ(myArray[i]);
 
  //Create a copy of module
  Obj myCopy = new Obj(module);
 
  //Apply the transformation
  myCopy.apply(tt);
 
  //Add the copy to myObj
  myObj.add(myCopy);
 
  //copy is now the base module
  module = myCopy;
}
 
//Create sliders for the parameter array
mySliders = new Sliders(myArray); 
 
//mySliders = new Sliders(myObj); 
Anar.camTarget(myObj);
}
 
Obj createModule() {
int edge = 40;
int h = 9;
 
//Create the base points (here a square)
ref = new Pt[4];
ref[0] = Anar.Pt(-edge/2, -edge/2);
ref[1] = Anar.Pt(edge/2,-edge/2);
ref[2] = Anar.Pt(edge/2, edge/2);
ref[3] = Anar.Pt(-edge/2,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]);
 
//Extrude mySquare along the translation t
return new Extrude(mySquare, Anar.Pt(0,0,h));  
}  
 
void draw() {
background(150);
myObj.draw();
mySliders.draw();
}
 



screenshots