<?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: Developing a Casual Game with Siverlight 2 – Module 4</title>
	<atom:link href="http://joel.neubeck.net/2009/03/casual-game-m4-expression-newsletter/feed/" rel="self" type="application/rss+xml" />
	<link>http://joel.neubeck.net/2009/03/casual-game-m4-expression-newsletter/</link>
	<description>Simplifing structure without changing results</description>
	<lastBuildDate>Sun, 23 May 2010 01:08:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Mads Laumann</title>
		<link>http://joel.neubeck.net/2009/03/casual-game-m4-expression-newsletter/comment-page-1/#comment-781</link>
		<dc:creator>Mads Laumann</dc:creator>
		<pubDate>Wed, 01 Apr 2009 21:35:50 +0000</pubDate>
		<guid isPermaLink="false">http://joel.neubeck.net/?p=382#comment-781</guid>
		<description>Hi Joel

Thanks for some great articles! I&#039;m using them as inspiration for some prototyping I&#039;m doing at the moment for a new Silverlight game I want to create.

I just noticed a bug in your Vector class, it&#039;s the Normalize() that&#039;s buggy :)
Your code is:
public void Normalize()
        {
            _x /= Length;
            _y /= Length;
        }

The problem is that you are using the Length property, whici will calculate the lenght every time based on the x and y. This result in the Length being two different values for the _x / = Lenght and _y /= Length, which again, results in a wrong normalized Vector.

The easy fix I did for this is:
public void Normalize()
        {
            double tempLength = Length;
            _x /= tempLength;
            _y /= tempLength;
        }

Just wanted to share :)

//Mads Laumann</description>
		<content:encoded><![CDATA[<p>Hi Joel</p>
<p>Thanks for some great articles! I&#8217;m using them as inspiration for some prototyping I&#8217;m doing at the moment for a new Silverlight game I want to create.</p>
<p>I just noticed a bug in your Vector class, it&#8217;s the Normalize() that&#8217;s buggy :)<br />
Your code is:<br />
public void Normalize()<br />
        {<br />
            _x /= Length;<br />
            _y /= Length;<br />
        }</p>
<p>The problem is that you are using the Length property, whici will calculate the lenght every time based on the x and y. This result in the Length being two different values for the _x / = Lenght and _y /= Length, which again, results in a wrong normalized Vector.</p>
<p>The easy fix I did for this is:<br />
public void Normalize()<br />
        {<br />
            double tempLength = Length;<br />
            _x /= tempLength;<br />
            _y /= tempLength;<br />
        }</p>
<p>Just wanted to share :)</p>
<p>//Mads Laumann</p>
]]></content:encoded>
	</item>
</channel>
</rss>
