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:   Test03pStructure.pde
   JAVA Download:   Test03pStructure.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);
  Anar.init(this);
  Anar.drawAxis();
  initForm();
}
 
void initForm(){
 
  // First construction: a basic line
  Pts ctrlPts = new Pts();
 
  ctrlPts.add(0,0,0);
  ctrlPts.add(30,20,0);
  ctrlPts.add(60, -20,0);
  ctrlPts.add(90,0,0);
  ctrlPts.add(120,0,40);
  ctrlPts.add(150,0,0);
  ctrlPts.add(180,0,0);
  ctrlPts.stroke(155,0,0);
 
  ctrlPts.translate(0,60,0);
 
  // Add this first module
  Pts moduleA = createModule(ctrlPts);
  myObj.add(moduleA);
 
  // Create new controlPoints one from a symmetry
  Pts ctrlPtsSym = new Pts(ctrlPts,new MirrorY());
 
  // Create a new curve based on the new controlPoints
  Pts moduleB = createModule(ctrlPtsSym);
  myObj.add(moduleB);
 
  // Create Faces
  for (int i = 1; i<moduleA.numOfPts(); i++){
    Face f = new Face();
 
    f.add(moduleA.pt(i-1));
    f.add(moduleB.pt(i-1));
    f.add(moduleB.pt(i));
    f.add(moduleA.pt(i));
 
    myObj.add(f);
  }
 
  Anar.sliders(ctrlPts);
  Anar.camTarget(myObj);
}
 
Pts createModule(Pts construction){
 
  // From this first set of points, create a curve of degree 4
  CSpline curve = new CSpline(construction,4);
 
  // Extract a serie of points from the curve
  Pts curveWithPointsUniform = curve.getPts(30);
 
  return curveWithPointsUniform;
}
 
 
void draw(){
  background(155);
  myObj.draw();
}
 
 
 



screenshots