<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Simple rotation problem</title>
	<atom:link href="http://www.lostinactionscript.com/blog/index.php/2008/10/20/simple-rotation-problem/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lostinactionscript.com/blog/index.php/2008/10/20/simple-rotation-problem/</link>
	<description>Lost In Actionscript</description>
	<lastBuildDate>Wed, 08 Sep 2010 12:01:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Shane McCartney</title>
		<link>http://www.lostinactionscript.com/blog/index.php/2008/10/20/simple-rotation-problem/comment-page-1/#comment-1104</link>
		<dc:creator>Shane McCartney</dc:creator>
		<pubDate>Mon, 20 Oct 2008 00:16:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.lostinactionscript.com/blog/?p=82#comment-1104</guid>
		<description>Sorry and thanks for spotting that Adam I shouldn&#039;t of been so lazy in assumption that the algorithm receives a normalized angle. I have updated the above to include a normalize algorithim also. Here is my equivalent 
&lt;code&gt;cA = (Math.abs(cA)&gt;Math.PI*2) ? (cA&lt;0) ? cA%Math.PI*2+ Math.PI*2 : cA%Math.PI*2 : cA;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Sorry and thanks for spotting that Adam I shouldn&#8217;t of been so lazy in assumption that the algorithm receives a normalized angle. I have updated the above to include a normalize algorithim also. Here is my equivalent<br />
<code>cA = (Math.abs(cA)>Math.PI*2) ? (cA&lt;0) ? cA%Math.PI*2+ Math.PI*2 : cA%Math.PI*2 : cA;</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://www.lostinactionscript.com/blog/index.php/2008/10/20/simple-rotation-problem/comment-page-1/#comment-1102</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Sun, 19 Oct 2008 23:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.lostinactionscript.com/blog/?p=82#comment-1102</guid>
		<description>Hi Shane,

Not sure if it&#039;s just a bug in your example, but if you get the blue arrow to follow the green arrow clockwise for two revolutions, you&#039;ll see the blue arrow spin back in the opposite direction.

I had to tackle this same issue recently and came up with the following code.

Not so efficient, but it works.

&lt;code&gt;
public static function normalizeRotation(rotation:Number):Number {
	rotation = rotation % 360;
	if (rotation  180) {
		diff -= 360;
	} else if (diff &lt; -180){
		diff += 360;
	}

	return relativeTo + diff;
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hi Shane,</p>
<p>Not sure if it&#8217;s just a bug in your example, but if you get the blue arrow to follow the green arrow clockwise for two revolutions, you&#8217;ll see the blue arrow spin back in the opposite direction.</p>
<p>I had to tackle this same issue recently and came up with the following code.</p>
<p>Not so efficient, but it works.</p>
<p><code><br />
public static function normalizeRotation(rotation:Number):Number {<br />
	rotation = rotation % 360;<br />
	if (rotation  180) {<br />
		diff -= 360;<br />
	} else if (diff &lt; -180){<br />
		diff += 360;<br />
	}</p>
<p>	return relativeTo + diff;<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
