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


Click on anar+ terms to get the documentation.

import processing.opengl.*;
import anar.*;
 
 
 
 
 
 
 
 
 
void setup(){
  size(600,300,OPENGL);
Anar.init(this);
 
Anar.drawAxis(true);
Pts.globalRender = new RenderPtsAll();
 
createForm();
}
 
Obj form;
 
void createForm(){
form = new Obj();    //Create an empty Object
 
//////////////////////////////////////
//CREATE A BASIC GRID
 
Obj tmpObject = new Obj();
 
for(int i=0; i<30; i++)
{
  Pts myList  = new Pts();
 
  for(int j=0; j<20; j++)
    myList.add(Anar.Pt( i*10,j*10,0));
 
  tmpObject.add(myList); 
}
 
//////////////////////////////////////
//CREATE LINE S FROM A GRID USING MODULO
 
for(int i=0; i<tmpObject.numOfLines(); i++)     //For each Lines
  if(i%3!=0)                                    //Skip the third line
  {
    Pts myList  = new Pts();                  //Container fpr new Points
 
    for(int j=0; j<tmpObject.line(i).numOfPts()-1; j+=2)       //For each points of this line
    {
      int indexOfLine  = (i+1)%tmpObject.numOfLines();
      int indexOfPoint = (j+1)%tmpObject.line(i).numOfPts();
      myList.add(tmpObject.line(i).pt(j));
      myList.add(tmpObject.line(indexOfLine).pt(indexOfPoint));
    }
 
    form.add(myList);                           //Add the new Pts to form obj()
  }
 
Anar.camTarget(form);
}
 
void draw(){
background(255);
form.draw();
}
 



screenshots