<?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>Shang Liang &#187; Maths&amp;Physics</title>
	<atom:link href="http://shang-liang.com/blog/category/mathsphysics/feed/" rel="self" type="application/rss+xml" />
	<link>http://shang-liang.com/blog</link>
	<description>Life in a Flash</description>
	<lastBuildDate>Fri, 03 Sep 2010 05:32:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Box2D Tutorial</title>
		<link>http://shang-liang.com/blog/box2d-tutorial/</link>
		<comments>http://shang-liang.com/blog/box2d-tutorial/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 03:41:05 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Experimental]]></category>
		<category><![CDATA[Maths&Physics]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=191</guid>
		<description><![CDATA[I gave a mini tutorial on Box2D during A-SFUG meeting. You can download it here. Have fun!]]></description>
			<content:encoded><![CDATA[<p>I gave a mini tutorial on Box2D during <a title="another singapore flash user group" href="http://www.a-sfug.com">A-SFUG</a> meeting. You can <a href="http://www.a-sfug.com/wp-content/uploads/2009/11/box2d.zip">download it here</a>. Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/box2d-tutorial/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Box2D data visualization</title>
		<link>http://shang-liang.com/blog/box2d-data-visualization/</link>
		<comments>http://shang-liang.com/blog/box2d-data-visualization/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 06:11:40 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Experimental]]></category>
		<category><![CDATA[Maths&Physics]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=184</guid>
		<description><![CDATA[Data visualization for join the pact campaign. Click to view.]]></description>
			<content:encoded><![CDATA[<p>Data visualization for join the pact campaign. Click to view.</p>
<p><a href="http://staging.jointhepact.com/presentation"><img class="alignnone size-full wp-image-187" title="data_visualization_box2d" src="http://shang-liang.com/blog/wp-content/uploads/2009/10/data_visualization_box2d.jpg" alt="data_visualization_box2d" width="592" height="338" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/box2d-data-visualization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with Box2D</title>
		<link>http://shang-liang.com/blog/fun-with-box2d/</link>
		<comments>http://shang-liang.com/blog/fun-with-box2d/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 06:47:24 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Experimental]]></category>
		<category><![CDATA[Maths&Physics]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=179</guid>
		<description><![CDATA[Messing around with Box2D. Quite fun.]]></description>
			<content:encoded><![CDATA[<p>Messing around with Box2D. Quite fun.</p>
<p><a href="http://shang-liang.com/collaboration/shang/box2d/"><img class="alignnone size-full wp-image-180" title="box2d" src="http://shang-liang.com/blog/wp-content/uploads/2009/10/box2d.jpg" alt="box2d" width="400" height="223" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/fun-with-box2d/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rhythm Surfer: Xtreme! An AIR Game (sort of)</title>
		<link>http://shang-liang.com/blog/rhythm-surfer-xtreme-an-air-game-sort-of/</link>
		<comments>http://shang-liang.com/blog/rhythm-surfer-xtreme-an-air-game-sort-of/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 04:53:40 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Experimental]]></category>
		<category><![CDATA[Maths&Physics]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=74</guid>
		<description><![CDATA[This is my entry for Code::XtremeApps::2008. It was a 24 hours coding competition. Sadly, my entry didn&#8217;t even get pass the preliminary round. As usual, I conclude the judges didn&#8217;t know what they were doing and they are not good enough to judge my idea. Download Here!]]></description>
			<content:encoded><![CDATA[<p>This is my entry for <a title="code xtreme 2008" href="http://www.itsc.org.sg/prevEvent.do?eventKey=15" target="_self">Code::XtremeApps::2008</a>. It was a 24 hours coding competition. Sadly, my entry didn&#8217;t even get pass the preliminary round. As usual, I conclude the judges didn&#8217;t know what they were doing and they are not good enough to judge my idea.</p>
<p><a title="rhythm surfer xtreme air application" href="http://hellovalerie.com/portfolio/wp-content/uploads/2008/07/rhythm_surfer/index.html" target="_self">Download Here!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/rhythm-surfer-xtreme-an-air-game-sort-of/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using molecular mechanics in Flash</title>
		<link>http://shang-liang.com/blog/using-molecular-mechanics-in-flash/</link>
		<comments>http://shang-liang.com/blog/using-molecular-mechanics-in-flash/#comments</comments>
		<pubDate>Tue, 15 May 2007 07:19:04 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Maths&Physics]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/uncategorized/using-molecular-mechanics-in-flash/</guid>
		<description><![CDATA[In actionscript.org george.sch posted a question about the effect used in coke5 site. The leaves get pushed away when mouse goes near to them and come back when mouse moves away. The behavior reminds a lot what I learned in school last time. Molecules attract and repel each other at the same time. The attraction [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.actionscript.org">actionscript.org</a> george.sch posted a question about the effect used in <a href="http://www.them5.com/framework/index.html">coke5 site</a>. The leaves get pushed away when mouse goes near to them and come back when mouse moves away.<br />
<span id="more-26"></span><br />
The behavior reminds a lot what I learned in school last time. Molecules attract and repel each other at the same time. The attraction and repulsion becomes stronger when the distance decreases and the forces weaken when the distance increases. However, the rate of increase and decrease for repulsion is much greater than the attraction. So, when two molecules are close to each other, both the attraction and repulsion are strong but repulsion is stronger than the attraction. As a result, the system shows that the molecules repel each other. When the two molecules are far apart from each other, both the repulsion and attraction are weak but the attraction is stronger than repulsion, so the system shows that the molecules attract each other. If the two molecules are too far way from each other, both attraction and repulsion are very weak and the system shows no interaction.</p>
<p>The real equation can be found <a href="http://cmm.cit.nih.gov/modeling/guide_documents/molecular_mechanics_document.html">at this website</a> in the non-bonded energy part. And there&#8217;s some interesting information <a href="http://www.smeter.net/daily-facts/6/fact1.php">at this page</a></p>
<p>To implement in Flash, the calculation for attraction force is modified. It&#8217;s a simple easing equation, of the molecule has a tendency to go back to it&#8217;s original position. And here&#8217;s the example in AS3.0. The source is <a href="http://www.shang-liang.com/blog/attachment/liquid_balls.zip">&gt;&gt;here&lt;&lt;</a> (both AS2.0 and AS3.0).<br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9" height="360" width="640"></object><param name="movie" value="http://www.shang-liang.com/blog/attachment/liquid_balls_as3.swf"></param><param name="quality" value="high"></param>   <embed src="http://www.shang-liang.com/blog/attachment/liquid_balls_as3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="360" width="640"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/using-molecular-mechanics-in-flash/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Shoot down a moving object</title>
		<link>http://shang-liang.com/blog/shoot-down-a-moving-object/</link>
		<comments>http://shang-liang.com/blog/shoot-down-a-moving-object/#comments</comments>
		<pubDate>Mon, 04 Dec 2006 20:39:19 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Maths&Physics]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/uncategorized/shoot-down-a-moving-object/</guid>
		<description><![CDATA[This is to respond to a forum post at http://actionscript.org/forums/showthread.php3?t=123006 posted by TOdorus. Quite good excerise for me. If my math teachers used Flash to teach me I think I wouldn&#8217;t hate them so much. Click at the canon to shoot down the ship. It assumes the ship goes in straight line. If the ship [...]]]></description>
			<content:encoded><![CDATA[<p>This is to respond to a forum post at http://actionscript.org/forums/showthread.php3?t=123006 posted by TOdorus. Quite good excerise for me. If my math teachers used Flash to teach me I think I wouldn&#8217;t hate them so much.<span id="more-17"></span></p>
<p>Click at the canon to shoot down the ship. It assumes the ship goes in straight line. If the ship turns back the bullet will miss it. I think it&#8217;s possible to expand the equation to handle all different movement, non-linear ones, as long as the ship moves according to a kown equation.</p>
<p>Read on to check the equations. <a href="http://www.shang-liang.com/blog/wp-content/uploads/2006/12/bullet_angle.zip" id="p67">&gt;&gt;source&lt;&lt;</a></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" align="middle" height="400" width="500"></object><param name="allowScriptAccess" value="sameDomain"></param><param name="movie" value="http://www.shang-liang.com/blog/attachment/canon.swf"></param><param name="quality" value="high"></param><param name="bgcolor" value="#FFFFFF"></param>       <embed src="http://www.shang-liang.com/blog/attachment/canon.swf" quality="high" bgcolor="#FFFFFF" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" height="400" width="500"></embed><!--more--><br />
<img src="http://www.shang-liang.com/blog/attachment/equations.gif" id="image68" alt="cannon shoot ship moving object flash game maths equations" /></p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/shoot-down-a-moving-object/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Interesting Math Problem</title>
		<link>http://shang-liang.com/blog/interesting-math-problem/</link>
		<comments>http://shang-liang.com/blog/interesting-math-problem/#comments</comments>
		<pubDate>Mon, 06 Nov 2006 07:09:54 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Maths&Physics]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/uncategorized/interesting-math-problem/</guid>
		<description><![CDATA[There are n dots, p red ones and q blue ones. The target is to link up the red ones without having cross overs, e.g. To produces this, To solve this problem. I consider all the red dots lie originally on a perfect circle and this irregular pattern is produced by moving the dots further [...]]]></description>
			<content:encoded><![CDATA[<p>There are n dots, p red ones and q blue ones. The target is to link up the red ones without having cross overs, e.g.<br />
<img src="http://www.shang-liang.com/blog/attachment/crossovers.jpg" alt="crossovers" /><br />
To produces this,<br />
<img src="http://www.shang-liang.com/blog/attachment/nocrossovers.jpg" id="image56" alt="nocrossovers" /><br />
<span id="more-15"></span><br />
To solve this problem. I consider all the red dots lie originally on a perfect circle and this irregular pattern is produced by moving the dots further or closer to the center of the circle. So, I first calculated the center point of all dots, centerX=(x1+x2+&#8230;+xn)/n, centerY=(y1+y2+&#8230;+yn)/n. Using a center point, I calculate the angle of a dot as angle1=Math.atan2(y1-centerY, x1-centerX). All the dots are sorted by their angles and linked clockwise  or counterclockwise.<br />
Not something difficult but quite interesting <img src='http://shang-liang.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/interesting-math-problem/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
