<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Comment Feed for Channel 9 - My Mango has a Teapot... Windows Phone 7.1/5 Augmented Reality Sample</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/coding4fun/blog/My-Mango-has-a-Teapot-Windows-Phone-715-Augmented-Reality-Sample/RSS"></atom:link>
	<image>
		<url>http://files.channel9.msdn.com/thumbnail/34710777-4fac-4b74-951d-20595e224da2.png</url>
		<title>Channel 9 - My Mango has a Teapot... Windows Phone 7.1/5 Augmented Reality Sample</title>
		<link></link>
	</image>
	<description>Augmented Reality (AR) is just cool. Seeing the digital and real world mashed up into one vision is something many of us have dreamed about for years. Now the devices we&#39;re carrying around have the power to make this vision come to pass. But sadly being able to carry around some AR in your pocket wasn&#39;t an option with the earlier versions of Windows Phone 7. Times, they are a changing... With Mango, the world of AR is now open for Windows Phone 7.1/5 devices. Today&#39;s project, is one example of that. Windows Phone AR sample Argument Reality sample application for Windows Phone &amp;quot;Mango&amp;quot;, which display virtual teapot in front of real video via photo camera. Accelerometer and Compass control the orientation of teapot based on Phone&#39;s orientation. This sample is developed in C# with XNA and Silverlight.  RequirementThis sample requires Windows Phone SDK 7.1 for build and Windows Phone &amp;quot;Mango&amp;quot;for work. FeaturesTouch gesture can rotate and scale 3D teapot (Touch button). Moving Windows Phone can rotate 3D teapot via accelerometer and compass (Gravity button). Display video via Photo Camera of Windows Phone as background of 3D teapot Camera On/Off button. TechniquesShared graphics device, using both XNA and Silverlight Original Teapot class, using IVertexType based custom vertex and BasicEffect to render Accelerometer and Compass, getting gravity and north PhotoCamera, display view from camera as background of virtual object Here&#39;s a couple snaps of it running in the emulator;   And the Solution;  Finally a snap of the OnUpdate; private void OnUpdate(object sender, GameTimerEventArgs e)
{
     // TODO: Add your update logic here
     if (useGravity)
     {
         if (useMotion)
         {
             teapot.World = Matrix.CreateFromYawPitchRoll(0, MathHelper.PiOver2, 0) * motion.CurrentValue.Attitude.RotationMatrix;
         }
         else if (useAccelerometer)
         {
             Vector3 original = new Vector3(0f, 0f, 1f);
             Vector3 current = new Vector3(accelSensor.CurrentValue.Acceleration.X, accelSensor.CurrentValue.Acceleration.Z, -accelSensor.CurrentValue.Acceleration.Y);
             current.Normalize();
             // Cross product to get axis
             Vector3 axis = Vector3.Cross(original, current);
             axis.Normalize();
             // dot product to get angle
             float dot = Vector3.Dot(original, current);
             float angle = (float)Math.Acos((double)dot);
             teapot.World = Matrix.CreateFromAxisAngle(axis, angle);
         }
     }
     else
     {
         HandleGesture();
         teapot.World = drag;
         if (pinch != Matrix.Identity) teapot.View = pinch;
     }
} This is a simple project but sometimes we all need a little KISS...  </description>
	<link></link>
	<language>en</language>
	<pubDate>Wed, 19 Jun 2013 14:35:09 GMT</pubDate>
	<lastBuildDate>Wed, 19 Jun 2013 14:35:09 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<item>
		<title>Re: My Mango has a Teapot... Windows Phone 7.1/5 Augmented Reality Sample</title>
		<description>
			<![CDATA[<p>Awesome! &nbsp;I have ideas in this realm for a personal project.</p><p>Now, if we can figure out how to mount a Kinect to the phone, we can create a scanner to capture the environment in 3D. &nbsp;Oh, the possibilities!! &nbsp; <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' /></p><p>posted by Hallmanac</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/blog/My-Mango-has-a-Teapot-Windows-Phone-715-Augmented-Reality-Sample#c634528979324368387</link>
		<pubDate>Thu, 29 Sep 2011 12:58:52 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/blog/My-Mango-has-a-Teapot-Windows-Phone-715-Augmented-Reality-Sample#c634528979324368387</guid>
		<dc:creator>Hallmanac</dc:creator>
	</item>
</channel>
</rss>