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


Click on anar+ terms to get the documentation.

import processing.opengl.*;
import anar.*;
 
// import java.util.*;
 
 
 
 
/*
 * Example for Anar library by Guillaume LaBelle + Julien Nembrini
 * http://anar.ch
 */
 
 
Obj     obj;
Sliders mySlider;
 
 
void setup(){
    size(800,400,OPENGL);
  Anar.init(this);
 
  initForm();
}
 
 
void initForm(){
 
  int numOfSides = 20;
  int numOfLoops = 10;
  float theta = 2*PI/ (numOfSides*2);
 
 
  // starting point
  Pt a = Anar.Pt(100,0);
  Pt b = Anar.Pt(50,0);
 
  // rotation
  RotateZ rot = new RotateZ(theta);
  b.apply(rot);
 
  Translate t = new Translate(0,0,1);
 
  Scale s = new Scale(.99f,.99f,.99f);
 
 
  // construction of shape
  obj = new Obj();
 
 
  // create square
  Pts f = new Pts();
 
  f.add(a);
  f.add(b);
 
  for (int i = 0; i<numOfSides*numOfLoops; i++){
    a = Anar.Pt(a);
    b = Anar.Pt(b);
 
    a.apply(rot);
    a.apply(rot);
    a.apply(t);
    a.apply(s);
 
    b.apply(rot);
    b.apply(rot);
    b.apply(t);
    b.apply(s);
 
 
    f.add(a);
    f.add(b);
  }
 
 
  Pts f2 = new Pts(f);
  f2.translate(0,0,5);
  f2.render = new RenderPtsLine(new AColor(255,0,0));
 
  obj.add(f);
  obj.add(f2);
 
 
  // define sliders for shape
  mySlider = new Sliders(obj);
  Anar.camTarget(obj);
}
 
 
void draw(){
  background(153);
 
  obj.draw();
  mySlider.draw();
}
 
 
// interactivity related stuff
void keyPressed(){
  initForm();
}
 
 



screenshots