<?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>Acumen Development &#187; affine transformations</title>
	<atom:link href="http://www.acumendevelopment.net/tag/affine-transformations/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.acumendevelopment.net</link>
	<description>Software to inspire.</description>
	<lastBuildDate>Wed, 02 Jun 2010 16:39:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
		<item>
		<title>Affine Transformations in Actionscript</title>
		<link>http://www.acumendevelopment.net/affine-transformations-in-actionscript/</link>
		<comments>http://www.acumendevelopment.net/affine-transformations-in-actionscript/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 17:03:04 +0000</pubDate>
		<dc:creator>Paul Hayes</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[affine transformations]]></category>
		<category><![CDATA[matrices]]></category>

		<guid isPermaLink="false">http://www.acumendevelopment.net/?p=65</guid>
		<description><![CDATA[Rotations and reflections are easy enough with the Actionscript 3 Matrix class as long as you want a reflection whose mirror line passes through the origin, or a rotation about the origin.
However I recently was stumped with producing transformation matrices that included rotations about any point and reflection along any line. As there was little [...]]]></description>
			<content:encoded><![CDATA[<p>Rotations and reflections are easy enough with the Actionscript 3 Matrix class as long as you want a reflection whose mirror line passes through the origin, or a rotation about the origin.</p>
<p>However I recently was stumped with producing transformation matrices that included rotations about any point and reflection along any line. As there was little example code out there for this, I&#8217;ve decided to publish the two methods I&#8217;ve written to perform this. Both methods take the Matrix to set the transformation to as the first argument.</p>
<pre class="brush: java;">
/**
* Constructs an affine rotation matrix.
*
* @param m The matrix to set the affine rotation to.
* @param angle The angle of rotation in radian.
* @param ox center of rotation in the x axis
* @param oy center of rotation in the y axis
*
*/
private function rotation(m:Matrix,angle:Number=0,ox:Number=0,oy:Number=0):void
{
m.rotate(angle);
m.tx=ox-(m.a*ox)+(m.b*oy);
m.ty=oy+(m.c*ox)-(m.d*oy);
}

/**
* Constructs an affine reflection matrix. The line of reflection
* is defined by the last three parameters of the method.
* @param m Matrix The matrix to set the affine reflection to.
* @param angle Number The angle of rotation in radians.
* @param ox Number The reflection lines relative position from the origin.
* @param oy Number The reflection lines relative position from the origin.
*
*/
private function reflection(m:Matrix,angle:Number=0,ox:Number=0,oy:Number=0):void
{
m.a= Math.cos(2*angle);
m.b= Math.sin(2*angle);
m.c= Math.sin(2*angle);
m.d= -Math.cos(2*angle);

m.tx=ox-(m.a*ox)+(m.b*oy);
m.ty=oy+(m.c*ox)-(m.d*oy);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.acumendevelopment.net/affine-transformations-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using memcached

Served from: www.acumendevelopment.net @ 2010-09-08 22:23:35 -->