Help me modify this code
January 2, 2005 9:22 AM   Subscribe

Jared Tarbell generously offers the source code to Binary Ring (click on "Thumbnail gallery" – "Binary Ring" – "Launch applet"). I’d like to modify this code to make larger images of the same type but I’m not getting anywhere. How do I do this? I’m a beginner idiot.
posted by Termite to Technology (4 answers total)
 
Just glancing at it offhand, two parts seem relevant:
// dim is dimensions of rendering window
int dim = 500;
and
// ENVIRONMENTAL METHODS ----------------------------------------------

void setup() {
size(500,500);
// size(dim,dim);
If you wanted to it to render to a window 1000x1000, change the following:

"int dim = 500;" to "int dim = 1000;"

and

"size(500,500);" to "size(1000,1000);"

I'd like to test whether this works for you, but the code appears to be written for an as-yet-unreleased programming language called Processing, which somewhat hampers my ability to 100% verify that I'm correct ;)
posted by Ryvar at 9:43 AM on January 2, 2005


Response by poster: Ryvar wrote:

If you wanted to it to render to a window 1000x1000, change the following:
"int dim = 500;" to "int dim = 1000;"


That’s about the only thing I’m able to understand. But how do I run this script? I’ve tried putting it on a basic HTML page between [script] tags and it doesn’t work. I get a gray square (Java script not working) or a completely blank page. I also tried to save the script and linking to it the way Tarbell does, but I must be doing something wrong since it doesn’t work.
posted by Termite at 10:00 AM on January 2, 2005


OK, I'm not sure about how to get installing working webside, but if you're strictly interested in playing with it clientside, I can help you (just got it working, and my changes are correct).

First off, download the latest copy of Processing by going here, punching in your email address and they will mail you a link to the latest few alpha builds of Processing - I used 0.68 and it worked fine.

You will need Quicktime for Java installed, which was a gigantic pain in the ass for me because a) I'm smart enough to use QuicktimeAlternative rather than put up with QT's TSR bullshit and b) there's no 'custom' install option any longer in the official QT installer ever since Apple merged the iTunes and QT installer. I now have iTunes on my machine and feel slightly dirty.

Eventually I found a third-party source for QTJava.zip (here although for all I know it could be FILLED with viruses and such so grab it at your own risk - fortunately I'm reformatting this box tomorrow) and dropped it in both "c:\windows\system32\" and "C:\Program Files\Java\j2re1.4.2_05\lib\ext". After all that, I was able to run processing.exe, paste in the source code provided for Binary Ring and make my own modifications to the dim variable and the size function call within the setup function as specified above.

Voila! Works. Again, huge pain in the ass, but you can set it to render at what any size you want - please note that the dim variable is used in a bunch of the equations governing the creation/path of the particles and thus in all liklihood non-square window sizes will not work properly. Enjoy.
posted by Ryvar at 10:17 AM on January 2, 2005


Response by poster: Thanks for your work! I’m going to try this...
posted by Termite at 10:37 AM on January 2, 2005


« Older iPod case   |   Hybrid CD for PCs and MACs Newer »
This thread is closed to new comments.