<?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>Roy Triesscheijn’s Weblog</title>
	<atom:link href="http://roy-t.nl/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://roy-t.nl</link>
	<description>My programming world</description>
	<lastBuildDate>Thu, 17 May 2012 06:59:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Sidestep: Facial Feature Detection</title>
		<link>http://roy-t.nl/index.php/2012/02/24/sidestep-facial-feature-detection/</link>
		<comments>http://roy-t.nl/index.php/2012/02/24/sidestep-facial-feature-detection/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 11:54:32 +0000</pubDate>
		<dc:creator>Roy Triesscheijn</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Computer Vision]]></category>
		<category><![CDATA[Facial Feature Detection]]></category>
		<category><![CDATA[Luxand]]></category>
		<category><![CDATA[Mimbo]]></category>

		<guid isPermaLink="false">http://roy-t.nl/?p=527</guid>
		<description><![CDATA[Recently I&#8217;ve been quite busy working on my thesis (which is coming around nicely)  and with a lot of work related things. For a temporary exhibition we where working on implementing Mimbo, this cute robot we found  on mashable there was only one problem. It requires an iPhone, which is quite hard to secure in [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been quite busy working on my thesis (which is coming around nicely)  and with a lot of work related things. For a temporary exhibition we where working on implementing Mimbo, this cute robot we found  on <a title="Mimbo" href="http://mashable.com/2012/01/04/mimbo-robot/" target="_blank">mashable</a> there was only one problem. It requires an iPhone, which is quite hard to secure in an unsupervised exhibition, and all our systems are Windows based. So we came up with using an iPad (larger, so more fun to look at) and an iMac to control it, but this would require securing a blu-tooth connection, and all sorts of problems. So the last few days I&#8217;ve been working on re-creating Mimbo in my spare time. This proved to be easier than I thought, using the excellent <a title="Luxand API" href="http://luxand.com/" target="_blank">Luxand API</a> which I just happened to come across. So after a bit of C# code to interpret the data, and some WPF to make a cool robot face this is the end result:</p>
<p><a href="http://www.youtube.com/watch?v=5OydaEaMrPY">http://www.youtube.com/watch?v=5OydaEaMrPY</a></p>
<p>Man it&#8217;s fun to step out of your comfort zone somtimes and do something completely different. Well anyway, I might release all the code as open-source, under the MIT license or something, but since I can technically use this at work I&#8217;ll have to sort out what happens with it there first.</p>
<p>I hope the next time between posts isn&#8217;t so long and that I can finally create some time to post the tutorials ideas I&#8217;ve been having, but it&#8217;s crazy busy lately.</p>
<p>&nbsp;</p>
<p>Sincerely,</p>
<p>&nbsp;</p>
<p>Roy</p>
]]></content:encoded>
			<wfw:commentRss>http://roy-t.nl/index.php/2012/02/24/sidestep-facial-feature-detection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Just a quicky</title>
		<link>http://roy-t.nl/index.php/2011/12/08/just-a-quicky/</link>
		<comments>http://roy-t.nl/index.php/2011/12/08/just-a-quicky/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 23:19:38 +0000</pubDate>
		<dc:creator>Roy Triesscheijn</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://roy-t.nl/?p=524</guid>
		<description><![CDATA[I always feel kind of obliged to make at least a post a month here, unfortunately I wasn&#8217;t able to post anything useful since the end of September (shame on me). Actually I haven&#8217;t been doing much programming at all lately. My main focus now is finishing up my Bsc in Computing Science, just one [...]]]></description>
			<content:encoded><![CDATA[<p>I always feel kind of obliged to make at least a post a month here, unfortunately I wasn&#8217;t able to post anything useful since the end of September (shame on me). Actually I haven&#8217;t been doing much programming at all lately. My main focus now is finishing up my Bsc in Computing Science, just one more course to go and of course the dreaded thesis. To everyone&#8217;s surprise, including mine, I will be doing a thesis about a topic picked by one of my professors who specializes in &#8220;intuitionistic propositional logic&#8221;. Hell I don&#8217;t even know what that means. Luckily for me I&#8217;ll be only dealing with a small sub-problem related to calculating the number of &#8216;upwards closed subsets&#8217; (I&#8217;m not sure if this direct translation from Dutch to English makes any sense academically). Anyway it will mean I can visualize and think a lot of lattices.</p>
<p>So back to that tutorials thing that should be going on here. Don&#8217;t worry I&#8217;m not stopping or even formally postponing anything. I even have a few code files and some word documents laying around about adding ways to tint models programmatically so that you can give models more diverse looks without much more work. However I can&#8217;t promise when I get around to publishing it, hell I&#8217;ve got a new computer and it hasn&#8217;t even got XNA on it yet! Although I&#8217;m seriously considering switching to something else.</p>
<p>I would also like to add a tutorial or two on graph layout algorithms, both from my internships and the lattices that I&#8217;m going to visualize for my thesis.</p>
<p>Meanwhile while you wait, why not pick up the new <a href="http://store.steampowered.com/app/35720/" title="Trine 2">Trine 2</a> which is a really good Indie game, man it looks absolutely perfect and the first 30 minutes already promise a lot more fun than Trine 1. *Not an advertisement, I&#8217;m just hyper excited about it <img src='http://roy-t.nl/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> *.</p>
<p>Sincerely,</p>
<p>Roy Triesscheijn</p>
]]></content:encoded>
			<wfw:commentRss>http://roy-t.nl/index.php/2011/12/08/just-a-quicky/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Another faster version of A* (2D+3D) in C#</title>
		<link>http://roy-t.nl/index.php/2011/09/24/another-faster-version-of-a-2d3d-in-c/</link>
		<comments>http://roy-t.nl/index.php/2011/09/24/another-faster-version-of-a-2d3d-in-c/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 20:08:51 +0000</pubDate>
		<dc:creator>Roy Triesscheijn</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[General Coding]]></category>
		<category><![CDATA[General Gamedesign]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[XNA]]></category>
		<category><![CDATA[A*]]></category>
		<category><![CDATA[A* 3D]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CoWorkerAwesomeNess]]></category>
		<category><![CDATA[Faster]]></category>
		<category><![CDATA[Heap]]></category>
		<category><![CDATA[MinHeap]]></category>

		<guid isPermaLink="false">http://roy-t.nl/?p=514</guid>
		<description><![CDATA[As you might know I once wrote an A* sample for C# more than 2 years ago. The first version worked but was very slow because of a bug. The second version was faster, and a third version (made by one of the readers of this blog) was even faster. Btw did you know that [...]]]></description>
			<content:encoded><![CDATA[<p>As you might know I once wrote an A* sample for C# more than 2 years ago. The first version worked but was very slow because of a bug. The second version was faster, and a third version (made by one of the readers of this blog) was even faster.</p>
<p>Btw did you know that the excellent game <a href="http://www.garethpw.co.uk/2009/06/dysnomia.html">Dysomnia</a> shipped with (a modified) version of my C#/A* code? Ok it&#8217;s just a few lines to get people started but it&#8217;s really cool to see how people use this little start for their cool projects!</p>
<p>Anyway, back on topic: during my internship at Nixxes an interested co-worker (thanks Marcel!) tweaked the heuristic, removed some unnecessary checks, and added a faster way to check if a tile was processed yet.</p>
<p>There is not much else to say, it&#8217;s still A*, it supports 2D and 3D, it uses a MinHeap and is faster than ever! (Note: this is a pure C# solution, so it doesn&#8217;t require XNA, but it will work nicely with XNA even on WP7 and the Xbox360).</p>
<p><a title="Version 2011-09-24" href="http://roy-t.nl/files/AStar3D-2011-09-24.zip">Download the latest version here</a></p>
<p>Older relevant blog posts about A*  (from older to newer)<br />
<a href="http://roy-t.nl/index.php/2009/02/24/implementing-a-path-finding-in-c-and-xna-source-code-can-we-cut-the-corner/">http://roy-t.nl/index.php/2009/02/24/implementing-a-path-finding-in-c-and-xna-source-code-can-we-cut-the-corner/</a><br />
<a href="http://roy-t.nl/index.php/2009/07/07/new-version-a-pathfinding-in-3d/">http://roy-t.nl/index.php/2009/07/07/new-version-a-pathfinding-in-3d/</a><br />
<a href="http://roy-t.nl/index.php/2010/06/27/more-a-improvements/">http://roy-t.nl/index.php/2010/06/27/more-a-improvements/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://roy-t.nl/index.php/2011/09/24/another-faster-version-of-a-2d3d-in-c/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Nixxes internship post-mortem</title>
		<link>http://roy-t.nl/index.php/2011/09/05/nixxes-internship-post-mortem/</link>
		<comments>http://roy-t.nl/index.php/2011/09/05/nixxes-internship-post-mortem/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 07:56:42 +0000</pubDate>
		<dc:creator>Roy Triesscheijn</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[General Coding]]></category>
		<category><![CDATA[General Gamedesign]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C++/CLI]]></category>
		<category><![CDATA[Deus Ex]]></category>
		<category><![CDATA[Human Revolution]]></category>
		<category><![CDATA[internship]]></category>
		<category><![CDATA[Nixxes]]></category>
		<category><![CDATA[Tomb Raider]]></category>
		<category><![CDATA[Ubisoft Montreal]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://roy-t.nl/?p=510</guid>
		<description><![CDATA[I tried to do a weekly update during my internship at Nixxes, but I never got around to finish a single post. However since Post-Mortems are hip these days I decided to write a simple post-mortem about my internship. Let&#8217;s start with the beginning. In the first week my mentor at Nixxes was still on [...]]]></description>
			<content:encoded><![CDATA[<p>I tried to do a weekly update during my internship at Nixxes, but I never got around to finish a single post. However since Post-Mortems are hip these days I decided to write a simple post-mortem about my internship.</p>
<p>Let&#8217;s start with the beginning. In the first week my mentor at Nixxes was still on vacation so a co-worker set me up with a new computer (a shiny i7) and helped me set-up the development environment. I was handed a few drafts from another co-worker who a few years back wrote a proposal for the tool I was to build. So I tried to arm myself with knowledge and put my education to the task by writing things like inception documents and prototype proposals. Although this was a bit formal for the team (they only do a light scrum + two person commits) it helped me get a good overview of what I had to do. I also played a lot with their technology (trying to give good old Lara Croft green hair in a test-level of TR:Legend).</p>
<p>The tool I was to build had a simple enough goal and had to do with their automatic shader generation. I had to make a tool that gave artists insight in how different settings on materials would create different shader configurations. It was not to give technical insight inside the shaders (you wouldn&#8217;t want to bore artists with that) . But to let them reduce the number of actual shaders by simplifying material.</p>
<p>In the next few weeks I started searching for existing tech, testing and prototyping. I needed tools to show large complex graphs with a lot of cross-nodes. So I started searching for layout algorithms (In the end I combined two layout techniques and wrote code myself, but it&#8217;s always good to check if you&#8217;re not reinventing the wheel, and it gave me some great insights).</p>
<p>I also had to familiarize myself with WPF, which I really enjoyed (the learning curve for WPF is much shorter than for WinForms and the performance and &#8216;nice-ity&#8217;  of WPF greatly outclasses WinForms).</p>
<p>After a few prototypes we decided on a work-flow for the program and refined the core questions the program had to solve.  It&#8217;s really helpful to write those down because a goal might be too abstract/far away so these core questions help you refine your way to do the goal and give you some work flow hints. (It&#8217;s also good to have these in your help file).</p>
<p>Because of the limited time there was only one week of feedback from real artists but of course I was surrounded by techies  to help fill this void.</p>
<p>In the end we refined the work flow once more and tied in the program with existing tools. (Up until now I was just parsing raw data). I hooked into a content-service using C++/CLI. This C++/CLI program also hosted my C#/WPF frontend, and to my surprise this worked really well and was easy to do!</p>
<p>In the end I left behind a well document and finished product and because we had a week to spare there was even quite some polish (the last week was used to add in some background workers and  nicer progress bar, I also added cancellation support to the layout algorithm).</p>
<p>During my internship I also experienced the release of Deus Ex: Human Revolution, of which the tech and pc-port was done by Nixxes, so it was really great to see the game get an 8,9 on meta-critic!</p>
<p><img class="aligncenter" title="Deus Ex: Human Revolution" src="http://brutalgamer.com/wp-content/uploads/2011/08/DeusExTitle.jpg" alt="" width="570" height="300" /></p>
<p>The end-talk with my mentor was relaxed and pleasant. I knew I had done pretty well but I was quite surprised when he gave me a final grade of 9 out of 10! Yay!</p>
<p>All in all I had a great time, and I&#8217;ve learned a lot of new techniques (C++/CLI, WPF, Graph Layout Algorithms, Data Binding). I also finally got to experience a real hands-on approach where everything gets prioritized because resources are finite. On the university  it&#8217;s really a rare thing to experience this, so this was really an eye opener. I feel like I learned more valuable skills in these two months than I would have doing 3 more courses (Thanks to a helpful dean I could replace 3 courses with this intern shop)</p>
<p>I would like to thank everyone at Nixxes for a great time!</p>
<p>PS.</p>
<p>One of my co-workers again sped up my A* code after peeking at my blog. I have his code and am trying to add a nice visualizer to it this time before posting it, so expect it up soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://roy-t.nl/index.php/2011/09/05/nixxes-internship-post-mortem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Internship at Nixxes (cooperating with Ubisoft Montreal)</title>
		<link>http://roy-t.nl/index.php/2011/07/03/internship-at-nixxes-cooperating-with-ubisoft-montreal/</link>
		<comments>http://roy-t.nl/index.php/2011/07/03/internship-at-nixxes-cooperating-with-ubisoft-montreal/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 11:57:22 +0000</pubDate>
		<dc:creator>Roy Triesscheijn</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[intern]]></category>
		<category><![CDATA[internship]]></category>
		<category><![CDATA[Lara Croft]]></category>
		<category><![CDATA[Nixxes]]></category>

		<guid isPermaLink="false">http://roy-t.nl/?p=506</guid>
		<description><![CDATA[&#160; This summer I&#8217;ll be doing an internship at Nixxes Software in Utrecht, the Netherlands.  They are a group of highly experienced game technology programmers who are independent but work mostly for Ubisoft Montreal. Their latest projects includes work on &#8220;Lara Croft and the guardian of light&#8221;, &#8220;Deus Ex: Human Revolution&#8221;, and &#8220;Kane &#38; Lynch [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nixxes.com"><img class="aligncenter size-full wp-image-507" title="Nixxes Logo" src="http://roy-t.nl/wp-content/uploads/2011/07/Nixxes_Logo.png" alt="" width="178" height="170" /></a></p>
<p>&nbsp;</p>
<p>This summer I&#8217;ll be doing an internship at <a title="Nixxes Homepage" href="http://www.nixxes.com/nixxes/" target="_blank">Nixxes</a> Software in Utrecht, the Netherlands.  They are a group of highly experienced game technology programmers who are independent but work mostly for Ubisoft Montreal. Their latest projects includes work on &#8220;Lara Croft and the guardian of light&#8221;, &#8220;Deus Ex: Human Revolution&#8221;, and &#8220;Kane &amp; Lynch 2&#8243;. They mostly develop on the engine used for these games, and tooling. It&#8217;s not yet sure what I&#8217;ll be doing but it will probably be a tool that too measure where performance can be increased, it will probably written in C# with interop-ed with C++/CLI.</p>
<p>I&#8217;m not yet sure if I&#8217;ll be working under an NDA (probably) and how much info I can release on what I&#8217;ve been doing, but I&#8217;d like to write a sort of development diary here. I&#8217;ll probably not be writing tutorials for the coming 2 months because I won&#8217;t have much free time.</p>
<p>Anyway I&#8217;ll be back after 2 months, so stay tuned and enjoy your summer vacation (I hope it will be more of an actual vacation for most people <img src='http://roy-t.nl/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ).</p>
<div class="wp-caption aligncenter" style="width: 639px"><img title="Lara Croft" src="http://cdn0.spong.com/artwork/l/a/laracrofta331650l/_-Lara-Croft-and-the-Guardian-of-Light-Xbox-360-_.jpg" alt="" width="629" height="800" /><p class="wp-caption-text">Lare Croft and the Guardian of Light</p></div>
]]></content:encoded>
			<wfw:commentRss>http://roy-t.nl/index.php/2011/07/03/internship-at-nixxes-cooperating-with-ubisoft-montreal/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Science LinX Herschel Exhibit</title>
		<link>http://roy-t.nl/index.php/2011/06/19/science-linx-herschel-exhibit/</link>
		<comments>http://roy-t.nl/index.php/2011/06/19/science-linx-herschel-exhibit/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 15:25:39 +0000</pubDate>
		<dc:creator>Roy Triesscheijn</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[General Coding]]></category>
		<category><![CDATA[XNA]]></category>
		<category><![CDATA[Herschel]]></category>
		<category><![CDATA[Science LinX]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://roy-t.nl/?p=501</guid>
		<description><![CDATA[For Science LinX I&#8217;ve working on an exhibit regarding the ESA Herschel satellite for the last 6 months, and I&#8217;m happy to inform you that it&#8217;s almost complete. Features -Camera is moved by using multi-touch signals sent by monitor, -Accurate simulation of our solar system, planets support properties like eccentricity, inclination, orbital radius, equatorial diameter, [...]]]></description>
			<content:encoded><![CDATA[<p>For <a href="http://www.sciencelinx.nl">Science LinX</a> I&#8217;ve working on an exhibit regarding the ESA Herschel satellite for the last 6 months, and I&#8217;m happy to inform you that it&#8217;s almost complete.</p>
<p><strong>Features</strong></p>
<p><strong>-</strong>Camera is moved by using multi-touch signals sent by monitor,<strong><br />
</strong><strong>-</strong>Accurate simulation of our solar system, planets support properties like eccentricity, inclination, orbital radius, equatorial diameter,  rotations per earth-year, orbits per earth-year.<br />
-Herschel satellite stationary in <a title="Lagrange Point info" href="http://upload.wikimedia.org/wikipedia/commons/thumb/e/ee/Lagrange_points2.svg/704px-Lagrange_points2.svg.png" target="_blank">lagrange point L2</a>.<br />
-Fully 3D<br />
-Multiple lighting effects<br />
- Particle effects (not currently used)<br />
-Beautiful skybox generated using <a href="http://alexcpeterson.com/spacescape" target="_blank">Space Scape</a><br />
-Expandable information boxes slowly center arc-ball camera on P.O.I.<br />
-Twitter integration (following the @<a href="http://twitter.com/#!/ESAHerschel" target="_blank">ESAHERSCHEL</a> channel)<br />
-Clickable planets, satellites and points of interests<br />
-Multiple Zoom levels smoothly change information windows, &#8216;tunnel vision&#8217;.</p>
<p><strong>Screenshots</strong></p>
<p>Anyway, this all sounds exciting (or not) but it&#8217;s always better  to see it for yourself:</p>
<p><a href="http://roy-t.nl/wp-content/uploads/2011/06/Herschel2.png"><img class="aligncenter size-medium wp-image-502" title="Herschel2" src="http://roy-t.nl/wp-content/uploads/2011/06/Herschel2-300x168.png" alt="" width="300" height="168" /></a></p>
<p><strong>The Team<br />
</strong>-Bart v/d Laar (Project Manager Science LinX)<br />
-Ingeborg Veldman (Project Manager Science LinX Virtual)<br />
-Hilbert Dijkstra (Project Designer, Text Writer)<br />
-Roy Triesscheijn (Programmer)<br />
-Hugo Engwerda (Artist)<br />
-Gerwin Kramer (Modeler)<br />
-Peter Barthel (Astronomer/Technical Consultant)</p>
]]></content:encoded>
			<wfw:commentRss>http://roy-t.nl/index.php/2011/06/19/science-linx-herschel-exhibit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codesnippet: A simple custom hexagon shape for WPF/Silverlight</title>
		<link>http://roy-t.nl/index.php/2011/05/24/codesnippet-a-simple-custom-hexagon-shape-for-wpfsilverlight/</link>
		<comments>http://roy-t.nl/index.php/2011/05/24/codesnippet-a-simple-custom-hexagon-shape-for-wpfsilverlight/#comments</comments>
		<pubDate>Tue, 24 May 2011 20:26:18 +0000</pubDate>
		<dc:creator>Roy Triesscheijn</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[General Coding]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Custom Control]]></category>
		<category><![CDATA[Path]]></category>
		<category><![CDATA[Shape]]></category>
		<category><![CDATA[Silverlight 4]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://roy-t.nl/?p=497</guid>
		<description><![CDATA[Recently I&#8217;ve been trying to learn more about WPF, since WinForms is getting really old now. As a small exercise I was trying to create a custom Shape, so I created a new class, derived it from Shape and started following this tutorial untill I found out that you can&#8217;t override the DefiningGeometry method in [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been trying to learn more about WPF, since WinForms is getting really old now. As a small exercise I was trying to create a custom <code>Shape</code>, so I created a new class, derived it from <code>Shape</code> and started following <a href="http://www.codeproject.com/KB/WPF/wpfarrow.aspx">this</a> tutorial untill I found out that you can&#8217;t override the <code>DefiningGeometry</code> method in Silverlight.</p>
<p>After some searching I found <a href="http://blogs.msdn.com/b/nickkramer/archive/2009/12/03/subclassing-shape-or-more-accurately-path.aspx">this</a> MSDN Blog article, where in Silverlight a custom shape is created by extending from <code>Path</code> (well I wouldn&#8217;t have thought of that).</p>
<p>After a bit of tweaking I adapted the class to display a Hexagon instead of a Triangle:</p>
<pre class="brush: csharp; title: ; notranslate">
namespace MyProject.Shapes
{
    public class Hexagon : Path
    {
        public Hexagon()
        {
            CreateDataPath(0, 0);
        }

        private void CreateDataPath(double width, double height)
        {
            height -= this.StrokeThickness;
            width -= this.StrokeThickness;

            //Prevent layout loop
            if(lastWidth == width &amp;&amp; lastHeight == height)
                return;

            lastWidth = width;
            lastHeight = height;

            PathGeometry geometry = new PathGeometry();
            figure = new PathFigure();

            //See for figure info http://etc.usf.edu/clipart/50200/50219/50219_area_hexagon_lg.gif
            figure.StartPoint = new Point(0.25 * width, 0);
            AddPoint(0.75 * width, 0);
            AddPoint(width, 0.5 * height);
            AddPoint(0.75 * width, height);
            AddPoint(0.25 * width, height);
            AddPoint(0, 0.5 * height);
            figure.IsClosed = true;
            geometry.Figures.Add(figure);
            this.Data = geometry;
        }

        private void AddPoint(double x, double y)
        {
            LineSegment segment = new LineSegment();
            segment.Point = new Point(x + 0.5 * StrokeThickness,
                y + 0.5 * StrokeThickness);
            figure.Segments.Add(segment);
        }

        protected override Size MeasureOverride(Size availableSize)
        {
            return availableSize;
        }

        protected override Size ArrangeOverride(Size finalSize)
        {
            CreateDataPath(finalSize.Width, finalSize.Height);
            return finalSize;
        }

        #region FieldsAndProperties
        private double lastWidth = 0;
        private double lastHeight = 0;
        private PathFigure figure;
        #endregion
    }
</pre>
<p>You can use a &#8216;shape&#8217;  like this in XAML:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;UserControl x:Class=&quot;FantasyCartographer.MainPage&quot;
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
    xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
    xmlns:Shapes=&quot;clr-namespace:MyNameSpace.Shapes&quot;
    mc:Ignorable=&quot;d&quot;
    d:DesignHeight=&quot;300&quot; d:DesignWidth=&quot;400&quot;&gt;

    &lt;Grid x:Name=&quot;LayoutRoot&quot; Background=&quot;White&quot;&gt;
        &lt;Canvas Height=&quot;161&quot; HorizontalAlignment=&quot;Left&quot; Margin=&quot;27,32,0,0&quot; Name=&quot;canvas1&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;254&quot;&gt;
            &lt;Shapes:Hexagon Canvas.Left=&quot;0&quot; Canvas.Top=&quot;0&quot; Height=&quot;154&quot; x:Name=&quot;hexagon1&quot; Stroke=&quot;Black&quot; StrokeThickness=&quot;3&quot; Width=&quot;188&quot; Fill=&quot;Red&quot;  /&gt;
        &lt;/Canvas&gt;
    &lt;/Grid&gt;
&lt;/UserControl&gt;
</pre>
<p>Tip: don&#8217;t forget to define an <code>xmlns</code> namespace mapping to your own .NET namespaces so that you can use a shape even if you defined it in another namespace, I&#8217;ve done this in the above <code>XAML</code> code as an example.</p>
]]></content:encoded>
			<wfw:commentRss>http://roy-t.nl/index.php/2011/05/24/codesnippet-a-simple-custom-hexagon-shape-for-wpfsilverlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XNA stereoscopic 3D using anyglyphs and red/cyan 3D-glasses</title>
		<link>http://roy-t.nl/index.php/2011/05/08/xna-stereoscopic-3d-using-anyglyphs-and-redcyan-3d-glasses/</link>
		<comments>http://roy-t.nl/index.php/2011/05/08/xna-stereoscopic-3d-using-anyglyphs-and-redcyan-3d-glasses/#comments</comments>
		<pubDate>Sun, 08 May 2011 11:44:31 +0000</pubDate>
		<dc:creator>Roy Triesscheijn</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[General Coding]]></category>
		<category><![CDATA[XNA]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Anaglyph]]></category>
		<category><![CDATA[Easy]]></category>
		<category><![CDATA[Glasses]]></category>
		<category><![CDATA[XNA4]]></category>

		<guid isPermaLink="false">http://roy-t.nl/?p=488</guid>
		<description><![CDATA[Anaglyphs are images designed to give a 3D effect when viewed with special glasses, usually with red and blue (sometimes red and cyan) filters over the left and right eyes, respectively.[1] Using anaglyphs we can make our game look real 3D through those cheap red/cyan 3D-glasses. Adding an anaglyph effect to your XNA game is [...]]]></description>
			<content:encoded><![CDATA[<p><em></p>
<blockquote><p>Anaglyphs are images designed to give a 3D effect when viewed with special glasses, usually with red and blue (sometimes red and cyan) filters over the left and right eyes, respectively.<a href="http://hypnagogic.net/anaglyphs/">[1]</a></p></blockquote>
<p></em><br />
Using anaglyphs we can make our game look real 3D through those cheap red/cyan 3D-glasses. Adding an anaglyph effect to your XNA game is fairly easy.</p>
<p>Basically we need to undertake the following steps:<br />
-Draw our scene twice to separate render targets, with a slightly offset camera<br />
-Use a shader and draw a full screen quad to blend the images and color coding the images for each eye</p>
<p>Easy right!</p>
<p>Lets start by assuming you have the following draw code:</p>
<pre class="brush: csharp; title: ; notranslate">
protected override void Draw(GameTime gameTime)
{
    //a lot of draw calls
    base.Draw(gameTime);
}
</pre>
<p>We need to extract all your drawing code (except base.Draw(..)) to a new method that as argument accepts a view matrix. Update your code so that the passed viewMatrix is used instead of your normal camera&#8217;s viewMatrix. Doing this will allow us to easily draw the scene twice with a slightly offset camera. You should now have something like this:</p>
<pre class="brush: csharp; title: ; notranslate">
private void DrawForEye(Matrix viewMatrix)
{
    //...
}
</pre>
<p>Now let&#8217;s first write the shader that is going to blend the images, create a new effect in your content project and paste in the following code:</p>
<pre class="brush: csharp; title: ; notranslate">
texture left;
sampler sLeft = sampler_state
{
	texture = ;
	magfilter = POINT;
	minfilter = POINT;
	mipfilter = POINT;
	AddressU  = CLAMP;
	AddressV  = CLAMP;
};

texture right;
sampler sRight = sampler_state
{
	texture = ;
	magfilter = POINT;
	minfilter = POINT;
	mipfilter = POINT;
	AddressU  = CLAMP;
	AddressV  = CLAMP;
};

struct VS_INPUT
{
	float3 Pos : POSITION;
	float2 Tex : TEXCOORD0;
};

struct VS_OUTPUT
{
	float4 Pos : POSITION;
	float2 Tex : TEXCOORD0;
};

void VtAnaglyph(VS_INPUT In, out VS_OUTPUT Out)
{
	Out.Pos = float4(In.Pos,1);
	Out.Tex = In.Tex;
}

float4 PxAnaglyph(VS_OUTPUT In) : COLOR0
{
    float4 colorLeft = tex2D(sLeft, In.Tex.xy);
	float4 colorRight = tex2D(sRight, In.Tex.xy);
    return float4(colorRight.r, colorLeft.g, colorLeft.b, max(colorLeft.a, colorRight.a));
}

technique Anaglyphs
{
    pass p0
    {
        VertexShader = compile vs_2_0 VtAnaglyph();
        PixelShader = compile ps_2_0 PxAnaglyph();
    }

}
</pre>
<p>This is a pretty standard HLSL shader, but I will quickly go over it.</p>
<p>The texture&#8217;s left and right will be the textures resulting from drawing the scene twice, slightly offset from each other. We use a sampler with POINT filters because the left and right textures are going to be exactly the same size as our final rendering.</p>
<p>The vertex shader is passed as input nothing more than the position and texture coordinate of the vertex, it doesn&#8217;t transform anything but it just directly passes to the pixel shader.</p>
<p>The pixel shader samples the textures for the left and right eye. The red channel is used to &#8216;encode&#8217; the image for the right eye (the red is unfiltered by the cyan colored lens). The green and blue channel are taken from the image for the left eye (they are unfiltered by the red colored lens). You can look at <a href="http://en.wikipedia.org/wiki/Anaglyphs#Possible_color_schemes">this wikipedia entry</a> for other color combinations in case you have different 3D-glasses.</p>
<p>Now that we have our effect we need to add 2 render targets, the effect and a quad renderer to our game class. (The Quad class is posted as a code snippet <a href="http://roy-t.nl/index.php/2011/05/07/codesnippet-quad-renderer/">here</a> and used as to render the final image).</p>
<p>Added these lines to the top of your game class.</p>
<pre class="brush: csharp; title: ; notranslate">
RenderTarget2D leftEye;
RenderTarget2D rightEye;
Effect anaglyphEffect;
QuadRenderer quad;

//you can change this later to test different distances between the left and right eye viewpoint,
//the offset depends on the scale of your game, but small values seem to work best.
//I used 0.05 for a scene about 5x5x5 size.
float ammount = 0.05f;
</pre>
<p>And add these lines in your LoadContent method:</p>
<pre class="brush: csharp; title: ; notranslate">
leftEye = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
rightEye = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
anaglyphEffect = Content.Load(&quot;Anaglyphs&quot;);
quad = new QuadRenderer(GraphicsDevice);
</pre>
<p>Now we need to calculate two slightly offset view-matrices, draw the scene two times using these view-matrices and then combine them using our effect. To accomplish this write the following Draw method:</p>
<pre class="brush: csharp; title: ; notranslate">
protected override void Draw(GameTime gameTime)
{
    Matrix viewMatrix = camera.ViewMatrix; //use your own camere class here

    //The vector pointing to the right (1,0,0) as seen from the view matrix is stored
    //in the view matrix as (M11, M21, M31)
    Vector3 right = new Vector3(viewMatrix.M11, viewMatrix.M21, viewMatrix.M31) * amount; //ofset from the center for each eye
    Matrix viewMatrixLeft = Matrix.CreateLookAt(camera.Position - right, camera.LookAt, Vector3.Up);
    Matrix viewMatrixRight = Matrix.CreateLookAt(camera.Position + right, camera.LookAt, Vector3.Up);

    GraphicsDevice.SetRenderTarget(leftEye);
    DrawForEye(viewMatrixLeft, camera.ProjectionMatrix);

    GraphicsDevice.SetRenderTarget(rightEye);
    DrawForEye(viewMatrixRight, camera.ProjectionMatrix);

    GraphicsDevice.SetRenderTarget(null);

    anaglyphEffect.Techniques[&quot;Anaglyphs&quot;].Passes[0].Apply();
    anaglyphEffect.Parameters[&quot;left&quot;].SetValue(leftEye);
    anaglyphEffect.Parameters[&quot;right&quot;].SetValue(rightEye);
    quad.DrawFullScreenQuad();

    base.Draw(gameTime);
}
</pre>
<p>And hooray! We now have anaglyphs in our game! This will result in some pretty picture (the following picture of course only make sense when you use red/cyan 3D-glasses)</p>
<div id="attachment_489" class="wp-caption aligncenter" style="width: 292px"><a href="http://roy-t.nl/wp-content/uploads/2011/05/Example2.png"><img class="size-medium wp-image-489" title="Anaglyph Example" src="http://roy-t.nl/wp-content/uploads/2011/05/Example2-282x300.png" alt="" width="282" height="300" /></a><p class="wp-caption-text">Anaglyph Example, view with red/cyan glasses</p></div>
<p><strong>When you have created some cool anaglyph images in XNA, be sure to send them in, I&#8217;ll make a small gallery here!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://roy-t.nl/index.php/2011/05/08/xna-stereoscopic-3d-using-anyglyphs-and-redcyan-3d-glasses/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CodeSnippet: Quad renderer</title>
		<link>http://roy-t.nl/index.php/2011/05/07/codesnippet-quad-renderer/</link>
		<comments>http://roy-t.nl/index.php/2011/05/07/codesnippet-quad-renderer/#comments</comments>
		<pubDate>Sat, 07 May 2011 08:42:43 +0000</pubDate>
		<dc:creator>Roy Triesscheijn</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[XNA]]></category>
		<category><![CDATA[codesnippet]]></category>
		<category><![CDATA[Quad]]></category>

		<guid isPermaLink="false">http://roy-t.nl/?p=482</guid>
		<description><![CDATA[This quad renderer was already part of my conversion of Catalin Zima&#8217;s Deferred Rendering for XNA tutorial, but because I plan to use it in a tutorial I&#8217;m going to write later today here is a handy snippet for drawing a quad with texture coordinates in XNA. (You could use the SpriteBatch class for this, [...]]]></description>
			<content:encoded><![CDATA[<p>This quad renderer was already part of my conversion of Catalin Zima&#8217;s Deferred Rendering for XNA tutorial, but because I plan to use it in a tutorial I&#8217;m going to write later today here is a handy snippet for drawing a quad with texture coordinates in XNA. (You could use the SpriteBatch class for this, but as you all know the SB class tends to mess up your render state if you do not define all states correctly).</p>
<p>Anyway here&#8217;s the class:</p>
<pre class="brush: csharp; title: ; notranslate">
    public class QuadRenderer
    {
        public QuadRenderer(GraphicsDevice device)
        {
            this.device = device;
            vertices = new VertexPositionTexture[]
            {
                new VertexPositionTexture(new Vector3(0,0,0),new Vector2(1,1)),
                new VertexPositionTexture(new Vector3(0,0,0),new Vector2(0,1)),
                new VertexPositionTexture(new Vector3(0,0,0),new Vector2(0,0)),
                new VertexPositionTexture(new Vector3(0,0,0),new Vector2(1,0))
            };

            indexBuffer = new short[] { 0, 1, 2, 2, 3, 0 };
        }

        public void Draw(Vector2 v1, Vector2 v2)
        {
            vertices[0].Position.X = v2.X;
            vertices[0].Position.Y = v1.Y;

            vertices[1].Position.X = v1.X;
            vertices[1].Position.Y = v1.Y;

            vertices[2].Position.X = v1.X;
            vertices[2].Position.Y = v2.Y;

            vertices[3].Position.X = v2.X;
            vertices[3].Position.Y = v2.Y;

            device.DrawUserIndexedPrimitives&amp;lt;VertexPositionTexture&amp;gt;(PrimitiveType.TriangleList, vertices, 0, 4, indexBuffer, 0, 2);
        }

        public void DrawFullScreenQuad()
        {
            Draw(Vector2.One * -1, Vector2.One);
        }

        #region FieldsAndProperties
        private VertexPositionTexture[] vertices = null;
        private short[] indexBuffer = null;
        private GraphicsDevice device;
        #endregion
    }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://roy-t.nl/index.php/2011/05/07/codesnippet-quad-renderer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Codesnippet: VertexPositionColorNormal</title>
		<link>http://roy-t.nl/index.php/2011/04/13/codesnippet-vertexpositioncolornormal/</link>
		<comments>http://roy-t.nl/index.php/2011/04/13/codesnippet-vertexpositioncolornormal/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 11:46:52 +0000</pubDate>
		<dc:creator>Roy Triesscheijn</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[XNA]]></category>
		<category><![CDATA[code snippet]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[Vertex types]]></category>
		<category><![CDATA[XNA4]]></category>

		<guid isPermaLink="false">http://roy-t.nl/?p=478</guid>
		<description><![CDATA[For some prototyping I needed a struct like VertexPositionColor, but I also needed a normal, after a minute of Googling I found out that nobody wrote a small (XNA4) compatible snippet) for this. So here I give you my own snippet. (Which also is a handy reference to see how the &#8216;new&#8217; IVertexType interface in [...]]]></description>
			<content:encoded><![CDATA[<p>For some prototyping I needed a struct like VertexPositionColor, but I also needed a normal, after a minute of Googling I found out that nobody wrote a small (XNA4) compatible snippet) for this. So here I give you my own snippet. (Which also is a handy reference to see how the &#8216;new&#8217; IVertexType interface in XNA4 works (yes I still think of XNA4 as new).</p>
<p>Anyway the source code:</p>
<pre class="brush: csharp; title: ; notranslate">
    public struct VertexPositionColorNormal : IVertexType
    {
        public Vector3 Position;
        public Color Color;
        public Vector3 Normal;

        public VertexPositionColorNormal(Vector3 position, Color color, Vector3 normal)
        {
            this.Position = position;
            this.Color = color;
            this.Normal = normal;
        }

        public static readonly VertexElement[] VertexElements =
        {
            new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
            new VertexElement(sizeof(float)*3, VertexElementFormat.Color, VertexElementUsage.Color, 0),
            new VertexElement(sizeof(float)*4, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0)
        };
        public static readonly VertexDeclaration vertexDeclaration = new VertexDeclaration(VertexElements);

        public VertexDeclaration VertexDeclaration
        {
           get { return vertexDeclaration; }
        }
    }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://roy-t.nl/index.php/2011/04/13/codesnippet-vertexpositioncolornormal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

