<?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; physics</title>
	<atom:link href="http://blog.touchmypixel.com/tag/physics/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.touchmypixel.com</link>
	<description>Games + Web : Interaction Matters</description>
	<lastBuildDate>Thu, 22 Jul 2010 04:18:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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 one [...]]]></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>
<script type="text/javascript">
var flattr_wp_ver = '0.71';
var flattr_uid = 'tarwin';
var flattr_cat = 'text';
var flattr_tle = 'Making Convex Polygons from Concave Ones: Ear Clipping';
var flattr_dsc = 'We\'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 ... (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 one shape (or polygon) in each of their rigid bodies. This gives us the change to fake concave shapes by making multiple convex ones. But how do we convert from concave to convex?  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 (http://www.cs.ubc.ca/spider/snoeyink/demos/convdecomp/MCDDemo.html) which was awesome, and in Java none the less. But alas, even with the help of this awesome Java to AS3 converter, I failed at getting it to work.  Then I stumbled upon a great post on the Box2D forums \"Concave Polygon Decomposition in Flash\". Someone had converted an Ear Clipping example in P';
var flattr_tag = 'AS3,concave,convex,physics,polygons';
var flattr_url = 'http://blog.touchmypixel.com/2008/06/making-convex-polygons-from-concave-ones-ear-clipping/';
var flattr_lng = 'en_GB';
</script><script src="http://api.flattr.com/button/load.js" type="text/javascript"></script> <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://api.flattr.com/button/button-static-50x60.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>5</slash:comments>
		</item>
	</channel>
</rss>
