FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Discussion
   General Processing Discussion
(Moderators: fry, REAS)
   The Virtual Origami Project
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: The Virtual Origami Project  (Read 4811 times)
Josh Nimoy

jtnimoy WWW Email
The Virtual Origami Project
« on: Dec 22nd, 2002, 10:31am »

This was done in Proce55ing.
 
http://origami.jtnimoy.com
 
Some day, i will be able to finish it without going broke.
 
enjoy
 
-josh nimoy
 
 
sportebois

174862490174862490 Email
Re: The Virtual Origami Project
« Reply #1 on: Dec 22nd, 2002, 11:07am »

Hi Josh,
'class origami1 not found' error here (w2k)
cheers
séb
 
michael

Email
Re: The Virtual Origami Project
« Reply #2 on: Dec 22nd, 2002, 9:42pm »

same here. ie6, winXP pro
 

In the beginning, the universe was created. This made a lot of people very angry, and has been widely regarded as a bad idea.

-- Douglas Adams in The Hitchhiker's Guide to the Universe.
sportebois

174862490174862490 Email
Re: The Virtual Origami Project
« Reply #3 on: Dec 23rd, 2002, 9:27am »

indeed it works... after upgrading W2k to SP3 and reinstalling JRE 1.4.1_01 ..  
 
a troble to be able to see it, but it's worth! great piece Josh!!  
congrats!
séb
 
Josh Nimoy

jtnimoy WWW Email
Re: The Virtual Origami Project
« Reply #4 on: Dec 24th, 2002, 8:32pm »

In response to a private email, here are the two functions which allowed me to draw mountain fold and valley fold lines in the virtual origami project. With a little tinkering, you can accomplish any line stroke style seen in Adobe Illustrator -- and beyond.
 
---------------------
 
// Valley and Mountain folds
// by Josh Nimoy
// Based on Bresenham
// The valley line is just       - - - - - - - - -
// The mountain line is fancier . _ . _ . _ . _ . _
// notes: for the "BApplet p5" argument, just pass "this" if you are working inside the Proce55ing software. Geometry.distance() is the pythagorean theorem.
 
public static void valleyLine(BApplet p5, int x0,int y0,int x1, int y1, int refX,int refY){
  int dy = y1 - y0;
  int dx = x1 - x0;
  int stepx, stepy;
if (dy < 0) { dy = -dy;  stepy = -1; } else {stepy = 1;}
if (dx < 0) { dx = -dx;  stepx = -1; } else {stepx = 1;}
  dy <<= 1;
  dx <<= 1;
  p5.point(x0,y0);
 
  if (dx>dy) {
    int fraction=dy-(dx>>1);
    //int ogx0 = x0;
    //int ogy0 = y0;
    double d;
    while (x0!=x1){
      if(fraction>=0){
        y0 += stepy;
        fraction -= dx;
      }
      x0 += stepx;
      fraction += dy;
      d = Geometry.distance(refX,refY,x0,y0);
      if(d%12 > 4)p5.point(x0,y0);
    }
  }else {
    int fraction = dx - (dy>>1);
    //int ogx0 = x0;
    //int ogy0 = y0;
    double d;
    while (y0 != y1) {
      if (fraction >= 0) {
        x0 += stepx;
        fraction -= dy;
      }
      y0 += stepy;
      fraction += dx;
      d = Geometry.distance(refX,refY,x0,y0);
      if(d%12 > 4)p5.point(x0,y0);
 
    }
  }
}
 
public static void mountainLine(BApplet p5, int x0,int y0,int x1, int y1, int refX,int refY){
  int dy = y1 - y0;
  int dx = x1 - x0;
  int stepx, stepy;
if (dy < 0) { dy = -dy;  stepy = -1; } else {stepy = 1;}
if (dx < 0) { dx = -dx;  stepx = -1; } else {stepx = 1;}
  dy <<= 1;
  dx <<= 1;
  p5.point(x0,y0);
 
  if (dx>dy) {
    int fraction=dy-(dx>>1);
    //int ogx0 = x0;
    //int ogy0 = y0;
    double d;
    while (x0!=x1){
      if(fraction>=0){
        y0 += stepy;
        fraction -= dx;
      }
      x0 += stepx;
      fraction += dy;
      d = Geometry.distance(refX,refY,x0,y0)%17;
      if(d>9 || (d>3 && d<5))p5.point(x0,y0);
    }
  }else {
    int fraction = dx - (dy>>1);
    //int ogx0 = x0;
    //int ogy0 = y0;
    double d;
    while (y0 != y1) {
      if (fraction >= 0) {
        x0 += stepx;
        fraction -= dy;
      }
      y0 += stepy;
      fraction += dx;
      d = Geometry.distance(refX,refY,x0,y0)%17;
      if(d>9 || (d>3 && d<5))p5.point(x0,y0);
 
    }
  }
}
 
« Last Edit: Dec 24th, 2002, 8:43pm by Josh Nimoy »  
gaza


Re: The Virtual Origami Project
« Reply #5 on: Jan 10th, 2003, 4:08pm »

wow!  great work!
 
Pages: 1 

« Previous topic | Next topic »