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:   Test03gFoldingABS.pde
   JAVA Download:   Test03gFoldingABS.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
 */
 
 
Obj myObj = new Obj();
 
 
void setup(){
    size(800,400,OPENGL);
  frameRate(200);
 
  Anar.init(this);
  Anar.drawAxis(true);
 
  initForm();
}
 
 
void initForm(){
 
 
  // CREATE TWO CONTAINERS TO STORE THE POINTS
  // TWO LINES PARRALELS WITH POINTS
  Pts ptsA = new Pts();
  Pts ptsB = new Pts();
 
 
  // SET TWO TRANSFORMATIONS FOR REUSE
  Translate sideWidth = new Translate(0,30,0);
  Translate sideHeight = new Translate(10,0,0);
 
 
  // CREATE A FIRST POINT
  // ASECOND FOR THE NEXT LINE
  Pt oriA = Anar.Pt(10,20,30);
  Pt oriB = Anar.Pt(oriA,sideWidth);
 
 
  RotateZ r = new RotateZ((float)Math.PI/16);
 
  Transform mergedTransform = new Transform();
 
  mergedTransform.apply(sideHeight);
  mergedTransform.apply(r);
 
 
  ptsA.add(oriA);
  ptsB.add(oriB);
 
 
  // CREATE ALL POINTS FROM sideHeight at EACH STEPS
  for (int i = 0; i<8; i++){
 
    Transform orientedTranslationA = new Transform(oriA,oriB,mergedTransform);
    Transform orientedTranslationB = new Transform(oriA,oriB,mergedTransform);
 
    Pt tmpA = Anar.Pt(ptsA.ptEnd(),orientedTranslationA);
    Pt tmpB = Anar.Pt(ptsB.ptEnd(),orientedTranslationB);
 
    ptsA.add(tmpA);
    ptsB.add(tmpB);
  }
 
 
  // myObj.add(ptsA);
  // myObj.add(ptsB);
 
 
  // I HAVE THEN TWO PARRALLEL LINES
  // I'LL CREATE FACES FROM EACH PAIRS
  for (int i = 0; i<ptsA.numOfPts()-1; i++){
 
    // FIRST TRIANGLE ADJ
    Face triangleA = new Face();
    triangleA.add(ptsA.pt(i));
    triangleA.add(ptsA.pt(i+1));
    triangleA.add(ptsB.pt(i));
 
    myObj.add(triangleA);
 
 
    // FIRST TRIANGLE OPPOSITE
    Face triangleB = new Face();
    triangleB.add(ptsB.pt(i));
    triangleB.add(ptsB.pt(i+1));
    triangleB.add(ptsA.pt(i+1));
 
    myObj.add(triangleB);
 
 
  }
 
 
  myObj.fill(255,255,0);
 
  Anar.camTarget(myObj);
  Anar.sliders(myObj);
}
 
 
void draw(){
  background(155);
 
  myObj.draw();
}
 
 
 



screenshots