<?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>Touch My Pixel Blog &#187; polygons</title>
	<atom:link href="http://blog.touchmypixel.com/tag/polygons/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.touchmypixel.com</link>
	<description>Games + Web : Interaction Matters</description>
	<lastBuildDate>Wed, 28 Dec 2011 20:56:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Making Convex Polygons from Concave Ones: Ear Clipping</title>
		<link>http://blog.touchmypixel.com/2008/06/making-convex-polygons-from-concave-ones-ear-clipping/</link>
		<comments>http://blog.touchmypixel.com/2008/06/making-convex-polygons-from-concave-ones-ear-clipping/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 16:02:33 +0000</pubDate>
		<dc:creator>tarwin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[concave]]></category>
		<category><![CDATA[convex]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[polygons]]></category>

		<guid isPermaLink="false">http://blog.touchmypixel.com/?p=17</guid>
		<description><![CDATA[We&#8217;ve recently been playing around with a physics engines in Flash, including a little romance with Glaze, a slight flirting with PhysaXe and now seeming to settle for Box2D &#8230; (the dependable old dog) All these engines work only with convex polygons, and in no way support concave polygons. They do however support more than [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve recently been playing around with a physics engines in Flash, including a little romance with <a title="Glaze Phyics Engine" href="http://code.google.com/p/glaze/">Glaze</a>, a slight flirting with <a title="PhysaXe physics engine" href="http://code.google.com/p/physaxe/">PhysaXe</a> and now seeming to settle for Box2D &#8230; (the dependable old dog)</p>
<p>All these engines work only with <strong>convex</strong> polygons, and in no way support <strong>concave</strong> polygons. They do however support more than one shape (or polygon) in each of their <em>rigid bodies</em>. This gives us the change to fake concave shapes by making multiple convex ones. But how do we convert from concave to convex?</p>
<p>I did a bit of a search around and heard about such things as Ear Clipping and Minimum Convex Decomposition. The second I could even find code for (<a title="Minimum Convex Decomposition" href="http://www.cs.ubc.ca/spider/snoeyink/demos/convdecomp/MCDDemo.html">http://www.cs.ubc.ca/spider/snoeyink/demos/convdecomp/MCDDemo.html</a>) which was awesome, and in Java none the less. But alas, even with the help of this awesome <a href="http://osflash.org/projects/j2as3">Java to AS3 converter</a>, I failed at getting it to work.</p>
<p>Then I stumbled upon a <a href="http://www.box2d.org/forum/viewtopic.php?f=8&amp;t=463">great post </a>on the <a href="http://www.box2d.org/forum/">Box2D forums</a> &#8220;<a href="http://www.box2d.org/forum/viewtopic.php?f=8&amp;t=463">Concave Polygon Decomposition in Flash</a>&#8220;. Someone had converted an <a href="http://www.ewjordan.com/earClip/">Ear Clipping example in Processsing</a> to a <a href="http://www.box2d.org/forum/viewtopic.php?f=8&amp;t=463">JSFL tool</a>. Sweet!</p>
<p>So between the two example I managed to cobble together some not too shabby AS3 classes, and an example app. I&#8217;m hoping to add this to our Box2D wrapper (more on that later) so we can easily draw concave polygons ASAP.</p>
<div class="externalLinkBlock"><a title="Ear Clipping AS3 Example" href="http://www.touchmypixel.com/blog_examples/190608_ear_clipping/">example here ></a></div>
<div class="externalLinkBlock"><a title="Ear Clipping AS3 with Source" href="http://blog.touchmypixel.com/wp-content/uploads/2008/06/ear_clipping.zip">download with source ></a></div>
<p>Have fun!</p>
 <p><a href="http://blog.touchmypixel.com/?flattrss_redirect&amp;id=17&amp;md5=e8ac526593496a935bd439e764583216" title="Flattr" target="_blank"><img src="http://blog.touchmypixel.com/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.touchmypixel.com/2008/06/making-convex-polygons-from-concave-ones-ear-clipping/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

