<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with iterator() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=iterator%28%29</link>
      <pubDate>Sun, 08 Aug 2021 20:22:32 +0000</pubDate>
         <description>Tagged with iterator() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggediterator%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Combining two pieces of code</title>
      <link>https://forum.processing.org/two/discussion/23471/combining-two-pieces-of-code</link>
      <pubDate>Sun, 16 Jul 2017 22:10:31 +0000</pubDate>
      <dc:creator>daddydean</dc:creator>
      <guid isPermaLink="false">23471@/two/discussions</guid>
      <description><![CDATA[<p>Hey there,<br />
Im trying to combine an image segmentation code with another piece of code that takes the segments from the image segmentation and applies them to a different image.  I need some help to figure out how to automate the process.</p>

<p>SKETCH 1<br />
The image segmentation code is: <a href="https://pastebin.com/0sKxKJDF" target="_blank" rel="nofollow">https://pastebin.com/0sKxKJDF</a><br />
The two codes im running in processing are:<br />
<a href="https://pastebin.com/wd3Fk9Xn" target="_blank" rel="nofollow">https://pastebin.com/wd3Fk9Xn</a><br />
and <a href="https://github.com/GoToLoop/command/blob/patch-1/src/deadpixel/command/Command.java" target="_blank" rel="nofollow">https://github.com/GoToLoop/command/blob/patch-1/src/deadpixel/command/Command.java</a><br />
which looks like: <a href="http://imgur.com/a/ggPNb" target="_blank" rel="nofollow">http://imgur.com/a/ggPNb</a><br />
The image I am using currently is:  <a href="http://imgur.com/a/87ybb" target="_blank" rel="nofollow">http://imgur.com/a/87ybb</a><br />
Since the image segmentation code is written in Python, I needed to download the Python libraries Scipy, Numpy, Matplotlib and Scikit from <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/" target="_blank" rel="nofollow">http://www.lfd.uci.edu/~gohlke/pythonlibs/</a></p>

<p>SKETCH 2<br />
This is the code that I need to take the segments created and assign them to another image of my choice:<br />
<a href="https://pastebin.com/Cs4FfhTV" target="_blank" rel="nofollow">https://pastebin.com/Cs4FfhTV</a><br />
The idea I had was for all the segments that are created by sketch 1 to go into the data folder in sketch 2 and they would be assigned to my image.  Right now sketch 2 looks like:  <a href="http://imgur.com/a/UUSx3" target="_blank" rel="nofollow">http://imgur.com/a/UUSx3</a>  with the data folder being empty.<br />
The image I am currently using is:  <a href="http://imgur.com/a/3XYzJ" target="_blank" rel="nofollow">http://imgur.com/a/3XYzJ</a></p>

<p>I need to figure out some way to automate the image container process in sketch 2, so that it takes a certain amount of segments from sketch 1.<br />
I would like to move sketch 2 into sketch 1, so they just become one sketch file.</p>

<p>Right now If I manually take just the first three of the segments from sketch 1 and put them in the sketch 2 data folder I come up with this final product:  <a href="http://imgur.com/a/sIZuA" target="_blank" rel="nofollow">http://imgur.com/a/sIZuA</a><br />
Which doesnt quite look right because I haven't figured out how to scale back and overlap the segments either, and it appears to assign the segments to the white area of the image as well.</p>

<p>Any ideas?<br />
:3</p>
]]></description>
   </item>
   <item>
      <title>Making an array of closed curves ?</title>
      <link>https://forum.processing.org/two/discussion/15037/making-an-array-of-closed-curves</link>
      <pubDate>Sun, 21 Feb 2016 13:54:54 +0000</pubDate>
      <dc:creator>Denez</dc:creator>
      <guid isPermaLink="false">15037@/two/discussions</guid>
      <description><![CDATA[<p>With a combination of few lines of code I find on the internet, I tried to generate concentric closed curves (looking like irregular circles in the inside of a tree). Instead of drawing multiple curves, I only manage to draw one spiral closing at the end... How could I fix that ?</p>

<p>Here is the code :</p>

<pre><code>import java.util.Iterator;

ArrayList coords;
int num = 10; 
int rad = 10; 


void setup() {
  size(600, 400);
  coords = new ArrayList();
  smooth();

  for (int inter = 0; inter &lt; 300; inter+= 20) {
    for (float a=0; a&lt;=TWO_PI; a+=TWO_PI/num) {
      coords.add(new PVector(cos(a)*(rad + inter) *(noise(a/10)), sin(a)*(rad + inter)*(noise(a/10))));
    }
  }
}

void draw()
{
  background(255);
  strokeWeight(2);
  stroke(#8b8378);
  fill(#ffefdb);


  translate(width/2, height/2);

  beginShape();
  for (Iterator i = coords.iterator(); i.hasNext(); ) {
    PVector p = (PVector)i.next();
    curveVertex(p.x, p.y);
  }       
  for (int i=0; i&lt;3; i++) { 
    PVector p = (PVector)coords.get(i);
    curveVertex(p.x, p.y);
  }
  endShape(CLOSE);
}
</code></pre>

<p>Thanks !</p>
]]></description>
   </item>
   </channel>
</rss>