<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Visual InformationProgramming | Visual Information</title>
	<atom:link href="http://www.visualinformation.org/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.visualinformation.org</link>
	<description>Visualising information</description>
	<lastBuildDate>Fri, 25 Nov 2011 08:23:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Prototyping for iPhone</title>
		<link>http://www.visualinformation.org/2011/09/06/prototyping-for-iphone/</link>
		<comments>http://www.visualinformation.org/2011/09/06/prototyping-for-iphone/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 08:34:00 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[iOS (xcode]]></category>
		<category><![CDATA[iPhone & iPad)]]></category>
		<category><![CDATA[ProcessingJS]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.visualinformation.org/?p=378</guid>
		<description><![CDATA[I had the opportunity to make an interactive sketch for a project on the iPhone the other day. I was pressed for time and really wanted the project. So I decided to take a closer look at tools for rapid prototyping for iPhone/iPad. I have some limited knowledge from the past in making native apps in Xcode, using Objective-C and all the interface builders wonderful capabilities. But being pressed for time and mostly just wanting to show the concept I looked at Gamesalad, Processingjs, openFrameworks &#38; Cinder++ (I picked those based on my own capabilities out of very many options out there). - Gamesalad &#8211; a tool reminding me of how Macromedia Director once was. Easy to work with, powerful with scripting but way too long time and complicated process of getting the app to the client. Very nice features though. - Processingjs &#8211; I know Processing quite well at this time so this was an obvious way to go since the html5 works fine under iPhone and iPad. The Processingjs team has made wonders and it was very smooth to get it up and running with the pre-release of Processing0199. The different modes in Processing &#8211; &#8220;standard&#8221;, &#8220;javascript&#8221; and [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-379" title="collage" src="http://www.visualinformation.org/wp-content/uploads/2011/09/collage.jpg" alt="" width="900" height="400" /></p>
<p>I had the opportunity to make an interactive sketch for a project on the iPhone the other day. I was pressed for time and really wanted the project. So I decided to take a closer look at tools for rapid prototyping for iPhone/iPad.</p>
<p>I have some limited knowledge from the past in making native apps in Xcode, using Objective-C and all the interface builders wonderful capabilities. But being pressed for time and mostly just wanting to show the concept I looked at Gamesalad, Processingjs, openFrameworks &amp; Cinder++ (I picked those based on my own capabilities out of very many options out there).</p>
<p>- <a href="http://gamesalad.com/" target="_blank">Gamesalad</a> &#8211; a tool reminding me of how Macromedia Director once was. Easy to work with, powerful with scripting but way too long time and complicated process of getting the app to the client. Very nice features though.</p>
<p>- <a href="http://processingjs.org/" target="_blank">Processingjs</a> &#8211; I know Processing quite well at this time so this was an obvious way to go since the html5 works fine under iPhone and iPad. The Processingjs team has made wonders and it was very smooth to get it up and running with the pre-release of Processing0199. The different modes in Processing &#8211; &#8220;standard&#8221;, &#8220;javascript&#8221; and &#8220;android&#8221; is wonderful. (Learn more about the upcoming Processing 2.0 from <a href="http://vimeo.com/28117873" target="_blank">the talk Fry &amp; Reas held at Eyeo</a>). I know Processing, have done a couple of things in processingjs and the clock was ticking. So I simply gave up on openFrameworks and Cinder++ since they were totally new to me.</p>
<p>So I went with processingjs. The sketch was quite fast assembled and it looked and behaved the way I wanted. The js_applet was however somewhat not so perfect on the iPhone since you have to adjust the screen manually if you don&#8217;t get the fullscreen option to work, which I didn&#8217;t at that time. The iPad became the perfect viewer though. And the computer screen in an modern browser was also ok. It looks a bit weird on the computer screen since the size is all blown up.</p>
<p>So the client got the sketch. In time. <strong>Excellent</strong>.</p>
<p>Then one night I couldn&#8217;t forget all those <a href="http://www.creativeapplications.net/" target="_blank">wonderful apps out there</a> created with <a href="http://libcinder.org/" target="_blank">Cinder++</a> &amp; <a href="http://www.openframeworks.cc/" target="_blank">openFrameworks</a>. Both makes apps for iOS. And both are c++ libraries that you can use under Xcode on the mac (and windows with other IDEs of course). And they are &#8220;creative coding&#8221; which means that normal designers can handle them with minor difficulties. I downloaded both and started trying out Cinder++. I gave up after realizing how little I had done given the time I had spent and how c++ is NOT for me. The next evening I thought I&#8217;d give openFrameworks a quick look. I got hooked very fast. The syntax and structure of the files reminded so much of Processing that I made a port of my simple processingjs sketch in openFrameworks in really no time. It is not as intimidating as the c++ indicates.</p>
<p>So to conclude this I can finally say that Cinder++ is too hardcore for me. The front page of their site is so hard to resist and really inspiring. openFrameworks is really the way to run if the app should run on iOS or MacOSX given my Processing knowledge. For HTML5 and javascript sketches to be run on iPhone or other mobile devices or the web in general, processingjs is an obvious choice. Processing in general is absolutely fantastic with all the libraries and <a href="http://toxiclibs.org/" target="_blank">toxiclibs</a> as the lead. <a href="http://haptic-data.com/toxiclibsjs/" target="_blank">Toxis libraries are available as javascript</a> to some extent as well. So the limits to create are once more gone.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2011/09/06/prototyping-for-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processing JS &#8211; 1.0 arrived &#8211; including 3D</title>
		<link>http://www.visualinformation.org/2010/11/21/processing-js-1-0-arrived-including-3d/</link>
		<comments>http://www.visualinformation.org/2010/11/21/processing-js-1-0-arrived-including-3d/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 22:42:28 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[ProcessingJS]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Visualisation]]></category>

		<guid isPermaLink="false">http://www.visualinformation.org/?p=289</guid>
		<description><![CDATA[I thought I would post my progress on graphs during the summer but things took another direction. At least I got a picture for it. I will write more about that and marrying Jung with Processing later. Picture is NOT ProcessingJS. It sure could have though. Because tonight I was amazed to see that ProcessingJS came to 1.0. Including the 3D! I cannot express what this means. 13 years ago I bought this book &#8220;Teach yourself VRML2.0 in 21 days&#8221;. I thought I would rock in three weeks time, but it never happened. The browser plug-ins that rose, crashed and burned finally killed my interest in 3d on the web. Tonight I start to wonder if the dream is about to wake again. By using Javascript, HTML5 the people at ProcessingJS got something amazing going. WebGl is needed however, but this is included in all the major browsers coming releases. So not to worry about that. I look forward to experiment something real out of this as soon as time will let me. Importing 3d models is not really going to happen anytime soon unless someone writes a cool thingy soon. So back to handwriting the models again and using [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visualinformation.org/wp-content/uploads/2010/11/Screen-shot-2010-08-15-at-20.02.041.png"><img class="alignnone size-full wp-image-296" title="Screen-shot-2010-08-15-at-20.02.04" src="http://www.visualinformation.org/wp-content/uploads/2010/11/Screen-shot-2010-08-15-at-20.02.041.png" alt="" width="1260" height="709" /></a></p>
<p>I thought I would post my progress on graphs during the summer but things took another direction. At least I got a picture for it. I will write more about that and marrying Jung with Processing later. Picture is NOT ProcessingJS. It sure could have though.</p>
<p>Because tonight I was amazed to see that <a href="http://processingjs.org/" target="_blank">ProcessingJS</a> came to 1.0. Including the 3D! I cannot express what this means.</p>
<p>13 years ago I bought this book &#8220;Teach yourself VRML2.0 in 21 days&#8221;. I thought I would rock in three weeks time, but it never happened. The browser plug-ins that rose, crashed and burned finally killed my interest in 3d on the web. Tonight I start to wonder if the dream is about to wake again. By using Javascript, HTML5 the people at ProcessingJS got something amazing going. WebGl is needed however, but this is included in all the major browsers coming releases. So not to worry about that. I look forward to experiment something real out of this as soon as time will let me. Importing 3d models is not really going to happen anytime soon unless someone writes a cool thingy soon. So back to handwriting the models again and using generated basic models in the meantime.</p>
<p>Amazing times we live in.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2010/11/21/processing-js-1-0-arrived-including-3d/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>An App</title>
		<link>http://www.visualinformation.org/2010/06/28/an-app/</link>
		<comments>http://www.visualinformation.org/2010/06/28/an-app/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 20:44:22 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Thoughts and ideas]]></category>

		<guid isPermaLink="false">http://www.visualinformation.org/?p=257</guid>
		<description><![CDATA[I did this app (Todo Important &#38; Urgent) a year ago for the iPhone. Trying to wrap my head around Objective-C was quite fun. Different way of thinking, but nice to deal with in general even if it got kind of messy at the end when it came to releasing it with provisioning etc. Gah. I realised quite quickly that I would not be doing Processing kind of things in Objective-C. So trying to make a simple kind of app and give it a twist was the choice for me. I think it worked even if the time spent making it hardly makes up for the result (or the money). Still, its visual and shows todo-items in a different way. And of course, it costs lowest-tier. Why else would I even try it out when I got Processing.  And then I found iProcessing. Not Objective-C but a great feeling to see Processing code in Xcode]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visualinformation.org/wp-content/uploads/2010/06/todo-imagery.001.jpg"><img class="alignnone size-full wp-image-258" title="todo-imagery.001" src="http://www.visualinformation.org/wp-content/uploads/2010/06/todo-imagery.001.jpg" alt="" width="807" height="588" /></a></p>
<p>I did this app (<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=321403770&amp;mt=8&amp;ign-mpt=uo%3D6%2522%253E%253Cimg%2520height%253D%252215%2522%2520width%253D%252261%2522%2520alt%253D%2522Todo%2520-%2520Important%2520and%2520Urgent%2522">Todo Important &amp; Urgent</a>) a year ago for the iPhone. Trying to wrap my head around Objective-C was quite fun. Different way of thinking, but nice to deal with in general even if it got kind of messy at the end when it came to releasing it with provisioning etc. Gah. I realised quite quickly that I would not be doing Processing kind of things in Objective-C. So trying to make a simple kind of app and give it a twist was the choice for me. I think it worked even if the time spent making it hardly makes up for the result (or the money). Still, its visual and shows todo-items in a different way. And of course, it costs lowest-tier. Why else would I even try it out when I got Processing.  And then I found <a href="http://luckybite.com/iprocessing/">iProcessing</a>. Not Objective-C but a great feeling to see Processing code in Xcode <img src='http://www.visualinformation.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2010/06/28/an-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transparent application window in Processing</title>
		<link>http://www.visualinformation.org/2009/09/25/transparent-application-window-in-processing/</link>
		<comments>http://www.visualinformation.org/2009/09/25/transparent-application-window-in-processing/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 06:31:47 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.visualinformation.org/?p=211</guid>
		<description><![CDATA[The transparent window or shaped window was supposedly not easy to do. I found that by tweaking in the awt of Java it worked kind of as I would like it to do. On Windows XP. NOT on MacOSX. Also the shaped window which is demonstrated here. If labbed with some more you should find that you could do pretty much all you want to do, by tweaking the shaped window or tweaking the setOpaque or setOpacity which is two different things. Depending on what you want to do and depending on platform. Note! This code does not work on MacOSX. Due to different Java implementations I guess. AND it&#8217;s hackish. No exception handling and there is alot of stuff that can go wrong I guess. UPDATE! December 10 209, the java implementation was updated on MacOSX 10.6, to the current version available on windows. Nice and all, but the problem persists. Hmm. AWT? Workaround on the mac? Read more on the subject right here: http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/#&#8230; http://java.sun.com/docs/books/tutorial/uiswing/misc/trans_shaped_windows.html Heres the code I got working on Windows XP: import com.sun.awt.AWTUtilities; import  java.awt.GraphicsDevice.*; // PC only import java.awt.Shape; import java.awt.geom.*; import javax.swing.*; public void init(){ // to make a frame not displayable, you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visualinformation.org/wp-content/uploads/2009/09/windowProcessing1.jpg"><img class="alignnone size-full wp-image-216" title="windowProcessing" src="http://www.visualinformation.org/wp-content/uploads/2009/09/windowProcessing1.jpg" alt="windowProcessing" width="695" height="463" /></a></p>
<p>The transparent window or shaped window was supposedly not easy to do. I found that by tweaking in the awt of Java it worked kind of as I would like it to do. On Windows XP. NOT on MacOSX. Also the shaped window which is demonstrated here. If labbed with some more you should find that you could do pretty much all you want to do, by tweaking the shaped window or tweaking the setOpaque or setOpacity which is two different things. Depending on what you want to do and depending on platform.</p>
<p>Note! This code does not work on MacOSX. Due to different Java implementations I guess. AND it&#8217;s hackish. No exception handling and there is alot of stuff that can go wrong I guess.</p>
<p>UPDATE! December 10 209, the java implementation was updated on MacOSX 10.6, to the current version available on windows. Nice and all, but the problem persists. Hmm. AWT? Workaround on the mac?</p>
<p>Read more on the subject right here:<br />
<a href="http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/#Enabling-Per-Pixel-Translucency" target="_blank">http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/#&#8230;</a></p>
<p><a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/trans_shaped_windows.html" target="_blank">http://java.sun.com/docs/books/tutorial/uiswing/misc/trans_shaped_windows.html</a></p>
<p>Heres the code I got working on Windows XP:<br />
<span style="font-family: Courier New;"><br />
import com.sun.awt.AWTUtilities;<br />
import  java.awt.GraphicsDevice.*; // PC only<br />
import java.awt.Shape;<br />
import java.awt.geom.*;<br />
import javax.swing.*;</span></p>
<p>public void init(){<br />
// to make a frame not displayable, you can<br />
// use frame.removeNotify()</p>
<p>frame.removeNotify();<br />
frame.setUndecorated(true);</p>
<p>// addNotify, here i am not sure if you have<br />
// to add notify again.<br />
//  frame.addNotify();<br />
// frame.removeNotify();<br />
super.init();<br />
}</p>
<p>void setup() {<br />
size(200, 200);<br />
noStroke();<br />
frame.setAlwaysOnTop(true); // Alltid på topp<br />
frame.setLocation(0,0);<br />
AWTUtilities.setWindowOpaque(frame, false);<br />
AWTUtilities.setWindowOpacity(frame, 0.9f);</p>
<p>Shape shape = null;<br />
//shape = new Ellipse2D.Float(0, 0, frame.getWidth(), frame.getHeight());<br />
//shape = new Ellipse2D.Float(0, 0, 200, 200);<br />
//  shape = new RoundRectangle2D.Float(0, 0, 200, 200, 20, 20);<br />
//shape = new Polygon(int[] xpoints, int[] ypoints, int npoints) ;<br />
int[] myXes = new int[4];<br />
myXes[0]=0;<br />
myXes[1]=150;<br />
myXes[2]=150;<br />
myXes[3]=0;<br />
int[] myYs = new int[4];<br />
myYs[0]=0;<br />
myYs[1]=20;<br />
myYs[2]=180;<br />
myYs[3]=0;<br />
shape = new Polygon(myXes, myYs, 4) ;<br />
AWTUtilities.setWindowShape(frame, shape);</p>
<p>}</p>
<p>void draw() {<br />
setBackground(new Color(0,0,0,255)); // should work with normal background(255) command<br />
//  frame.setVisible(true);</p>
<p>fill(255, 0, 0, 255); // the alpha is not in play at this point &#8211; but it come into play when doing per-pixel translucency<br />
rect(23, 23, 54, 54);<br />
}<br />
<a href="http://visualinformation.org/" target="_blank"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2009/09/25/transparent-application-window-in-processing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FOTB09?</title>
		<link>http://www.visualinformation.org/2009/09/23/fotb09/</link>
		<comments>http://www.visualinformation.org/2009/09/23/fotb09/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 21:10:15 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Graphic design]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Visualisation]]></category>

		<guid isPermaLink="false">http://www.visualinformation.org/?p=208</guid>
		<description><![CDATA[Yes, Flash on the Beach 2009, and no its not just Flash developers. It was problably awesome. Sheesh, why can&#8217;t people tell me about these kinds of events a little bit sooner]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flashonthebeach.com/" target="_blank"><img class="alignnone size-medium wp-image-209" title="fotb" src="http://www.visualinformation.org/wp-content/uploads/2009/09/fotb-300x80.gif" alt="fotb" width="300" height="80" /></a></p>
<p>Yes, <a href="http://www.flashonthebeach.com/" target="_blank">Flash on the Beach 2009</a>, and no its not just Flash developers. It was problably awesome. Sheesh, why can&#8217;t people tell me about these kinds of events a little bit sooner <img src='http://www.visualinformation.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2009/09/23/fotb09/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple picking in 3D</title>
		<link>http://www.visualinformation.org/2009/06/03/simple-picking-in-3d/</link>
		<comments>http://www.visualinformation.org/2009/06/03/simple-picking-in-3d/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 18:35:25 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.visualinformation.org/?p=175</guid>
		<description><![CDATA[Thought I&#8217;d post this little hack. I picked up the Terzidis book Algorithms for Visual Design (using Processing) and found a version of my own little 3D picking hack and thought that my hack might be ok. I never saw this as anything but a quick hack, but it has helped me alot, still does. I thought that it hopefully could help some people having difficulties solving the picking problem the &#8220;real&#8221; (and hard) way. It would have helped me. Heres the code: /** * Selecting_objects_3D &#8211; easy way * by Johan Wastring * * Quick and dirty way f picking in 3D if you have less * than 200 objects in a list. It&#8217;s not fancy, * but it works on small numbers of objects. * Run sketch and pick with mouse to change the color. * */ import processing.opengl.*; int numOfShapes = 5; Shape[] myShapes = new Shape[numOfShapes]; void setup() { noStroke (); size (400, 400, OPENGL); // create your shapes in a list for (int i = 0; i &#60; numOfShapes; i ++) { myShapes[i] = new Shape(i*20, 0, 0); } } void draw() { background(255); // Call theSelector before you draw your shapes theSelector(); // draw [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visualinformation.org/wp-content/uploads/2009/06/bild-3.png"><img class="alignnone size-full wp-image-178" title="bild-3" src="http://www.visualinformation.org/wp-content/uploads/2009/06/bild-3.png" alt="bild-3" width="649" height="421" /></a></p>
<p>Thought I&#8217;d post this little hack. I picked up the <a href="http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0470375485.html">Terzidis book Algorithms for Visual Design</a> (using Processing) and found a version of my own little 3D picking hack and thought that my hack might be ok. I never saw this as anything but a quick hack, but it has helped me alot, still does. I thought that it hopefully could help some people having difficulties solving the picking problem the &#8220;real&#8221; (and hard) way. It would have helped me.<br />
Heres the code:</p>
<address><span style="color: #000000;">/**</span></address>
<address><span style="color: #000000;">* Selecting_objects_3D &#8211; easy way</span></address>
<address><span style="color: #000000;">* by Johan Wastring</span></address>
<address><span style="color: #000000;">*</span></address>
<address><span style="color: #000000;">* Quick and dirty way f picking in 3D if you have less</span></address>
<address><span style="color: #000000;">* than 200 objects in a list. It&#8217;s not fancy,</span></address>
<address><span style="color: #000000;">* but it works on small numbers of objects.</span></address>
<address><span style="color: #000000;">* Run sketch and pick with mouse to change the color.</span></address>
<address><span style="color: #000000;">*</span></address>
<address><span style="color: #000000;">*/</span></address>
<address><span style="color: #000000;">import processing.opengl.*;</span></address>
<address><span style="color: #000000;">int numOfShapes = 5;</span></address>
<address><span style="color: #000000;">Shape[] myShapes = new Shape[numOfShapes];</span></address>
<address><span style="color: #000000;">void setup() {</span></address>
<address><span style="color: #000000;"> noStroke ();</span></address>
<address><span style="color: #000000;"> size (400, 400, OPENGL);</span></address>
<address><span style="color: #000000;"> // create your shapes in a list</span></address>
<address><span style="color: #000000;"> for (int i = 0; i &lt; numOfShapes; i ++) {</span></address>
<address><span style="color: #000000;"> myShapes[i] = new Shape(i*20, 0, 0);</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;">}</span></address>
<address><span style="color: #000000;">void draw() {</span></address>
<address><span style="color: #000000;"> background(255);</span></address>
<address><span style="color: #000000;"> // Call theSelector before you draw your shapes</span></address>
<address><span style="color: #000000;"> theSelector();</span></address>
<address><span style="color: #000000;"> // draw your shapes</span></address>
<address><span style="color: #000000;"> for (int i = 0; i &lt; numOfShapes; i ++) {</span></address>
<address><span style="color: #000000;"> myShapes[i].display();</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> // a Camera well placed after all above</span></address>
<address><span style="color: #000000;"> camera(</span></address>
<address><span style="color: #000000;"> 40, 0, -120,</span></address>
<address><span style="color: #000000;"> 40, 0, 0,</span></address>
<address><span style="color: #000000;"> 0, 1, 0 );</span></address>
<address><span style="color: #000000;">}</span></address>
<address><span style="color: #000000;">// the nice Selector</span></address>
<address><span style="color: #000000;">void theSelector() {</span></address>
<address><span style="color: #000000;"> // SELECTION BY MOUSE</span></address>
<address><span style="color: #000000;"> int tolerance = 10; // to make it easy to pick the shape</span></address>
<address><span style="color: #000000;"> for ( int i = 0; i &lt; numOfShapes; i ++) {</span></address>
<address><span style="color: #000000;"> // get objects screenX coords</span></address>
<address><span style="color: #000000;"> float checkX = myShapes[i].getScreenX();</span></address>
<address><span style="color: #000000;"> // if it matches the mouseX decently proceed to get Y</span></address>
<address><span style="color: #000000;"> if (checkX &gt;= (mouseX-tolerance) &amp;&amp; checkX &lt;= (mouseX+tolerance)) {</span></address>
<address><span style="color: #000000;"> boolean yes = true;</span></address>
<address><span style="color: #000000;"> if (yes == true) {</span></address>
<address><span style="color: #000000;"> // get the Y one</span></address>
<address><span style="color: #000000;"> float checkY = myShapes[i].getScreenY();</span></address>
<address><span style="color: #000000;"> // if that one matches decently with the mouseY do something with that shape</span></address>
<address><span style="color: #000000;"> if (checkY &gt;= (mouseY-tolerance) &amp;&amp; checkY &lt;= (mouseY+tolerance)) {</span></address>
<address><span style="color: #000000;"> // make new cursor indicating selection is possible</span></address>
<address><span style="color: #000000;"> cursor(MOVE);</span></address>
<address><span style="color: #000000;"> if (mousePressed == true &amp;&amp; mouseButton == LEFT) {</span></address>
<address><span style="color: #000000;"> // here the action happens if it gets this far</span></address>
<address><span style="color: #000000;"> myShapes[i].setSelected(i);</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;">}</span></address>
<address><span style="color: #000000;">class Shape {</span></address>
<address><span style="color: #000000;"> float x, y, z;</span></address>
<address><span style="color: #000000;"> boolean isSelected = false;</span></address>
<address><span style="color: #000000;"> Shape(float inX, float inY, float inZ) {</span></address>
<address><span style="color: #000000;"> x = inX;</span></address>
<address><span style="color: #000000;"> y = inY;</span></address>
<address><span style="color: #000000;"> z = inZ;</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> void display(){</span></address>
<address><span style="color: #000000;"> pushMatrix();</span></address>
<address><span style="color: #000000;"> translate(x, y, z);</span></address>
<address><span style="color: #000000;"> rotateX(HALF_PI/2);</span></address>
<address><span style="color: #000000;"> stroke(255);</span></address>
<address><span style="color: #000000;"> if (isSelected == true) {</span></address>
<address><span style="color: #000000;"> fill(255, 0, 0);</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> else {</span></address>
<address><span style="color: #000000;"> fill(0, 0, 255);</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> box(10);</span></address>
<address><span style="color: #000000;"> popMatrix();</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> void setSelected(int i) {</span></address>
<address><span style="color: #000000;"> this.isSelected = true;</span></address>
<address><span style="color: #000000;"> println(&#8220;Got it &#8221; + i);</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> float getScreenX() {</span></address>
<address><span style="color: #000000;"> float f = screenX(x, y, z);</span></address>
<address><span style="color: #000000;"> return f;</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;"> float getScreenY() {</span></address>
<address><span style="color: #000000;"> float f = screenY(x, y, z);</span></address>
<address><span style="color: #000000;"> return f;</span></address>
<address><span style="color: #000000;"> }</span></address>
<address><span style="color: #000000;">}</span></address>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2009/06/03/simple-picking-in-3d/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Move from Processing to Eclipse</title>
		<link>http://www.visualinformation.org/2009/05/01/move-from-processing-to-eclipse/</link>
		<comments>http://www.visualinformation.org/2009/05/01/move-from-processing-to-eclipse/#comments</comments>
		<pubDate>Fri, 01 May 2009 21:58:41 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://visualjohan.wordpress.com/?p=35</guid>
		<description><![CDATA[Originally posted December 5 2008 Today I moved from the Processing IDE to Eclipse as an environment for the 3D demo development. Hopefully this will mean a bit leaner development with better support from the IDE. There should be no apparent difference for the user. I do this primarily because the processing IDE is nice for small sketches, but becomes cumbersome when the classes grow in numbers. But another important reason is that since I don’t see any real start for the ”real” java-demo in the Evolver-project I might as well take the demo seriously.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visualinformation.org/wp-content/uploads/2009/05/bild-3.png"><img class="alignnone size-full wp-image-147" title="bild-3" src="http://www.visualinformation.org/wp-content/uploads/2009/05/bild-3.png" alt="bild-3" width="803" height="277" /></a></p>
<p><em>Originally posted December 5 2008</em></p>
<p>Today I moved from the Processing IDE to Eclipse as an environment for the 3D demo development. Hopefully this will mean a bit leaner development with better support from the IDE. There should be no apparent difference for the user.<br />
I do this primarily because the processing IDE is nice for small sketches, but becomes cumbersome when the classes grow in numbers. But another important reason is that since I don’t see any real start for the ”real” java-demo in the Evolver-project I might as well take the demo seriously.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2009/05/01/move-from-processing-to-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Superpoint library</title>
		<link>http://www.visualinformation.org/2009/05/01/superpoint-library/</link>
		<comments>http://www.visualinformation.org/2009/05/01/superpoint-library/#comments</comments>
		<pubDate>Fri, 01 May 2009 21:13:27 +0000</pubDate>
		<dc:creator>JohanW</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://visualjohan.wordpress.com/?p=12</guid>
		<description><![CDATA[Very cool library for processing. http://www.hardcorepawn.com/SuperPoint/]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visualinformation.org/wp-content/uploads/2009/05/bild-9.png"><img class="alignnone size-full wp-image-165" title="bild-9" src="http://www.visualinformation.org/wp-content/uploads/2009/05/bild-9.png" alt="bild-9" width="758" height="453" /></a></p>
<p>Very cool library for processing.<br />
<a href="http://www.hardcorepawn.com/SuperPoint/">http://www.hardcorepawn.com/SuperPoint/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualinformation.org/2009/05/01/superpoint-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

