Just discovered processing and am working with anothers script. I have no programing exp but was able to get it to work and save image on my pc. How can I save highres copy of what I see on screen? If anyone has a bit of script and the location I should place it it is greatly appreciated.
See actual script below.
void draw(){
line(20, 20, 80, 80);
// Saves a TIFF file named "diagonal.tif"
save("diagonal.tif");
// move discs
for (int c=0;c<num;c++) {
discs[c].move();
discs[c].render();
}
time++;
}
// OBJECTS
class Disc {
// index identifier
int id;
// position
float x,y;
// radius
float r;
// destination radius
float dr;
// velocity
float vx,vy;
// sand painters
int numsands = 3;
SandPainter[] sands = new SandPainter[numsands];
Disc(int Id, float X, float Y, float Vx, float Vy, float R) {
// construct
id=Id;
x=X;
y=Y;
vx=Vx;
vy=Vy;
r=0;
dr=R;
// create sand painters
for (int n=0;n<numsands;n++) {
sands[n] = new SandPainter();
}
}
void reset(int Id, float X, float Y, float Vx, float Vy, float R) {
// construct
id=Id;
x=X;
y=Y;
vx=Vx;
vy=Vy;
r=0;
dr=R;
}
void draw() {
stroke(0,50);
noFill();
ellipse(x,y,r,r);
}
void render() {
// find intersecting points with all ascending discs
for (int n=id+1;n<num;n++) {
// find distance to other disc
float dx = discs[n].x-x;
float dy = discs[n].y-y;
float d = sqrt(dx*dx+dy*dy);
// intersection test
if (d<(discs[n].r+r)) {
// complete containment test
if (d>abs(discs[n].r-r)) {
// find solutions
float a = (r*r - discs[n].r*discs[n].r + d*d ) / (2*d);
float p2x = x + a*(discs[n].x - x)/d;
float p2y = y + a*(discs[n].y - y)/d;
float h = sqrt(r*r - a*a);
float p3ax = p2x + h*(discs[n].y - y)/d;
float p3ay = p2y - h*(discs[n].x - x)/d;
float p3bx = p2x - h*(discs[n].y - y)/d;
float p3by = p2y + h*(discs[n].x - x)/d;
for (int s=0;s<numsands;s++) {
sands[s].render(p3ax,p3ay,p3bx,p3by);
}
}
}
}
}
See actual script below.
void draw(){
line(20, 20, 80, 80);
// Saves a TIFF file named "diagonal.tif"
save("diagonal.tif");
// move discs
for (int c=0;c<num;c++) {
discs[c].move();
discs[c].render();
}
time++;
}
// OBJECTS
class Disc {
// index identifier
int id;
// position
float x,y;
// radius
float r;
// destination radius
float dr;
// velocity
float vx,vy;
// sand painters
int numsands = 3;
SandPainter[] sands = new SandPainter[numsands];
Disc(int Id, float X, float Y, float Vx, float Vy, float R) {
// construct
id=Id;
x=X;
y=Y;
vx=Vx;
vy=Vy;
r=0;
dr=R;
// create sand painters
for (int n=0;n<numsands;n++) {
sands[n] = new SandPainter();
}
}
void reset(int Id, float X, float Y, float Vx, float Vy, float R) {
// construct
id=Id;
x=X;
y=Y;
vx=Vx;
vy=Vy;
r=0;
dr=R;
}
void draw() {
stroke(0,50);
noFill();
ellipse(x,y,r,r);
}
void render() {
// find intersecting points with all ascending discs
for (int n=id+1;n<num;n++) {
// find distance to other disc
float dx = discs[n].x-x;
float dy = discs[n].y-y;
float d = sqrt(dx*dx+dy*dy);
// intersection test
if (d<(discs[n].r+r)) {
// complete containment test
if (d>abs(discs[n].r-r)) {
// find solutions
float a = (r*r - discs[n].r*discs[n].r + d*d ) / (2*d);
float p2x = x + a*(discs[n].x - x)/d;
float p2y = y + a*(discs[n].y - y)/d;
float h = sqrt(r*r - a*a);
float p3ax = p2x + h*(discs[n].y - y)/d;
float p3ay = p2y - h*(discs[n].x - x)/d;
float p3bx = p2x - h*(discs[n].y - y)/d;
float p3by = p2y + h*(discs[n].x - x)/d;
for (int s=0;s<numsands;s++) {
sands[s].render(p3ax,p3ay,p3bx,p3by);
}
}
}
}
}
1