i made a java serpenski triangle at a tech camp this summer(just now getting it off the cd) and i thought I'd show you,( and hope i dont get mocked for its simplicity, i learned all the java I know in the week i made this)
Code:
import processing.core.PApplet;
import processing.core.PImage;
public class serpenskifix extends PApplet {
int xsize = 1280;
int ysize = 900;
public void setup()
{
size(1280, 1000);
noLoop();
}
public void draw()
{
PImage b;
b = loadImage("link.bmp");
background(b);
//int tripos[][] = new int[2][3];
sierpinski(0,ysize,xsize/2,0,xsize,ysize,7,0);
}
public void sierpinski(int x1, int y1, int x2, int y2, int x3, int y3, int depth, float colour)
{
if (depth<0)
{
stroke(255,255,0);
fill(255,255,0);
triangle(x1,y1,x2,y2,x3,y3);
return;
}
else
{
depth=depth-1;
sierpinski(x1,y1,(x1+x2)/2,(y1+y2)/2,(x1+x3)/2,(y1+y3)/2,depth,colour);
sierpinski((x1+x2)/2,(y1+y2)/2,x2,y2,(x2+x3)/2,(y2+y3)/2,depth,colour);
sierpinski((x1+x3)/2,(y1+y3)/2,(x2+x3)/2,(y2+y3)/2,x3,y3,depth,colour);
}
}
}
thats the main part of it, but theres other files, that I think are required for it to work, and one that i know is required to work(core.jar) so I uploaded it to
www.madaco.net/asmodes.zip (i sometimes name random things as the name of a snake in the redwall series, thats why it has the project name that it does)
I hope its not overly simple.
EDIT: i know this place is either dead or about to die, but isnt this post of mine at least borderline interesting enough to respond to?
can someone please respond with suggestions or critisism, or acknowlage that i made this topic in some way?