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:   Test05cIntersect.pde
   JAVA Download:   Test05cIntersect.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();
 
RenderPts dotted = new RenderPtsLineDotted(color(255,255,0));
 
Pt origin = Anar.Pt(0,0,0);
PtIntersect inter,interSkew;
 
void setup(){
    size(800,400,OPENGL);
  Anar.init(this);
  myObj = createModule();
}
 
Obj createModule(){
  // Initialize a local object
  Obj module = new Obj();
 
  // First construction: a basic line
  Pts line1 = new Pts();
  Pts line2 = new Pts();
  Pts line3 = new Pts();
 
  Param c = new Param(60,0,100).addToSlidersMain();
  Param nll = new Param(0);
 
  line1.add(0,0,0);
  line1.add(30,20,0);
 
  line2.add(60, -20,0);
  line2.add(Anar.Pt(c,nll,nll));
 
  line3.add(50, -20,0);
  line3.add(Anar.Pt(c,nll,c));
 
 
  module.add(line1);
  module.add(line2);
  module.add(line3);
 
 
 
  // Create set of Points from an uniform distribution of points
  inter = new PtIntersect(line1.pt(0),line1.pt(1),line2.pt(0),line2.pt(1));
  module.add(inter);
 
  // Create projection lines.
  module.add(new Pts(line1.pt(1),inter).render(dotted));
  module.add(new Pts(line2.pt(1),inter).render(dotted));
 
 
  interSkew = new PtIntersect(line1.pt(0),line1.pt(1),line3.pt(0),line3.pt(1));
  module.add(interSkew);
 
  Pts skewLine = new Pts();
 
  skewLine.add(interSkew.getInterA());
  skewLine.add(interSkew.getInterB());
  skewLine.render(dotted);
 
  module.add(skewLine);
 
  interSkew.getInterA().fill(255,0,0);
  interSkew.getInterB().fill(255,0,0);
 
  module.add(interSkew.getInterA());
  module.add(interSkew.getInterB());
 
 
  return module;
}
 
 
void draw(){
  background(155);
 
  fill(50);
  Anar.text("intersection "+inter.toString(),inter);
  Anar.text("skew "+interSkew.toString(),interSkew);
 
  Anar.text("skew on line1",interSkew.getInterA());
  Anar.text("skew on line3",interSkew.getInterB());
 
  Anar.camTarget(myObj);
  myObj.draw();
}
 
 
void keyPressed(){
 
  if(key==' ')
    RhinoScript.export(myObj,"curveTest");
}
 
 
 



screenshots