25 most Recent Topics - Processing Discourse - Processing Discourse en-us Processing Discourse Thu, 22 Mar 2012 05:49:52 +0000 http://blogs.law.harvard.edu/tech/rss 30 Electronics,  Serial Library - Error inside Serial.ports() in exported app num_1251731980.html#6 Processing Discourse/Electronics,  Serial Library num_1251731980.html#6 Tue, 22 Nov 2011 08:24:57 +0000 Welcome back to playing this crazy game we love so much <br /><br />You could wait until the new EP Generations comes out and see if challenges will be introduced again since well be getting memories back in that EP. &nbsp;Itll be out May 31, 2011 here in North America so not too long to wait now Electronics,  Serial Library - Test, just a test num_1321114771.html#0 Processing Discourse/Electronics,  Serial Library num_1321114771.html#0 Sat, 12 Nov 2011 08:19:31 +0000 Hello. And Bye. Electronics,  Serial Library - so so easy walker horse shoes fisher cat num_1320642154.html#0 Processing Discourse/Electronics,  Serial Library num_1320642154.html#0 Sun, 06 Nov 2011 21:02:34 +0000 angiotensin i Website,  Documentation,  Book Bugs - PGraphicsPDF num_1218674750.html#4 Processing Discourse/Website,  Documentation,  Book Bugs num_1218674750.html#4 Fri, 03 Jun 2011 08:47:08 +0000 <b><a class="message" href="num_1218674750.html#1">fry wrote</a> on Aug 14<sup>th</sup>, 2008, 1:44pm:</b><br /><div class="quote" style="width: 90%">sorry about that, it looks like those examples need to be cleaned up a bit. here's a fixed version of the one you mentioned:<br /><br /> <b>Quote:</b><br /><div class="quote" style="width: 90%; overflow: auto;"><span style="color: #CC6600;">import</span> processing.pdf.*;<br /><br /><span style="color: #996600;">boolean</span> recording;<br />PGraphicsPDF pdf;<br /><br /><span style="color: #CC6600;">void</span> <span style="color: #996600;">setup</span>() &#123;<br />  <span style="color: #996600;">size</span>(400, 400);<br />  pdf = (PGraphicsPDF) <span style="color: #996600;">createGraphics</span>(<span style="color: #CC0000;">width</span>, <span style="color: #CC0000;">height</span>, <span style="color: #CC0000;">PDF</span>, <span style="color: #CC0000;">&quot;pause-resume.pdf&quot;</span>);<br />&#125;<br /><br /><span style="color: #CC6600;">void</span> <span style="color: #996600;">draw</span>() &#123;<br />  <span style="color: #777755;">// Be sure not to call background, otherwise your file</span><br />  <span style="color: #777755;">// will just accumulate lots of mess, only to become invisible</span><br />   <br />  <span style="color: #777755;">// Draw something good here</span><br />  <span style="color: #CC6600;">if</span> (<span style="color: #CC0000;">mousePressed</span>) &#123;<br />    <span style="color: #996600;">line</span>(<span style="color: #CC0000;">pmouseX</span>, <span style="color: #CC0000;">pmouseY</span>, <span style="color: #CC0000;">mouseX</span>, <span style="color: #CC0000;">mouseY</span>);<br />  &#125;<br />&#125;<br /><br /><span style="color: #CC6600;">void</span> <span style="color: #CC0000;">keyPressed</span>() &#123;<br />  <span style="color: #CC6600;">if</span> (<span style="color: #CC0000;">key</span> == <span style="color: #CC0000;">'r'</span>) &#123;<br />    <span style="color: #CC6600;">if</span> (recording) &#123;<br /> &nbsp; &nbsp; &nbsp;<span style="color: #996600;">endRecord</span>();<br /> &nbsp; &nbsp; &nbsp;<span style="color: #996600;">println</span>(<span style="color: #CC0000;">&quot;Recording stopped.&quot;</span>);<br /> &nbsp; &nbsp; &nbsp;recording = <span style="color: #CC6600;">false</span>;<br />    &#125; <span style="color: #CC6600;">else</span> &#123;<br /> &nbsp; &nbsp; &nbsp;<span style="color: #996600;">beginRecord</span>(pdf);<br /> &nbsp; &nbsp; &nbsp;<span style="color: #996600;">println</span>(<span style="color: #CC0000;">&quot;Recording started.&quot;</span>);<br /> &nbsp; &nbsp; &nbsp;recording = <span style="color: #CC6600;">true</span>;<br />    &#125;<br />  &#125; <span style="color: #CC6600;">else</span> <span style="color: #CC6600;">if</span> (<span style="color: #CC0000;">key</span> == <span style="color: #CC0000;">'q'</span>) &#123;<br />    <span style="color: #CC6600;">if</span> (recording) &#123;<br /> &nbsp; &nbsp; &nbsp;<span style="color: #996600;">endRecord</span>();<br />    &#125;<br />    <span style="color: #996600;">exit</span>();<br />  &#125; <br />&#125;<br /><br /> </div> </div><br /><br />Unfortunately this example overwrites the previous recording. I mean you can keep in the PDF file only the last sequence of your drawing.<br />Is there a way you could append the lines over and over or even press a key for nextPage() or something<br /><br />Thanks in advance Events,  Publications,  Opportunities - online processing classes num_1273271212.html#11 Processing Discourse/Events,  Publications,  Opportunities num_1273271212.html#11 josephgray@grauwald.com (Joseph Gray) Wed, 28 Jul 2010 15:41:03 +0000 The course mentioned below is being offered here now:<br /><br />http://training.oreilly.com/arduino/<br /><br />Cheers!<br />-Joe<br /><br /><br /><b><a class="message" href="num_1273271212.html#10">Joseph Gray wrote</a> on Jun 4<sup>th</sup>, 2010, 3:31pm:</b><br /><div class="quote" style="width: 90%">Hi, <br /><br />Interesting that you ask.  I'm developing a class right now with O'Reilly Media that will be starting August 31st.  It will be a live, free, video course, while it's going.  There will also be a pay version that includes downloads (pdf of all slides etc.) and access to the videos anytime.<br /><br />It will be at http://training.oreilly.com and you can send an email to training@oreilly.com to be notified when the class is available.<br /><br />Cheers,<br />Joseph Gray<br />http://grauwald.com </div><br /> Other Libraries - using cocoa library to run applescript num_1225564736.html#9 Processing Discourse/Other Libraries num_1225564736.html#9 Mon, 05 Jul 2010 08:34:35 +0000 <b><a class="message" href="num_1225564736.html#8">Wind Up Toy wrote</a> on Mar 27<sup>th</sup>, 2010, 2:07pm:</b><br /><div class="quote" style="width: 90%">I also cannot find &quot;com&quot; inside my /System/Library/Java folder...<br /><br />OS X 10.6.2<br /> </div><br /><br />The Java/Cocoa bridge has been removed by Apple in 10.6. :-( AFAIK you can use the files from 10.5 – or switch to http://code.google.com/p/rococoa/ Programs - Using light, shading 3d num_1255494263.html#12 Processing Discourse/Programs num_1255494263.html#12 Wed, 30 Jun 2010 01:31:01 +0000 Hi everyone !<br /><br />I'm pretty near the solution, but I cant make it work:<br /><br />I've got a sketch running with toxiclib's triangleMesh.<br />I've got another one running with surfaceLib.<br /><br />They both work fine, and i can use useVertexNormals() with surfaceLib, but I can't figure out how to connect those two. <br />I understand that it's possible to have a toxiclib's triangleMesh with the nice useVertexNormals from surfaceLib. But how ?! <br />Does anyone have an example ? <br /><br />Thanks for your help Video Capture,  Movie Playback,  Vision Libraries - camara resolution erratic / windows 7x64 num_1274902266.html#2 Processing Discourse/Video Capture,  Movie Playback,  Vision Libraries num_1274902266.html#2 Wed, 23 Jun 2010 19:13:51 +0000 I was having the same issue with video capture being distorted in Windows 7. <br /><br />Just installed winVDIG version 1.01 (not 1.05), it did the trick. You may download here: <a href="http://www.eden.net.nz/7/20071008/" target="_blank">http://www.eden.net.nz/7/20071008/</a> Programs - Program to find the shortest path num_1276835418.html#2 Processing Discourse/Programs num_1276835418.html#2 Fri, 18 Jun 2010 12:50:35 +0000 ox and oy is the x and y cordinates of the object that needs to move to the goal. &nbsp;gx and gy is the x and y position of the goal. &nbsp;thanks for the out of bounds comment. &nbsp;I'll try that. Syntax Questions - why the outer circle does not fade away? num_1276889853.html#0 Processing Discourse/Syntax Questions num_1276889853.html#0 Fri, 18 Jun 2010 12:37:33 +0000 I'm just testing minim library, I want to create cirles that are fading away eventually. I get the main circle work(which radius is 2*radius), and I don't know why the outer ring doesn't work.<br /><br />P.S.: you need to change the add your own mp3 to the data folder.<br /><br /> <b>Code:</b><pre class="code">import processing&#46;video&#46;*;<br &#47;>import ddf&#46;minim&#46;*;<br &#47;>import ddf&#46;minim&#46;signals&#46;*;<br &#47;>import ddf&#46;minim&#46;analysis&#46;*;<br &#47;>import ddf&#46;minim&#46;effects&#46;*;<br &#47;>import ddf&#46;minim&#46;*;<br &#47;><br &#47;><br &#47;>Minim minim;<br &#47;>AudioPlayer song;<br &#47;>&#47;&#47;WaveformRenderer waveform;<br &#47;>FFT fft;<br &#47;>ArrayList trails;<br &#47;>MovieMaker mm;<br &#47;>boolean play = false;<br &#47;><br &#47;>void setup&#40;&#41;<br &#47;>&#123;<br &#47;>  size&#40;1024, 800&#41;;<br &#47;>  background&#40;0&#41;;<br &#47;>  smooth&#40;&#41;;<br &#47;>  &#47;&#47;frameRate&#40;128&#41;;<br &#47;>  &#47;&#47;mm = new MovieMaker&#40;this, width,height,&quot;bubbles&#46;mov&quot;,30,MovieMaker&#46;VI&#068;EO, MovieMaker&#46;LOSSLESS&#41;;<br &#47;>  &#47;&#47; always start Minim first&#33;<br &#47;>  minim = new Minim&#40;this&#41;;<br &#47;><br &#47;>  &#47;&#47; specify 1024 for the length of the sample buffers<br &#47;>  &#47;&#47; the default buffer size is 1024<br &#47;>  song = minim&#46;loadFile&#40;&quot;&#31958;&#19981;&#21388;&#46;mp3&quot;, 1024&#41;;<br &#47;>  play&#40;&#41;;<br &#47;><br &#47;>  &#47;&#47;waveform = new WaveformRenderer&#40;&#41;;<br &#47;>  &#47;&#47;song&#46;addListener&#40;waveform&#41;;<br &#47;><br &#47;>  &#47;&#47; an FFT needs to know how <br &#47;>  &#47;&#47; long the audio buffers it will be analyzing are<br &#47;>  &#47;&#47; and also needs to know <br &#47;>  &#47;&#47; the sample rate of the audio it is analyzing<br &#47;>  fft = new FFT&#40;song&#46;bufferSize&#40;&#41;, song&#46;sampleRate&#40;&#41;&#41;;<br &#47;><br &#47;>  trails = new ArrayList&#40;&#41;;<br &#47;><br &#47;>&#125;<br &#47;><br &#47;>void play&#40;&#41;&#123;<br &#47;>  if&#40;play == true&#41;  song&#46;play&#40;&#41;; <br &#47;>&#125;<br &#47;><br &#47;>void draw&#40;&#41;<br &#47;>&#123;<br &#47;>  <br &#47;>  &#47;&#47;waveform&#46;draw&#40;&#41;;<br &#47;>  &#47;&#47;spectrum<br &#47;>  &#47;&#47; first perform a forward fft on one of song's buffers<br &#47;>  &#47;&#47; I'm using the mix buffer<br &#47;>  &#47;&#47;  but you can use any one you like<br &#47;>  fft&#46;forward&#40;song&#46;mix&#41;;<br &#47;><br &#47;>  &#47;&#47;stroke&#40;255, 0, 0, 128&#41;;<br &#47;>  &#47;&#47;strokeWeight&#40;5&#41;;<br &#47;>  &#47;&#47; draw the spectrum as a series of vertical lines<br &#47;>  &#47;&#47; I multiple the value of getBand by 4 <br &#47;>  &#47;&#47; so that we can see the lines better<br &#47;>  for&#40;int i = 0; i &lt; &#40;fft&#46;specSize&#40;&#41;&#45;1&#41;*2; i+=1024&#47;&#40;fft&#46;specSize&#40;&#41;&#45;1&#41;&#41;<br &#47;>  &#123;<br &#47;>    &#47;&#47;line&#40;i, height, i, height &#45; fft&#46;getBand&#40;i&#41;*5&#41;;<br &#47;><br &#47;>    if&#40;dist&#40;i,height, i, height &#45; fft&#46;getBand&#40;i&#41;*5&#41;&gt;height&#47;20&#41;&#123;<br &#47;> Circle c = new Circle&#40;int&#40;random&#40;0,width&#41;&#41;, int&#40;random&#40;0,height&#41;&#41;, random&#40;10,50&#41;, 255&#41;;<br &#47;> c&#46;drawOneCircle&#40;&#41;; <br &#47;>    &#125;<br &#47;>  &#125;<br &#47;><br &#47;>  &#47;&#47;trails<br &#47;>  for&#40;int j = 0; j &lt; trails&#46;size&#40;&#41;; j++&#41;&#123;<br &#47;>    Trail t = &#40;Trail&#41; trails&#46;get&#40;j&#41;;<br &#47;>    t&#46;update&#40;&#41;;<br &#47;>    t&#46;drawOneCircle&#40;&#41;;<br &#47;>  &#125;<br &#47;><br &#47;><br &#47;>  &#47;&#47;waveform<br &#47;>  stroke&#40;255&#41;;<br &#47;>  strokeWeight&#40;0&#41;;<br &#47;>  &#47;&#47; we draw the waveform by connecting neighbor values with a line<br &#47;>  &#47;&#47; we multiply each of the values by 50 <br &#47;>  &#47;&#47; because the values in the buffers are normalized<br &#47;>  &#47;&#47; this means that they have values between &#45;1 and 1&#46; <br &#47;>  &#47;&#47; If we don't scale them up our waveform <br &#47;>  &#47;&#47; will look more or less like a straight line&#46;<br &#47;>  for&#40;int i = 0; i &lt; song&#46;bufferSize&#40;&#41; &#45; 1; i++&#41;<br &#47;>  &#123;<br &#47;>    &#47;&#47;    line&#40;i, height&#47;2 &#45; 50 + song&#46;left&#46;get&#40;i&#41;*50, i+1, height&#47;2 &#45; 50 + song&#46;left&#46;get&#40;i+1&#41;*50&#41;;<br &#47;>    &#47;&#47;    line&#40;i, height&#47;2 + 50 + song&#46;right&#46;get&#40;i&#41;*50, i+1, height&#47;2 + 50 + song&#46;right&#46;get&#40;i+1&#41;*50&#41;;<br &#47;>    &#47;&#47;    line&#40;i, height&#47;2 + song&#46;mix&#46;get&#40;i&#41;*50, i +1, height&#47;2 + song&#46;mix&#46;get&#40;i+1&#41;*50&#41;;<br &#47;>  &#125;<br &#47;><br &#47;>  &#47;&#47;mm&#46;addFrame&#40;&#41;;<br &#47;><br &#47;><br &#47;>&#125;<br &#47;><br &#47;>void stop&#40;&#41;<br &#47;>&#123;<br &#47;>  song&#46;close&#40;&#41;;<br &#47;>  minim&#46;stop&#40;&#41;;<br &#47;><br &#47;>  super&#46;stop&#40;&#41;;<br &#47;>&#125;<br &#47;><br &#47;>void keyPressed&#40;&#41;&#123;<br &#47;>  if&#40;key == 'f'&#41;&#123;<br &#47;>    mm&#46;finish&#40;&#41;;<br &#47;>    println&#40;&quot;movie saved&quot;&#41;;  <br &#47;>  &#125; <br &#47;><br &#47;>  if &#40; key == 'p' &#41; &#123;<br &#47;>    play = true;<br &#47;>    play&#40;&#41;;<br &#47;>  &#125;<br &#47;>&#125;<br &#47;><br &#47;>class Circle&#123;<br &#47;>  &#47;&#47;variable<br &#47;>  int posx;<br &#47;>  int posy;<br &#47;>  float radius;<br &#47;>  float magnatude;<br &#47;><br &#47;>  &#47;&#47;constructor<br &#47;>  Circle&#40;int _posx, int _posy, float _radius, float _magnatude&#41;&#123;<br &#47;>    posx = _posx;<br &#47;>    posy = _posy;<br &#47;>    radius = _radius;<br &#47;>    magnatude = _magnatude;<br &#47;>  &#125;<br &#47;><br &#47;>  &#47;&#47;method<br &#47;>  void drawOneCircle&#40;&#41;&#123;<br &#47;><br &#47;><span class="highlight">    noStroke&#40;&#41;;<br &#47;>    fill&#40;magnatude,10&#41;;<br &#47;>    ellipse&#40;posx,posy,radius*4,radius*4&#41;;<br &#47;>    &#47;&#47;fill&#40;magnatude,magnatude,magnatude,10&#41;;<br &#47;>    ellipse&#40;posx,posy,radius*3,radius*3&#41;;<br &#47;>    &#47;&#47;fill&#40;magnatude,magnatude,magnatude,10&#41;;<br &#47;>    ellipse&#40;posx,posy,radius*2&#46;5,radius*2&#46;5&#41;;<br &#47;><br &#47;>    &#47;&#47;stroke&#40;0,60&#41;;<br &#47;>    fill&#40;magnatude&#41;;<br &#47;>    ellipse&#40;posx,posy,radius*2,radius*2&#41;;</span><br &#47;><br &#47;>    &#47;&#47;color<br &#47;>    &#47;&#47;noStroke&#40;&#41;;<br &#47;>&#47;&#47;    for&#40;int k = 1; k &lt; 30; k++&#41;&#123;<br &#47;>&#47;&#47; fill&#40;random&#40;0,magnatude&#41;,random&#40;0,magnatude&#41;,random&#40;0,magnatude&#41;,20&#41;;<br &#47;>&#47;&#47; arc&#40;posx, posy, radius*2, radius*2, random&#40;0,2*PI&#41;, random&#40;0,2*PI&#41;&#41;;<br &#47;>&#47;&#47;    &#125;<br &#47;><br &#47;><br &#47;>&#47;&#47;    for&#40;float i = 0&#46;0; i &lt; 2&#46;0*PI; i+=0&#46;5&#45;radius&#47;200&#41;&#123;<br &#47;>&#47;&#47; stroke&#40;0,random&#40;0,100&#41;&#41;;<br &#47;>&#47;&#47; line&#40;posx,posy,posx+sin&#40;i&#41;*radius,posy+cos&#40;i&#41;*radius&#41;;<br &#47;>&#47;&#47;    &#125;<br &#47;><br &#47;>    trails&#46;add&#40;new Trail&#40;posx, posy, radius, magnatude&#41;&#41;;<br &#47;><br &#47;>  &#125;<br &#47;><br &#47;><br &#47;>&#125;<br &#47;><br &#47;>class Trail&#123;<br &#47;>  &#47;&#47;variable<br &#47;>  int posx;<br &#47;>  int posy;<br &#47;>  float radius;<br &#47;>  float magnatude;<br &#47;><br &#47;>  &#47;&#47;constructor<br &#47;>  Trail&#40;int _posx, int _posy, float _radius, float _magnatude&#41;&#123;<br &#47;>    posx = _posx;<br &#47;>    posy = _posy;<br &#47;>    radius = _radius;<br &#47;>    magnatude = _magnatude; <br &#47;>  &#125;<br &#47;><br &#47;>  &#47;&#47;method<br &#47;>  void update&#40;&#41;&#123;<br &#47;>  <span class="highlight">  magnatude&#45;=30;</span><br &#47;><br &#47;>    if&#40;magnatude &lt; 0&#41;&#123;<br &#47;> trails&#46;remove&#40;this&#41;; <br &#47;> &#47;&#47;println&#40;&quot;circle remove&quot;&#41;;<br &#47;>    &#125;<br &#47;>  &#125;<br &#47;><br &#47;>  void drawOneCircle&#40;&#41;&#123;<br &#47;><span class="highlight"><br &#47;>    noStroke&#40;&#41;;<br &#47;>    fill&#40;magnatude,10&#41;;<br &#47;>    ellipse&#40;posx,posy,radius*4,radius*4&#41;;<br &#47;>    &#47;&#47;fill&#40;magnatude,magnatude,magnatude,10&#41;;<br &#47;>    ellipse&#40;posx,posy,radius*3,radius*3&#41;;<br &#47;>    &#47;&#47;fill&#40;magnatude,magnatude,magnatude,10&#41;;<br &#47;>    ellipse&#40;posx,posy,radius*2&#46;5,radius*2&#46;5&#41;;<br &#47;><br &#47;>    &#47;&#47;stroke&#40;0,60&#41;;<br &#47;>    fill&#40;magnatude&#41;;<br &#47;>    ellipse&#40;posx,posy,radius*2,radius*2&#41;;</span><br &#47;><br &#47;>    &#47;&#47;color<br &#47;>&#47;&#47;    noStroke&#40;&#41;;<br &#47;>&#47;&#47;    for&#40;int k = 1; k &lt; 30; k++&#41;&#123;<br &#47;>&#47;&#47; fill&#40;random&#40;0,magnatude&#41;,random&#40;0,magnatude&#41;,random&#40;0,magnatude&#41;,20&#41;;<br &#47;>&#47;&#47; arc&#40;posx, posy, radius*2, radius*2, random&#40;0,2*PI&#41;, random&#40;0,2*PI&#41;&#41;;<br &#47;>&#47;&#47;    &#125;<br &#47;><br &#47;><br &#47;>&#47;&#47;    for&#40;float i = 0&#46;0; i &lt; 2&#46;0*PI; i+=0&#46;5&#45;radius&#47;200&#41;&#123;<br &#47;>&#47;&#47; stroke&#40;0,random&#40;0,100&#41;&#41;;<br &#47;>&#47;&#47; line&#40;posx,posy,posx+sin&#40;i&#41;*radius,posy+cos&#40;i&#41;*radius&#41;;<br &#47;>&#47;&#47;    &#125;<br &#47;><br &#47;>  &#125;<br &#47;><br &#47;><br &#47;>&#125;<br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;><br &#47;> </pre> Exhibition - 64-bit images - Just for fun project num_1276889732.html#0 Processing Discourse/Exhibition num_1276889732.html#0 Fri, 18 Jun 2010 12:35:32 +0000 So last night i was scrolling through the sample for &quot;Processing: a programming handbook for visual designers and artists&quot; to see what it's about and the interview with Jared Tarbell really caught my eye with his &quot;Fractal.Invaders&quot; and i remember trying to do something like it myself some years ago but failing badly, basically my idea was to do it all with one &quot;big&quot; recursive function - long story short: Stack overflow.<br /><br /> Anyways, so i thought &quot;hey lets try it again, i must be able to come up with some smart way of doing it&quot; and as it turns out i was. So i thought i'd share what i came up with:<br /><br /> <b>Code:</b><pre class="code"><br &#47;>int number;<br &#47;>int rectWidth;<br &#47;>int offset;<br &#47;>void setup&#40;&#41;&#123;<br &#47;>  size&#40;800,800&#41;;<br &#47;>  background&#40;255&#41;;<br &#47;>  fill&#40;0&#41;;<br &#47;>  noStroke&#40;&#41;;<br &#47;>  number = 1515175624; &#47;&#47;magic constant&#33;<br &#47;>  offset = 5; &#47;&#47;ofset from the edge of the window&#46;&#46; sort of<br &#47;>  rectWidth = height&#47;8&#45;offset; &#47;&#47; width of the boxes<br &#47;>&#125;<br &#47;><br &#47;>void draw&#40;&#41;&#123;<br &#47;>  background&#40;255&#41;;<br &#47;>  int temp = number;<br &#47;>  for&#40;int y = 0; y &lt; 8;y++&#41;&#123;<br &#47;>    for&#40;int x = 0; x &lt; 4;x++&#41;&#123;<br &#47;>      if&#40;temp%2 == 0&#41;&#123;<br &#47;>        fill&#40;255&#41;;<br &#47;>      &#125;else&#123;<br &#47;>        fill&#40;0&#41;;<br &#47;>      &#125;<br &#47;>      rect&#40;offset*4+&#40;width&#45;height&#41;&#47;2+x*rectWidth,offset*4+y*rectWidth,rectWidth,rectWidth&#41;;<br &#47;>      rect&#40;&#45;&#40;width&#45;height&#41;&#47;2&#45;offset*4+width&#45;&#40;x+1&#41;*rectWidth,offset*4+y*rectWidth,rectWidth,rectWidth&#41;;<br &#47;>      temp = temp &gt;&gt;1;<br &#47;>    &#125; <br &#47;>  &#125;<br &#47;> &#47;&#47;number = int&#40;random&#40;&#45;&#40;MAX_INT&#41;&#41;&#41;+int&#40;random&#40;&#40;128&#41;&#41;&#41;; &#47;&#47;uncomment this &#45; shit brix<br &#47;>&#125;<br &#47;><br &#47;>void mousePressed&#40;&#41;&#123;<br &#47;>  number = int&#40;random&#40;&#45;&#40;MAX_INT&#41;&#41;&#41;+int&#40;random&#40;&#40;128&#41;&#41;&#41;;<br &#47;>&#125; </pre><br /><br />I'd like to point out that while the code is indeed mine, the idea of mirroring the random-pattern to create space invader-like creature belongs to Jared (as far as i can tell). This code is just my solution to the program he described. Also i haven't actually seen Jared's source code for it was in .fla format and im still downloading flash.<br />There, just wanted to point that out so no one is offended or confused :)<br /><br /><br />Usage: Click to create a new random thingy. Syntax Questions - loadStrings num_1276884781.html#2 Processing Discourse/Syntax Questions num_1276884781.html#2 Fri, 18 Jun 2010 12:13:18 +0000 That gives me the same error, if i try:<br /><br /> <b>Code:</b><pre class="code">int numPics = 292; &#47;&#47; change with number of points, numPics = # pictures<br &#47;>int numPts = 866; &#47;&#47; number of points in spectra<br &#47;>PImage&#91;&#93; pics = new PImage&#91;numPics&#93;;<br &#47;>String&#91;&#93;&#91;&#93; spec;<br &#47;><br &#47;>void setup&#40;&#41; &#123;<br &#47;>  size&#40;1000,950&#41;;<br &#47;>  smooth&#40;&#41;;<br &#47;>  for &#40;int k = 0; k &lt; numPics; k++&#41; &#123;<br &#47;>    for &#40;int h = 0; h &lt; numPts; h++&#41; &#123;<br &#47;>    String imageName =  &quot;S5_stamp_&quot; + nf&#40;k, 5&#41; + &quot;&#46;png&quot;;<br &#47;>    pics&#91;k&#93; = loadImage&#40;imageName&#41;;<br &#47;>    String spectra = &quot;S5_hi_spectra_&quot; + nf&#40;k, 5&#41; + &quot;&#46;txt&quot;;<br &#47;>    spec&#91;k&#93;&#91;h&#93; = loadStrings&#40;spectra&#41;;  <br &#47;>  &#125;<br &#47;>  &#125; </pre><br /><br />If I just try:<br /><br /> <b>Code:</b><pre class="code">int numPics = 292; &#47;&#47; change with number of points, numPics = # pictures<br &#47;>int numPts = 866; &#47;&#47; number of points in spectra<br &#47;>PImage&#91;&#93; pics = new PImage&#91;numPics&#93;;<br &#47;>String&#91;&#93;&#91;&#93; spec;<br &#47;><br &#47;>void setup&#40;&#41; &#123;<br &#47;>  size&#40;1000,950&#41;;<br &#47;>  smooth&#40;&#41;;<br &#47;>  for &#40;int k = 0; k &lt; numPics; k++&#41; &#123;<br &#47;>    for &#40;int h = 0; h &lt; numPts; h++&#41; &#123;<br &#47;>    String imageName =  &quot;S5_stamp_&quot; + nf&#40;k, 5&#41; + &quot;&#46;png&quot;;<br &#47;>    pics&#91;k&#93; = loadImage&#40;imageName&#41;;<br &#47;>    String spectra = &quot;S5_hi_spectra_&quot; + nf&#40;k, 5&#41; + &quot;&#46;txt&quot;;<br &#47;>    spec = loadStrings&#40;spectra&#41;;  <br &#47;>  &#125;<br &#47;>  &#125; </pre><br /><br />I get &quot;cannot convert from String[] to String[][]&quot;. It does actually work if I make spec just a String[] and don't specify spec[k], but that isn't what I want it to do. I want each spec[k] to be one filename so that I can then split the data from each file into the form I need for my graph. Syntax Questions - open console in draw window. Is possible? num_1276884627.html#1 Processing Discourse/Syntax Questions num_1276884627.html#1 Fri, 18 Jun 2010 12:00:18 +0000 Looks like it -- I haven't done it but check out <a href="http://java.sun.com/javase/6/docs/api/java/io/Console.html" target="_blank">http://java.sun.com/javase/6/docs/api/java/io/Console.html</a> Programs - Point to line distance num_1276644884.html#4 Processing Discourse/Programs num_1276644884.html#4 Fri, 18 Jun 2010 10:43:28 +0000 hey smitty! <br /><br />thanks again for suggestions, i removed mY completely. <br /><br />as for your other suggestion about pre-calculating distance+cos/sin: this definitely makes sense if one always checks against a static set of lines, but also means more work before the function call can happen. <br />i think the current version is a good trade-off between ease of use and speed. <br /><br />so for completeness: here's a version that is totally crazy fast as long as your lines rarely change. <br />i put the whole thing into a class cause i'm not a big fan of having many variables flying around. <br /><br /> <b>Code:</b><pre class="code"><br &#47;>&#47;&#47; press space to reset<br &#47;>&#47;&#47; click for randomness<br &#47;>&#47;&#47; drag to move<br &#47;><br &#47;>Line myLine; <br &#47;><br &#47;>void setup&#40;&#41;&#123;<br &#47;>  size&#40; 600, 600 &#41;; <br &#47;>  smooth&#40;&#41;; <br &#47;>  textFont&#40; loadFont&#40; &quot;SansSerif&#45;12&#46;vlw&quot; &#41; &#41;; <br &#47;>  <br &#47;>  myLine = new Line&#40; width&#47;2 &#45; 100, height&#47;2, width&#47;2 + 100, height&#47;2 &#41;; <br &#47;>&#125;<br &#47;><br &#47;><br &#47;>void draw&#40;&#41;&#123;<br &#47;>  background&#40; 0 &#41;; <br &#47;>  <br &#47;>  stroke&#40; 255 &#41;; <br &#47;>  myLine&#46;draw&#40;&#41;; <br &#47;><br &#47;>  fill&#40; 255, 255, 0 &#41;; <br &#47;>  noStroke&#40;&#41;; <br &#47;>  ellipse&#40; mouseX, mouseY, 10, 10 &#41;; <br &#47;>  <br &#47;>  PVector result = myLine&#46;get&#068;istance&#40; mouseX, mouseY &#41;; <br &#47;>  stroke&#40; 150 &#41;; <br &#47;>  line&#40; mouseX, mouseY, result&#46;x, result&#46;y &#41;; <br &#47;>  <br &#47;>  fill&#40; 255 &#41;; <br &#47;>  text&#40; &quot;The distance to the line is&#58; &quot; + result&#46;z, 10, 10 &#41;; <br &#47;>&#125;<br &#47;><br &#47;><br &#47;>void mousePressed&#40;&#41;&#123;<br &#47;>  myLine&#46;x1 = 100+random&#40;width&#45;200&#41;; <br &#47;>  myLine&#46;y1 = 100+random&#40;height&#45;200&#41;; <br &#47;>  myLine&#46;update&#40;&#41;; <br &#47;>&#125;<br &#47;><br &#47;>void mouse&#068;ragged&#40;&#41;&#123;<br &#47;>  myLine&#46;x1 = mouseX; <br &#47;>  myLine&#46;y1 = mouseY; <br &#47;>  myLine&#46;update&#40;&#41;; <br &#47;>&#125;<br &#47;><br &#47;>void keyPressed&#40;&#41;&#123;<br &#47;>  myLine&#46;x1 = width&#47;2&#45;100; <br &#47;>  myLine&#46;y1 = height&#47;2; <br &#47;>  myLine&#46;update&#40;&#41;; <br &#47;>&#125;<br &#47;><br &#47;>&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;<br &#47;><br &#47;>class Line&#123;<br &#47;>  &#47;&#47; where does the line start&#47;end&#63; <br &#47;>  public float x1, x2, y1, y2; <br &#47;>  <br &#47;>  &#47;&#47; some happy math variables<br &#47;>  private float dx, dy, d, ca, sa, mx, dx2, dy2; <br &#47;>  <br &#47;>  &#47;&#47; we use this to store the result, <br &#47;>  &#47;&#47; so if you want to store the result and calculate again <br &#47;>  &#47;&#47; you should do <br &#47;>  &#47;&#47; PVector mine = new PVector&#40;&#41;; <br &#47;>  &#47;&#47; mine&#46;set&#40; line&#46;get&#068;istance&#40; mouseX, mouseY &#41; &#41;; <br &#47;>  private PVector result; <br &#47;>  <br &#47;>  public Line&#40; float x1, float y1, float x2, float y2 &#41;&#123;<br &#47;>    this&#46;x1 = x1; <br &#47;>    this&#46;y1 = y1; <br &#47;>    this&#46;x2 = x2; <br &#47;>    this&#46;y2 = y2; <br &#47;>    result = new PVector&#40;&#41;; <br &#47;>    update&#40;&#41;; <br &#47;>  &#125;<br &#47;>  <br &#47;>  &#47;**<br &#47;>   * Call this after changing the coordinates&#33;&#33;&#33; <br &#47;>   *&#47;<br &#47;>  public void update&#40;&#41;&#123;<br &#47;>    dx = x2 &#45; x1; <br &#47;>    dy = y2 &#45; y1; <br &#47;>    d = sqrt&#40; dx*dx + dy*dy &#41;; <br &#47;>    ca = dx&#47;d; &#47;&#47; cosine<br &#47;>    sa = dy&#47;d; &#47;&#47; sine <br &#47;>  &#125;<br &#47;>  <br &#47;>  &#47;**<br &#47;>   * Returns a point on this line<br &#47;>   * that is closest to the point &#40;x,y&#41;<br &#47;>   * <br &#47;>   * The result is a PVector&#46; <br &#47;>   * result&#46;x and result&#46;y are points on the line&#46; <br &#47;>   * The result&#46;z variable contains the distance from &#40;x,y&#41; to the line, just in case you need it &#58;&#41; <br &#47;>   *&#47;<br &#47;>  PVector get&#068;istance&#40; float x, float y &#41;&#123;<br &#47;>    mx = &#40;&#45;x1+x&#41;*ca + &#40;&#45;y1+y&#41;*sa;<br &#47;>    <br &#47;>    if&#40; mx &lt;= 0 &#41;&#123;<br &#47;>      result&#46;x = x1; <br &#47;>      result&#46;y = y1; <br &#47;>    &#125;<br &#47;>    else if&#40; mx &gt;= d &#41;&#123;<br &#47;>      result&#46;x = x2; <br &#47;>      result&#46;y = y2; <br &#47;>    &#125;<br &#47;>    else&#123;<br &#47;>      result&#46;x = x1 + mx*ca; <br &#47;>      result&#46;y = y1 + mx*sa; <br &#47;>    &#125;<br &#47;>    <br &#47;>    dx2 = x &#45; result&#46;x; <br &#47;>    dy2 = y &#45; result&#46;y; <br &#47;>    result&#46;z = sqrt&#40; dx2*dx2 + dy2*dy2 &#41;; <br &#47;>    <br &#47;>    return result;   <br &#47;>  &#125;<br &#47;>  <br &#47;>  &#47;**<br &#47;>   * &#068;raw it&#33; <br &#47;>   *&#47;<br &#47;>  public void draw&#40;&#41;&#123;<br &#47;>    line&#40; x1, y1, x2, y2 &#41;; <br &#47;>  &#125;<br &#47;>&#125;<br &#47;> </pre><br /><br /><br />obviously there are many more optimizations one could go for, e.g. in my own project i don't even need the result.x/result.y variables so i threw them out alltogether and only return the distance. Syntax Questions - moving ellipses using array of coordinates num_1276614899.html#5 Processing Discourse/Syntax Questions num_1276614899.html#5 Fri, 18 Jun 2010 10:04:46 +0000 I have corrected my sketch in this way: &nbsp;<br /> <b>Code:</b><pre class="code">PImage mapImage;<br &#47;>Table locationTable;<br &#47;>Table destinationTable;<br &#47;>float size =&#46;7;<br &#47;>float x;<br &#47;>float y;<br &#47;>float targetX;<br &#47;>float targetY;<br &#47;>float easing;<br &#47;>int rowCount;<br &#47;>int start;<br &#47;><br &#47;>PVector&#91;&#93; location = new PVector&#91;110&#93;;<br &#47;>PVector&#91;&#93; destination = new PVector&#91;110&#93;;<br &#47;>PVector&#91;&#93; velocity = new PVector &#91;110&#93;;<br &#47;><br &#47;><br &#47;>void setup&#40;&#41;&#123;<br &#47;>  background &#40;0, 0, 0&#41;;<br &#47;>  size&#40;450,551&#41;;<br &#47;>  ellipseMode&#40;CENTER&#41;;<br &#47;>  colorMode&#40;RGB,255,255,255,255&#41;;<br &#47;>  noStroke&#40;&#41;;<br &#47;>  smooth&#40;&#41;;<br &#47;>  noise&#068;etail&#40;14&#41;;<br &#47;><br &#47;>  mapImage = loadImage&#40;&quot;pianta&#45;italia&#45;regione&#46;png&quot;&#41;;<br &#47;><br &#47;>  easing = 0&#46;008;<br &#47;>  frameRate &#40;10&#41;;<br &#47;>  start = millis&#40;&#41;;<br &#47;><br &#47;>  locationTable = new Table&#40;&quot;locations&#46;tsv&quot;&#41;;<br &#47;>  destinationTable = new Table&#40;&quot;destinations&#46;tsv&quot;&#41;;<br &#47;>  rowCount = locationTable&#46;getRowCount&#40;&#41;;<br &#47;><br &#47;>  for &#40;int row = 0; row &lt; 110; row++&#41; &#123;<br &#47;><br &#47;>    x = locationTable&#46;getFloat&#40;row, 1&#41;; <br &#47;>    y = locationTable&#46;getFloat&#40;row, 2&#41;;<br &#47;><br &#47;>    targetX = destinationTable&#46;getFloat&#40;row, 1&#41;; <br &#47;>    targetY = destinationTable&#46;getFloat&#40;row, 2&#41;;<br &#47;>    location&#91;row&#93; = new PVector &#40;x, y&#41;;<br &#47;>    <br &#47;>    <br &#47;>  &#125;<br &#47;><br &#47;>&#125;<br &#47;><br &#47;>void draw&#40;&#41;&#123;<br &#47;><br &#47;>  tint&#40;100,100,100, 6&#41;; <br &#47;>  image&#40;mapImage, 0, 0&#41;;<br &#47;><br &#47;>  &#47;&#47;fill&#40;0,0,0,2&#41;;<br &#47;>  &#47;&#47;rect&#40;&#45;5,&#45;5,width+5,height+5&#41;;<br &#47;><br &#47;>  for &#40;int row = 0; row &lt; 110; row++&#41; &#123;<br &#47;>    <br &#47;>    destination&#91;row&#93; = new PVector &#40;targetX, targetY&#41;;<br &#47;><br &#47;>    velocity&#91;row&#93; = new PVector &#40;&#40;destination&#91;row&#93;&#46;x &#45; location&#91;row&#93;&#46;x&#41;*easing , &#40;&#40;destination&#91;row&#93;&#46;x &#45; location&#91;row&#93;&#46;y&#41;+30&#41;*easing &#41;;<br &#47;>    location&#91;row&#93;&#46;add&#40;velocity&#91;row&#93;&#41;;<br &#47;><br &#47;>    for&#40;int i=0; i&lt;50; i++&#41;&#123;<br &#47;> fill&#40;255,255,250,122&#47;&#40;i+1&#41;&#41;;<br &#47;> ellipse&#40;location&#91;row&#93;&#46;x,location&#91;row&#93;&#46;y,size&#47;8*i,size&#47;8*i&#41;;<br &#47;>    &#125;<br &#47;>  &#125;<br &#47;><br &#47;><br &#47;>  if&#40;&#40;millis&#40;&#41;&#45;start&#41; &gt;= 4000&#41;&#123;<br &#47;>    for &#40;int row = 0; row &lt; 110; row++&#41; &#123;<br &#47;> <br &#47;> destination&#91;row&#93; = new PVector &#40;targetX, targetY&#41;;<br &#47;><br &#47;> velocity&#91;row&#93; = new PVector &#40;&#40;destination&#91;row&#93;&#46;x &#45; location&#91;row&#93;&#46;x&#41;*easing , &#40;&#40;destination&#91;row&#93;&#46;x &#45; location&#91;row&#93;&#46;y&#41;+30&#41;*easing &#41;;<br &#47;> location&#91;row&#93;&#46;add&#40;velocity&#91;row&#93;&#41;;<br &#47;><br &#47;> for&#40;int i=0; i&lt;50; i++&#41;&#123;<br &#47;>  fill&#40;255,255,250,122&#47;&#40;i+1&#41;&#41;;<br &#47;>  ellipse&#40;location&#91;row&#93;&#46;x,location&#91;row&#93;&#46;y,size&#47;8*i,size&#47;8*i&#41;;<br &#47;> &#125;<br &#47;>    &#125;<br &#47;>  &#125;<br &#47;>&#125; </pre><br /><br />but now I can't delay with millis() the second block of ellipse, why? Video Capture,  Movie Playback,  Vision Libraries - Install OpenCV library num_1276875144.html#0 Processing Discourse/Video Capture,  Movie Playback,  Vision Libraries num_1276875144.html#0 hugo.assanti@gmail.com (HugoA) Fri, 18 Jun 2010 08:32:24 +0000 I'm trying to install openCV library. I Download the framework and the OpenCV Processing Library. Place the folder into Documents/Processing/libraries.<br /><br />When i run this code<br /> <b>Code:</b><pre class="code"><br &#47;>import hypermedia&#46;video&#46;*;        &#47;&#47;  Imports the OpenCV library<br &#47;>OpenCV opencv;                    &#47;&#47;  Creates a new OpenCV Object<br &#47;><br &#47;>void setup&#40;&#41;<br &#47;>&#123;<br &#47;><br &#47;>  size&#40; 320, 240 &#41;;<br &#47;><br &#47;>  opencv = new OpenCV&#40; this &#41;;    &#47;&#47;  Initialises the OpenCV object<br &#47;>  opencv&#46;capture&#40; 320, 240 &#41;;     &#47;&#47;  Opens a video capture stream<br &#47;><br &#47;>&#125;<br &#47;><br &#47;>void draw&#40;&#41;<br &#47;>&#123;<br &#47;><br &#47;>  opencv&#46;read&#40;&#41;;                  &#47;&#47;  Grabs a frame from the camera<br &#47;>  image&#40; opencv&#46;image&#40;&#41;, 0, 0 &#41;;  &#47;&#47;  &#068;isplays the image in the OpenCV buffer to the screen<br &#47;><br &#47;>&#125;<br &#47;> </pre><br /><br />I get this error<br />The package &quot;hypermedia&quot; does not exist. You might be missing a library<br />Note that release 1.0, libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder.<br /><br />I'm using a Mac.<br /><br />How can i solve this?<br />Thanks General Discussion,  Status - Server move in progress num_1275931436.html#4 Processing Discourse/General Discussion,  Status num_1275931436.html#4 Fri, 18 Jun 2010 08:29:27 +0000 <b><a class="message" href="num_1275931436.html#3">kotakeripik wrote</a> on Jun 16<sup>th</sup>, 2010, 11:53pm:</b><br /><div class="quote" style="width: 90%">is it making the connection very slow  </div><br />No, though the slow connection is one of the reasons for the move. We're hoping that the new server will either fix the problem or if not, give us a better starting point from which to figure out what's causing the problem. Syntax Questions - removing elements of an arrayList num_1275642093.html#11 Processing Discourse/Syntax Questions num_1275642093.html#11 Fri, 18 Jun 2010 07:21:30 +0000 i'm still stuck on this <img src="yabbfiles/Templates/Forum/processing_one/shocked.gif" border="0" alt="Shocked" title="Shocked" /><br /><br />i think, as blindfish says , i am &quot;setting a reference to the original array rather than creating a true copy&quot;.<br /><br /><u>my code</u>:<br />ObjectA [] objecta= new ObjectA[objecta];<br />void setup() &#123;<br />//data is loaded from an xml file<br /><br />objecta[i] = new ObjectA(id, color(H, S, B), area, new PVector(position.x, position.y));     //defines ObjectA<br /> //add associates to arrayList of ObjectA and ObjectB<br />    objecta[i].associates.add(asso1);<br />    objecta[i].objectb.associates.add(asso1); <br />    objecta[i].associates.add(asso2);<br />    objecta[i].objectb.associates.add(asso2);<br />&#125;<br />////////////////////////////////////////////////////////////////////<br />class ObjectA&#123;<br />  ObjectB objectb;<br />  ArrayList objectCs;<br />  PVector origin; <br />  ArrayList associates = new ArrayList();<br />  int objectcCount = population;<br /><br />  ObjectA(int id, int colour, int Size, PVector loc) &#123;<br />    objectb= new ObjectB (id, colour, Size, loc);                 <br />    //ObjectC<br />    objectCs = new ArrayList();<br />    origin = loc.get();<br />    for (int i = 0; i &lt; population; i++) &#123;<br />      objectCs.add(new objectC(id, Size, origin, false, i, associates));<br /><span style="color: #ff0000;">//i think this is were i go wrong passing the associates to objectCs </span>      <br />    &#125;<br />  &#125;<br />////////////////////////////////////////////////////////////////////<br />class ObjectB &#123;<br />  int id;<br />  color colour;<br />  int Size;<br />  int x;<br />  int y;<br />  PVector position;<br />  ArrayList associates = new ArrayList();<br /><br />  ObjectB(int identity, int c, int area, PVector loc) &#123;   <br />    id = identity;<br />    colour = c;<br />    Size = area;<br />    position = loc.get();<br />    &#125;<br />////////////////////////////////////////////////////////////////////<br />class objectC&#123;<br />  ArrayList associates = new ArrayList();<br /><br />objectC(int identity, int Size, PVector loc, boolean mode, int whom, ArrayList asso) &#123;<br />  associates = asso;<br />  &#125;<br /><br />ObjectA is composed of ObjectB and ObjectC. ObjectCs is an arrayList.<br />how can i copy the arrayList associates of either ObjectA or ObjectB to each ObjectC? <br /><br />Thanks Syntax Questions - layering art with transparency never gets opaque num_1276848262.html#2 Processing Discourse/Syntax Questions num_1276848262.html#2 Fri, 18 Jun 2010 07:07:54 +0000 yes to what smitty said. &nbsp;alpha-blending just doesn't work that way, it *never* fully accumulates, because it's always adding a &quot;portion of the difference&quot;, and as the difference gets smaller, so does the portion. &nbsp;a process of diminishing gains, sooner or later you hit a wall (exactly *where* that wall is depends on your alpha value, but it's still there, somewhere)<br /><br />google for &quot;zeno's second paradox&quot;, it's an apt analogy.<br /><br />smitty's stuck-at value of 230 is right for your case too. &nbsp;why? &nbsp;let's say you have a current pixel value of 230 in your image, trying to blend it towards 255 (white) at alpha 10 (3.9%). &nbsp;the difference is 25, and what is 3.9% of 25? &nbsp;0.975, less than one, so after addition it will truncate back to 230. &nbsp;so you could do that a bazillion times and you'd never reach 255, you're stuck. &nbsp;(in practice you'll possibly hit the limit a bit earlier than 230, due to other similar problems with integer math in the alpha blending code)<br /><br />hth General Discussion,  Status - This forum will be shut down soon num_1276854723.html#1 Processing Discourse/General Discussion,  Status num_1276854723.html#1 Fri, 18 Jun 2010 06:54:38 +0000 Sounds great! &nbsp;I assume the new forum will be at the same URL this one is at right now?<br /><br />Thanks for all the hard work, guys. &nbsp;I've never said &quot;thanks&quot; to the whole Processing team, but I owe you guys a lot, so thanks. Programs - Need help with Project Euler question. num_1276829883.html#4 Processing Discourse/Programs num_1276829883.html#4 Fri, 18 Jun 2010 06:51:01 +0000 Two things:<br />1) why are you solving math problems and learning the basics of programming in processing I mean, sure there's nothing wrong with it, it just seems a bit odd if you ask me :p<br /><br />2) You should <u>really</u> do some reading on the Modulo operator (%) <a href="http://en.wikipedia.org/wiki/Modulo_operation" target="_blank">http://en.wikipedia.org/wiki/Modulo_operation</a> <br /><a href="http://processing.org/reference/modulo.html" target="_blank">http://processing.org/reference/modulo.html</a>. <br />Your entire program can be written in 9 lines of code while at the same time giving the right answer <img src="yabbfiles/Templates/Forum/processing_one/smiley.gif" border="0" alt="Smiley" title="Smiley" /><br /><br />on a side note though: &quot;multiples of 3 or 5&quot; is that a normal &quot;or&quot; or a &quot;exclusive or&quot; (xor) Syntax Questions - Having a hard time coding a parabola num_1276797573.html#4 Processing Discourse/Syntax Questions num_1276797573.html#4 Fri, 18 Jun 2010 06:43:34 +0000 Glad to help! &nbsp;You can probably skip the calc refresher if all you're interested in is ballistic objects, but it might be handy for other things.<br /><br />Also, one minor thing: if you want your numbers for the second method to be &quot;exact&quot;, you'll want to do this:<br /><br /> <b>Code:</b><pre class="code">  &#47;&#47; double assignment creates y acceleration<br &#47;>  y += ySpeed + 0&#46;5*accel;<br &#47;>  ySpeed += accel;<br &#47;><br &#47;>  &#47;&#47; instead of&#58;<br &#47;>  &#47;&#47; ySpeed += accel;<br &#47;>  &#47;&#47; y += ySpeed;   </pre><br /><br />This will correctly calculate the position for a uniform constant acceleration, whereas the other method (commented out) treats it as a series of acceleration &quot;bursts&quot;, one at each frame of the simulation.<br /><br />In most cases the difference won't be noticeable to the naked eye, but for large accelerations it can make a difference. &nbsp;It's also nice if you need the numbers to come out exactly right.<br /> Syntax Questions - OOP num_1276785147.html#3 Processing Discourse/Syntax Questions num_1276785147.html#3 Fri, 18 Jun 2010 05:57:11 +0000 Well I guess this basically all boils down to how you construct your code, and the techniques you use will depend on the context.<br /><br />TBH we already use the 'composition' technique the moment we start adding properties to a class.  More often than not these properties are built-in objects, but it doesn't take much to also start using custom objects; and that's where polymorphism can be really useful as it ensures that your custom object conforms to a required standard.<br /><br />Obviously if working alone it's possible to manually ensure that your new objects conform, but it doesn't take much effort to write a base Interface (or abstract class), which means that if you come back to the project 6 months later you don't have to spend ages figuring out how to make your object fit the container: you just implement the Interface and you know it will work.  This is also especially useful when working on collaborative projects.  Colleagues just implement an interface, write any required methods and it should just work... Libraries,  Tool Development - New library: touchatag RFID readers on Processing num_1269777690.html#6 Processing Discourse/Libraries,  Tool Development num_1269777690.html#6 Fri, 18 Jun 2010 04:34:14 +0000 UndeadIwag, are you running the library in Windows? Do you get that error in the example provided? General Discussion,  Status - Moved: 'worm hole' num_1276597266.html#0 Processing Discourse/General Discussion,  Status num_1276597266.html#0 Fri, 18 Jun 2010 02:53:23 +0000 <b>This Topic has been moved to </b><a href="num_1276597267.html#0"><i><b>Programs</b></i></a><b> by <i>REAS</i></b>