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:   Test00wDSimpleRotation.pde
   JAVA Download:   Test00wDSimpleRotation.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   result;
 
Param angle;
 
 
void setup(){
 
    size(1000,500,OPENGL);
  Anar.init(this);
 
  Anar.drawAxis(true);
 
  initForm();
 
}
 
 
void initForm(){
 
  result = new Obj();
 
  // ///////////////////////
 
  Pt p1 = Anar.PtRnd(100,100,100);
  Pt p2 = Anar.PtRnd(100,100,100);
 
  Pts axis = new Pts();
  axis.add(p1);
  axis.add(p2);
 
  axis.render = new RenderPtsLine(new AColor(255,0,0));
  result.add(axis);
 
 
  // ///////////////////////
 
  Pts axisClone = new Pts();
  Pt q1 = Anar.Pt(p1);
  Pt q2 = Anar.Pt(p2);
  Pt q3 = Anar.Pt(p2);
  Pt q4 = Anar.Pt(p1);
  axisClone.add(q1);
  axisClone.add(q2);
  axisClone.add(q3);
  axisClone.add(q4);
  axisClone.render = new RenderPtsLine(new AColor(50,255,0));
  result.add(axisClone);
 
  // ///////////////////////
 
  angle = new Param(0);
 
  RotateZ rotAxis = new RotateZ(angle);
  Translate onY = new Translate(Anar.Pt(0,10,0));
 
  Transform combo = new Transform();
  combo.add(onY);
  combo.add(rotAxis);
 
 
  // ///////////////////////
 
  Transform allign1 = new Transform(p1,p2,combo);
 
  // ///////////////////////
 
  q3.apply(allign1);
  q4.apply(allign1);
 
 
}
 
 
void draw(){
  background(80);
  angle.set(frameCount/10f);
  // println(angle);
  result.draw();
 
}
 
void keyPressed(){
  if(key==' ')
    initForm();
}
 
 
 
 



screenshots