<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Phenomenological Theories!</title><subtitle type="html" /><id>http://weblogs.asp.net/mehrantoosi/atom.aspx</id><link rel="alternate" type="text/html" href="http://weblogs.asp.net/mehrantoosi/default.aspx" /><link rel="self" type="application/atom+xml" href="http://weblogs.asp.net/mehrantoosi/atom.aspx" /><generator uri="http://communityserver.org" version="3.0.20510.895">Community Server</generator><updated>2008-03-03T07:17:00Z</updated><entry><title>Using Geometry Differentiation for Hand-Written Character Segmentation</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/mehrantoosi/archive/2009/05/31/using-geometry-differentiation-for-hand-written-character-segmentation.aspx" /><id>http://weblogs.asp.net/mehrantoosi/archive/2009/05/31/using-geometry-differentiation-for-hand-written-character-segmentation.aspx</id><published>2009-05-31T08:59:00Z</published><updated>2009-05-31T08:59:00Z</updated><content type="html">&lt;P&gt;&lt;STRONG&gt;Intro.:&lt;/STRONG&gt; &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 27pt"&gt;The most important part of a Persian OCR is the segmentation process. Because of contiguous characters of Persian scripts the segmentation process is not easy and this will become more difficult when we're talking about hand-written words because there are vast kinds of a hand-written word in Persian script! &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 27pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;Note: As mentioned above, this algorithm targets Persian OCR systems because these systems has no reliable algorithm for this purpose, and this is why there is no Persian OCR system which recognizes hand-written words with high accuracy. But I've decided to share this algorithm here, because it may give you some idea for some other purposes.&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The Idea: &lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;The idea is so simple; this algorithm tries to do one of the stages of recognition process of a human brain. When you see a word, your brain first tries to match the whole word against its database, if nothing found, &lt;SPAN style="TEXT-DECORATION: underline"&gt;tries to segment characters based on its trained data against the word shape&lt;/SPAN&gt;, and … &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;So, the questions are how brain stores shapes and how brain matches shapes against its data? &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;&lt;STRONG&gt;A1:&lt;/STRONG&gt; Based on your language, the brain tries to store some principals while is under training; for sample, in English, the principal component that brain uses to segment characters is the space between characters and/or the connection between matched shapes for contiguous words(which this is done after recognition). &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;The principal in the Persian language is differences of ascends and descends in shapes. How this is understood is simple, because when a character lacks these principals, it cannot be recognized by human. Although, in this situation, it will be recognized if and only if we see some other characters around that character (guessing). &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;&lt;STRONG&gt;A2:&lt;/STRONG&gt; As I mentioned above, the matching is done based on differences of ascends and descends in shapes. But one important thing is, in this stage we don't really have to focus on the "dot" and "kashida" (some Persian characters include these special components like "&lt;SPAN style="FONT-SIZE: 10pt"&gt;ب&lt;/SPAN&gt;" and "&lt;SPAN style="FONT-SIZE: 10pt"&gt;ک&lt;/SPAN&gt;") although the brain may or may not do the focus but in this algorithm we will ignore them. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The Algorithm: &lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;Stage 1: generate a multi-level horizontal histogram of the whole word's image. This histogram will help us to separate dots and kashidas. &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;Stage 2: generate vertical histogram of the image, this will help us to find the image baseline and combining this to multi-level histogram will be used to make decision on ignoring some under/above baseline pixels. &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;Stage 3: convert all of the remaining pixels to curves, for sample the following part of the image can be converted to Sinh(x^2). &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt" mce_keep="true"&gt;&lt;IMG src="http://weblogs.asp.net/blogs/mehrantoosi/Images/GD%20Images/sa2.bmp" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/GD%20Images/sa2.bmp"&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG style="WIDTH: 219px; HEIGHT: 190px" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/GD%20Images/graph1.png" width=555 height=692 mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/GD%20Images/graph1.png"&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;Stage 4: get the first differentiation on x. for the above sample, the differentiation will be 2xCosh(x^2). &lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG style="WIDTH: 222px; HEIGHT: 216px" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/GD%20Images/graph2.png" width=633 height=749 mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/GD%20Images/graph2.png"&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;Stage 5: solve the 2xCosh(x^2) = 0 equation. So the logical point (0, 0), is the reference point of the curve. &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;Stage 6: add this reference point to the list and store the x and y difference of the point n and point n-1; &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;Stage 7: calculate the average of the x and y differences of reference points. &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;Stage 8: &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;STRONG&gt;for&lt;/STRONG&gt; (&lt;STRONG&gt;int&lt;/STRONG&gt; i = 0; i &amp;lt; refpoints-&amp;gt;Count; i++) &lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;STRONG&gt;for&lt;/STRONG&gt; (&lt;STRONG&gt;int&lt;/STRONG&gt; j = i+1; j &amp;lt; refpoints-&amp;gt;Count; j++) &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;STRONG&gt;if&lt;/STRONG&gt; (refpoints[i].X - refpoints[j].X &amp;gt; segHorAvg || &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;(Math::Abs(refpoints[i].Y - refpoints[j].Y) &amp;gt; segVerAvg &amp;amp;&amp;amp; refpoints[i].X - refpoints[j].X &amp;gt; 2)) { &lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;STRONG&gt;if&lt;/STRONG&gt; (i == 0 &amp;amp;&amp;amp; !beg) { &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;slices-&amp;gt;Add(refpoints[i]); &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;beg = &lt;STRONG&gt;true&lt;/STRONG&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;STRONG&gt;if&lt;/STRONG&gt; (!IsDescendingAscending(rp, i, j)) &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;slices-&amp;gt;Add(refpoints[j]); &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;STRONG&gt;else&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;STRONG&gt;continue&lt;/STRONG&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;i=j; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;STRONG&gt;break&lt;/STRONG&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&amp;nbsp; }&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;Real-World Results:&lt;/STRONG&gt; &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;In the following images the green line is the image's baseline, red points are calculated reference points and blue lines are slices of the image. &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;(you can see that how the dots are ignored) &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;&lt;IMG src="http://weblogs.asp.net/blogs/mehrantoosi/Images/GD%20Images/sa.jpg" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/GD%20Images/sa.jpg"&gt;94 miliseconds. (Debug mode) &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;&lt;IMG src="http://weblogs.asp.net/blogs/mehrantoosi/Images/GD%20Images/mh.jpg" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/GD%20Images/mh.jpg"&gt;93 miliseconds. (Debug mode) &lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Author: Mehran Toosi&lt;/STRONG&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7103966" width="1" height="1"&gt;</content><author><name>rambler_elf</name><uri>http://weblogs.asp.net/members/rambler_5F00_elf.aspx</uri></author><category term=".NET" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/.NET/default.aspx" /><category term="OCR" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/OCR/default.aspx" /><category term="Math" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/Math/default.aspx" /><category term="AI" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/AI/default.aspx" /></entry><entry><title>XBAP 3D Image Viewer (Part 2)</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/mehrantoosi/archive/2008/04/18/xbap-3d-image-viewer-part-2.aspx" /><id>http://weblogs.asp.net/mehrantoosi/archive/2008/04/18/xbap-3d-image-viewer-part-2.aspx</id><published>2008-04-18T00:42:00Z</published><updated>2008-04-18T00:42:00Z</updated><content type="html">&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Part 2 – The Application : &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;All the information in the previous post was some basic knowledge of WPF 3D for better understanding the application. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Part 1: &lt;A href="http://weblogs.asp.net/mehrantoosi/archive/2008/04/15/xbap-3d-image-viewer-basic-3d.aspx" mce_href="http://weblogs.asp.net/mehrantoosi/archive/2008/04/15/xbap-3d-image-viewer-basic-3d.aspx"&gt;http://weblogs.asp.net/mehrantoosi/archive/2008/04/15/xbap-3d-image-viewer-basic-3d.aspx&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;NOTE : This tutorial is produced for beginners. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Let's start… &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Start the visual studio 2008 and create a WPF browser application named 3DImageViewer. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/1.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/1.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Now you have a new page named Page1, rename the file and class name to Viewer. Don't forget the App.xaml. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Split the default grid to 2 columns and 2 rows &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/2.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/2.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Ok, now it's time to remember what we said in the first part, what we needs now, is Viewport3D, so create your Viewport by typing it's name. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;The number 2 was the camera, create a perspective camera as the viewport's camera. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/3.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/3.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Set your camera properties : &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/4.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/4.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Here, I have a camera which is positioned in 0,0,50 (x,y,z), is looking to point 0,0,-1 with 45 degree of horizontal viewing range. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;I've limited my camera's projection between 100 and .1. and finally the up direction is 0,1,0. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;you can change these settings as desired… &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;so let's go to the next step, the Geometry. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Create a ModelVisual3D object &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/5.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/5.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;In the content of the ModelVisual3D create a GeometryModel3D object, now we should set the Geometry property. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/6.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/6.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Create a MeshGeometry3D object : &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;We've a very simple object, our object is plane, a rectangle which has two sides. Remember that you're 50 unit far away from the object (your camera position). &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;If the center of the rectangle is 0,0,0 so our positions can be : &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;-100,75,0 100,75,0 100,-75,0 -100,-75,0 &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;we've a 200 x 150 rectangle. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Set the triangle indices : &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Our first indices is 0 1 2 (counter-clock wise), the second one is 3 0 2, why? &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Remember the right hand rule, if you add the indices like 2 3 0, your thumb is pointing out (clock wise). &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/7.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/7.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;It's done, the object is ready, but how the texture should be mapped to our object, we've to set the TextureCoordinates property. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;As we said in the first part, the TextureCoordinates is the mapping between our texture in 2-D and our object in 3-D; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;This will allows the system to know how our object should be covered by the texture. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/8.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/8.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;So the texture coordinates is 0,0 1,0 1,1 0,1 &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Next step is the Texture, the GeometryModel3D has a property named Material, this property allows us to set the front material of the object. There's also another property named BackMaterial which we can set the back material of the object. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;In the material content, create a DiffuseMaterial object. The DiffuseMaterial has a property named Brush which you can use it to draw the texture with any type of brush. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Here we'll use ImageBrush to draw the image. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/9.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/9.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;In the above image you can see that I used the scale transform to flip the image horizontally. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Do the same with the BackMaterial but without transformation… &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Now if you close the open tags you'll see a dark rectangle in your designer, as we said in the first part, the lights in 3D programming do what the lights do in the real world, they makes surfaces visible. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;After closing the ModelVisual3D tag, create another ModelVisual3D and in create an AmbientLight object in the content. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/10.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/10.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;It's done, now your object is visible… &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;We need some controls for rotating, scaling and moving the object… so we need some transformation that allows us to do what we need. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;For the Transform property of your GeometryModel3D, create a Transform3DGroup like the image below. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/11.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/11.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Ok now drop a button into the controls area like the image below. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/12.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/12.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Now go to the code behind and in the button1_Click create a double animation for rotating the object, like this : &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/13.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/13.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Don't forget using System.Windows.Media.Animation and System.Windows.Media.Media3D. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Now run the application and click the rotate button, the object rotates and you'll see the back material. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/14.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/14.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Rotating the object by Mouse : &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;For moving the object by the Mouse, first you need to wrap the Vieport3D in a container(like grid) with background property set to transparent which allows to capture the events of the mouse event if it's not on the object. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Wrap the viewport in a grid, name it grd, create a handler for mousedown and mouseup, set the background property to transparent and set the focusable to true. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/15.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/15.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Create a global double variable named x; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;In grd_mouseUpDown, handle the MouseMove event of the grid. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/16.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/16.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Create a method named rotationCheck, this method will check the Angle of the rotation to see if it's bigger than 360. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/17.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/17.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;In the MouseMove event just change the Angle property of the rotation. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/18.JPG" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/18.JPG"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Now you can rotate the object by grabbing it by mouse. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Download the sample from here : &lt;A href="http://weblogs.asp.net/blogs/mehrantoosi/WPF/3DImageViewer.zip" mce_href="http://weblogs.asp.net/blogs/mehrantoosi/WPF/3DImageViewer.zip"&gt;http://weblogs.asp.net/blogs/mehrantoosi/WPF/3DImageViewer.zip&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;&lt;STRIKE&gt;Coming Up :&lt;/STRIKE&gt; --&amp;gt;&amp;gt; [CANCELED]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;&lt;STRIKE&gt;Part 3 (Scaling and Moving) &lt;/STRIKE&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;&lt;STRIKE&gt;Part 4 (Integrating with a Silverlight Application)&lt;/STRIKE&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6108028" width="1" height="1"&gt;</content><author><name>rambler_elf</name><uri>http://weblogs.asp.net/members/rambler_5F00_elf.aspx</uri></author><category term=".NET" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/.NET/default.aspx" /><category term="WPF" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/WPF/default.aspx" /><category term="XBAP" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/XBAP/default.aspx" /></entry><entry><title>XBAP 3D Image Viewer (Basic 3D)</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/mehrantoosi/archive/2008/04/15/xbap-3d-image-viewer-basic-3d.aspx" /><id>http://weblogs.asp.net/mehrantoosi/archive/2008/04/15/xbap-3d-image-viewer-basic-3d.aspx</id><published>2008-04-15T02:12:00Z</published><updated>2008-04-15T02:12:00Z</updated><content type="html">&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;&lt;EM&gt;"The WPF&amp;nbsp;3-D implementation allows developers to draw, transform, and animate 3-D graphics in both markup and procedural code, using the same capabilities afforded by the platform to 2-D graphics. Developers can combine 2-D and 3-D graphics to create rich controls, provide complex illustrations of data, or enhance the user experience of an application's interface."&lt;/EM&gt; – MSDN &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Here, we're going to use the WPF 3-D to write a very simple application. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Suppose that you've written a secretariat system in which user can add the image of letters which comes from outside of the organization via fax or …, after archiving them (if the letter is two sided), every time the user wants to see this letter, you can only show one side of the letter at a time, but it would be cool if we could view this letter as a 3-D image! Isn't? &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;WPF is here! &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Part 1 – The Basic Knowledge Of WPF 3-D Programming : &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;When you want to create 3-D graphics content in WPF, you'll need: &lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Viewport3D &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Camera &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Geometry &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Texture &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Lighting &lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Viewport3D : &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;3-D graphics content in WPF is encapsulated in an element named &lt;STRONG&gt;Viewport3D &lt;/STRONG&gt;that can participate in the two-dimensional element structure. The graphics system treats Viewport3D as a two-dimensional visual element like many others in WPF. &lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Camera : &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;The WPF supports 3 types of cameras and projections : &lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Matrix Camera: specifies the view and projection transforms as Matrix3D objects &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Orthographic Camera: describes a viewing box whose sides are parallel &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Perspective Camera: provides vanishing-point perspective &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Here we'll talk about perspective camera; This projection camera has some properties : &lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Field of view : this property allows you to set the horizontal field of view by degree. &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Far/Near plane distance : this allows you to limit the range of projection. &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Position : you'll set the position of the camera in 3-D space by this property &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Look direction : setting a point in 3-D space which specifies where the camera is looking.(a straight line from the position of the camera to the looking direction) &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Up direction : this property allows you to tell to the camera where is the up! &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;The following figure shows a camera in 3-D space. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://weblogs.asp.net/blogs/mehrantoosi/Images/Camera.jpg" mce_src="http://weblogs.asp.net/blogs/mehrantoosi/Images/Camera.jpg"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Geometry : &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;To build a 3-D scene you need some objects to view, which they are defined by mesh primitives. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;What is the mesh? &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;A triangle mesh or unstructured grid is a collection of vertices, edges and faces that defines the shape of a polyhedral object in 3D computer graphics. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;A mesh is represented by : &lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Positions : Collection of points in 3-D space &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Triangle indices : only positions have not the ability to define objects, which points makes which triangles? To answer this question you need to define these indices. &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;In WPF the order in which you add mesh positions is important. You'll need the index of these positions when you're defining triangles. For example if you've four position {p0, p1, p2, p3} and you want to make a triangle from p0, p2 and p3, the index values will be 0,2 and 3. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;The order which you're adding the indices is important too. This will say which side of the plane of the triangle that is defined is visible. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Suppose that you're looking at a surface of a triangle, if you add the indices clockwise, the side which you're looking on, will be invisible. You can use the right hand rule to remember this. &lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Texture coordinates : after defining the object the system needs to know how cover your object by specified texture. &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;The &lt;EM&gt;i&lt;/EM&gt;th entry in the TextureCoordinates list corresponds to the &lt;EM&gt;i&lt;/EM&gt;th entry in the Positions list. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Example : &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Positions {-1,1,0 -1,-1,0 1,-1,0} &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;TriangleIndices {0,1,2} &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;TextureCoordinates {0,0 0,1 1,1} &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;This means the 0,0 in 2-D space will be mapped to -1,1,0 in 3-D space and so on… &lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Normals : this property isn't always necessary, a normal in WPF is used to know how the surface should be lit by a light source. The normal vector is computed by cross product of two vectors that make up the side of the triangle. &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;For example, the normal vector of a triangle which is defined by A, B and C is computed by AB x AC, BC x BA or CB x CA. &lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Texture : &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;To define the characteristics of a model's surface, WPF uses the Material abstract class. The concrete subclasses of Material determine some of the appearance characteristics of the model's surface, and each also provides a Brush property to which you can pass a SolidColorBrush, TileBrush, or VisualBrush. &lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;DiffuseMaterial : specifies that the brush will be applied to the model as though that model were lit diffusely. Using DiffuseMaterial most resembles using brushes directly on 2-D models; model surfaces do not reflect light as though shiny. &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;SpecularMaterial : specifies that the brush will be applied to the model as though the model's surface were hard or shiny, capable of reflecting highlights. You can set the degree to which the texture will suggest this reflective quality, or "shine," by specifying a value for the SpecularPower property. &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;EmissiveMaterial : allows you to specify that the texture will be applied as though the model were emitting light equal to the color of the brush. This does not make the model a light; however, it will participate differently in shadowing than it would if textured with DiffuseMaterial or SpecularMaterial. &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Lighting : &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Lights in 3-D graphics do what lights do in the real world: they make surfaces visible. More to the point, lights determine what part of a scene will be included in the projection. Light objects in WPF create a variety of light and shadow effects and are modeled after the behavior of various real-world lights. You must include at least one light in your scene, or no models will be visible. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;The following lights derive from the base class Light: &lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;AmbientLight : Provides ambient lighting that illuminates all objects uniformly regardless of their location or orientation. &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;DirectionalLight : Illuminates like a distant light source. Directional lights have a Direction specified as a Vector3D, but no specified location. &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;PointLightIlluminates : like a nearby light source. PointLights have a position and cast light from that position. Objects in the scene are illuminated depending on their position and distance with respect to the light. PointLightBase exposes a Range property, which determines a distance beyond which models will not be illuminated by the light. PointLight also exposes attenuation properties which determine how the light's intensity diminishes over distance. You can specify constant, linear, or quadratic interpolations for the light's attenuation. &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;SpotLightInherits : from PointLight. Spotlights illuminate like PointLight and have both position and direction. They project light in a cone-shaped area set by InnerConeAngle and OuterConeAngle properties, specified in degrees. &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana"&gt;Reference : &lt;A href="http://msdn2.microsoft.com/en-us/library/ms747437.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms747437.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms747437.aspx&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Coming Up : Part 2 – The Application&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Verdana"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6099775" width="1" height="1"&gt;</content><author><name>rambler_elf</name><uri>http://weblogs.asp.net/members/rambler_5F00_elf.aspx</uri></author><category term=".NET" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/.NET/default.aspx" /><category term="WPF" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/WPF/default.aspx" /><category term="XBAP" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/XBAP/default.aspx" /></entry><entry><title>Silverlight's XamlWriter!</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/mehrantoosi/archive/2008/03/03/silverlight-s-xamlwriter.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="644363" href="http://weblogs.asp.net/mehrantoosi/attachment/5903399.ashx" /><id>http://weblogs.asp.net/mehrantoosi/archive/2008/03/03/silverlight-s-xamlwriter.aspx</id><published>2008-03-03T03:17:00Z</published><updated>2008-03-03T03:17:00Z</updated><content type="html">&lt;P mce_keep="true"&gt;Hi,&lt;/P&gt;
&lt;P mce_keep="true"&gt;Oh god!, this is my first blog post and this is the&amp;nbsp;second time that&amp;nbsp;I write a complete post and then IE crashes :((&lt;/P&gt;
&lt;P mce_keep="true"&gt;nowadays we hear the sounds of the people who is looking around for a Silverlight's XamlWriter, but there's nothing!&lt;/P&gt;
&lt;P mce_keep="true"&gt;I'm one of the guys who is contributing in Silverlight's Forums (rambler.elf) and I see so many people requested it.&lt;/P&gt;
&lt;P mce_keep="true"&gt;I've decide to create a XamlWriter, and after about 10 hours working it's here! (no no, it's not a ideal XamlWriter, but don't worry, it's not so bad :-) )&lt;/P&gt;
&lt;P mce_keep="true"&gt;a sample Xaml which is created at runtime by XamlWriter :&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;lt;Canvas Width="100" Height="150" Opacity="1" RenderTransformOrigin="0,0" Cursor="Default" IsHitTestVisible="True" Visibility="Visible" x:Name="test" Canvas.Left="20" Canvas.Top="0" Canvas.ZIndex="0"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Canvas.Background&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RadialGradientBrush Center="0.5,0.5" GradientOrigin="0.5,0.5" RadiusX="0.5" RadiusY="0.5" SpreadMethod="Pad" MappingMode="RelativeToBoundingBox" ColorInterpolationMode="SRgbLinearInterpolation" Opacity="1"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;GradientStop Color="#FFFFFFFF" Offset="0.5" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RadialGradientBrush.Transform&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TransformGroup&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RotateTransform CenterX="0" CenterY="0" Angle="80" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/TransformGroup&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/RadialGradientBrush.Transform&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/RadialGradientBrush&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/Canvas.Background&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Canvas.OpacityMask&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RadialGradientBrush Center="0.5,0.5" GradientOrigin="0.5,0.5" RadiusX="0.5" RadiusY="0.5" SpreadMethod="Pad" MappingMode="RelativeToBoundingBox" ColorInterpolationMode="SRgbLinearInterpolation" Opacity="1"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;GradientStop Color="#FFFFFFFF" Offset="0.5" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/RadialGradientBrush&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/Canvas.OpacityMask&amp;gt;&lt;BR&gt;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Ellipse StrokeMiterLimit="10" StrokeThickness="1" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat" StrokeLineJoin="Miter" StrokeDashOffset="0" StrokeDashCap="Flat" Stretch="Fill" Width="20" Height="20" Opacity="1" RenderTransformOrigin="0,0" Cursor="Default" IsHitTestVisible="True" Visibility="Visible" x:Name="el" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="0"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Ellipse.Fill&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SolidColorBrush Color="#FF808080" Opacity="1" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Ellipse.Fill&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Ellipse&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;UserControl1 Width="0" Height="0" Opacity="1" RenderTransformOrigin="0,0" Cursor="Default" IsHitTestVisible="True" Visibility="Visible" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="0" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Canvas Width="0" Height="0" Opacity="1" RenderTransformOrigin="0,0" Cursor="Default" IsHitTestVisible="True" Visibility="Visible" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="0"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Rectangle RadiusX="0" RadiusY="0" StrokeMiterLimit="10" StrokeThickness="1" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat" StrokeLineJoin="Miter" StrokeDashOffset="0" StrokeDashCap="Flat" Stretch="Fill" Width="100" Height="100" Opacity="1" RenderTransformOrigin="0,0" Cursor="Default" IsHitTestVisible="True" Visibility="Visible" Canvas.Left="0" Canvas.Top="0" Canvas.ZIndex="0"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Rectangle.Fill&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SolidColorBrush Color="#FFFFFFFF" Opacity="1" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Rectangle.Fill&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Rectangle.RenderTransform&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TransformGroup&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RotateTransform CenterX="0" CenterY="0" Angle="25" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/TransformGroup&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Rectangle.RenderTransform&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Rectangle&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Canvas&amp;gt;&lt;BR&gt;&amp;nbsp; &lt;BR&gt;&amp;nbsp; &amp;lt;Canvas.RenderTransform&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TransformGroup&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RotateTransform CenterX="0" CenterY="0" Angle="80" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/TransformGroup&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/Canvas.RenderTransform&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Canvas.Triggers&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;EventTrigger RoutedEvent="Canvas.Loaded"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;BeginStoryboard&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Storyboard&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DoubleAnimation From="0" To="10" AutoReverse="False" BeginTime="00:00:00" Duration="00:00:00" SpeedRatio="1" FillBehavior="HoldEnd" RepeatBehavior="00:00:00" Storyboard.TargetName="el" Storyboard.TargetProperty="Opacity" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Storyboard&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/BeginStoryboard&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/EventTrigger&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/Canvas.Triggers&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Canvas.Resources&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Storyboard AutoReverse="False" BeginTime="00:00:00" Duration="00:00:00" SpeedRatio="1" FillBehavior="HoldEnd" RepeatBehavior="00:00:00" x:Name="testSB"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DoubleAnimationUsingKeyFrames AutoReverse="False" BeginTime="00:00:00" Duration="00:00:00" SpeedRatio="1" FillBehavior="HoldEnd" RepeatBehavior="00:00:00"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DiscreteDoubleKeyFrame Value="5" KeyTime="00:00:00.5000000" /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/DoubleAnimationUsingKeyFrames&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Storyboard&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/Canvas.Resources&amp;gt;&lt;BR&gt;&amp;lt;/Canvas&amp;gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Limitations :&lt;/STRONG&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;&lt;A color="red"&gt;WORKS WITH SILVERLIGHT 1.1 ALPHA&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;custom prefixes is not suported. for example : &amp;lt;uc:UserControl1 ... will be resolved to&amp;nbsp;&amp;lt;UserControl1&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;due to silverlight's limitation for dependency properties, the ones&amp;nbsp;that are not in the control's hirarechy except Canvas.Left, Canvas.Top, Canvas.ZIndex, Storyboard.TargetName and Storyboard.TargetProperty, are not supported.&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Project :&lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;please use the following&amp;nbsp;link to download the project&amp;nbsp;:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;A href="http://weblogs.asp.net/blogs/mehrantoosi/Silverlight/XAMLTools.zip" mce_href="http://weblogs.asp.net/blogs/mehrantoosi/Silverlight/XAMLTools.zip"&gt;http://weblogs.asp.net/blogs/mehrantoosi/Silverlight/XAMLTools.zip&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Thanks&lt;/P&gt;
&lt;P mce_keep="true"&gt;-M&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5903399" width="1" height="1"&gt;</content><author><name>rambler_elf</name><uri>http://weblogs.asp.net/members/rambler_5F00_elf.aspx</uri></author><category term="Silverlight" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/Silverlight/default.aspx" /><category term=".NET" scheme="http://weblogs.asp.net/mehrantoosi/archive/tags/.NET/default.aspx" /></entry></feed>