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


Click on anar+ terms to get the documentation.

import processing.opengl.*;
import processing.opengl.*;
import anar.*;
 
// import geometry.Point3D;
 
 
import java.util.ArrayList;
 
import rad.*;
 
 
/*
 * Example for Anar library by Guillaume LaBelle + Julien Nembrini
 * http://anar.ch
 */
 
 
Anar      goo;
 
Obj       myObject;
 
Pts       ptsA;
Pts       ptsB;
 
Pt        origin;
 
RadEngine simThread;
 
void setup(){
 
    // size(screen.width,screen.height,OPENGL);
    size(1000,500,OPENGL);
  Anar.init(this);
 
  myObject = generatorBirdNest00();
 
 
  // simThread = new RadianceEngine( (RadObserver)
  // this,((Object)this).getClass().getName(), 1, "");
  simThread = new RadEngine(this,50f);
  simThread.simulate(myObject);
 
  RadEngine.measureBack = true;
}
 
 
Obj generatorBirdNest00(){
 
  Obj outputFmz;
 
  ptsA = new Pts();
  ptsB = new Pts();
 
  ptsA.add(origin = Anar.Pt(5, -5, -50,"Origine"));
 
  println(origin);
 
  ArrayList spiral = new ArrayList();
  Transform tmp;
 
  // Transform 1
  tmp = new Transform();
  tmp.translate(10,1,1);
  tmp.rotateZ(PI/16f);
  spiral.add(tmp);
 
 
  // Transform 2
  tmp = new Transform();
  tmp.translate(10,1,1);
  tmp.rotateZ(PI/12f);
  spiral.add(tmp);
 
 
  // Transform 3
  tmp = new Transform();
  tmp.translate(10,1,1);
  tmp.rotateZ(PI/8f);
  spiral.add(tmp);
 
  tmp = new Transform();
  tmp.translate( -10,1,1);
  tmp.rotateZ( -PI/16f);
  spiral.add(tmp);
 
  // println(spiralTransform);
 
 
  Pt previous = origin;
 
  for (int i = 0; i<10; i++){
    // Pt q = Anar.Pt(previous,spiralA);
 
    // Pt q = Anar.Pt(previous,spiralTransform);
    if(random(10)<4)
      tmp = (Transform)spiral.get((int)random(spiral.size()));
 
    Transform ori = new Transform(previous,tmp);
 
    Pt q = Anar.Pt(previous,ori);
 
    ptsA.add(q);
    previous = q;
  }
 
 
  // ArrayList<Transform> base = new ArrayList<Transform>();
  Transform baseTransform;
 
  baseTransform = new Transform();
  baseTransform.translate(Anar.PtNull(0,0, -15));
  // base.add(baseTransform);
 
 
  /*
   * baseTransform = new Transform();
   * baseTransform.translate(Anar.PtNull(0,0,-5)); base.add(baseTransform);
   */
 
  // Iterator<Pt> i = ptsA.iterator();
  for (int i = 0; i<ptsA.numOfPts(); i++){
    PtDER p = Anar.Pt(ptsA.pt(i));
    p.apply(baseTransform);
    ptsB.add(p);
  }
 
 
  outputFmz = new SweepTwoPaths(ptsA,ptsB);
  println(outputFmz);
  println(outputFmz.faces.size());
  println(outputFmz.faces.get(0));
 
 
  ptsA.color(new AColor(252,0,0));
 
 
  println(outputFmz.primitiveToString( -1));
  println("-------------");
 
  // TextIO.writeTextFile("test.lsp",outputFmz.toAutocad());
 
  return outputFmz;
 
}
 
boolean simulating = false;
 
void draw(){
  if(frameCount%2==0)
    background(150);
  else
    background(148);
 
  origin.draw();
  ptsA.draw();
  ptsB.draw();
  myObject.draw();
 
  if(frameCount%1000==0&& !simulating){
    myObject = generatorBirdNest00();
  }
}
 
 
@Override
void radSimDone() {
	simulating = false;
 
}
 
 
void keyPressed(){
  if(key=='q'){
    simThread.runNow();
    simulating = true;
  }
}
 
 
 
 
 



screenshots