<?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>xiaoma de blog</title>
	<atom:link href="http://www.floatingvectors.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.floatingvectors.com/blog</link>
	<description></description>
	<lastBuildDate>Sun, 22 Jan 2012 11:51:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tricks</title>
		<link>http://www.floatingvectors.com/blog/398/</link>
		<comments>http://www.floatingvectors.com/blog/398/#comments</comments>
		<pubDate>Sat, 18 Dec 2010 10:02:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[软件[Code]]]></category>

		<guid isPermaLink="false">http://www.floatingvectors.com/blog/?p=398</guid>
		<description><![CDATA[[Ubuntu]
ISSUE: Nvidia display driver problem on a two graphics card PC.
[EE] No devices detected. No screen found.
SOLUTION:
lspci -v
Get PCI bus number for graphics cards, 1:0:0 and 6:0:0 for instance.
sudo vi /etc/X11/xorg.conf
Under section &#8220;Device&#8221;, add
BusID &#8220;PCI:1:0:0&#8243;
Restart X and everything works like a charm.
http://wiki.linuxquestions.org/wiki/Using_multiple_monitors
[CUDA]
ISSUE: &#8220;error while loading shared libraries: libcudart.so.3: cannot open shared object file: No such [...]]]></description>
			<content:encoded><![CDATA[<p>[Ubuntu]</p>
<p>ISSUE: Nvidia display driver problem on a two graphics card PC.</p>
<p>[EE] No devices detected. No screen found.</p>
<p>SOLUTION:</p>
<p>lspci -v</p>
<p>Get PCI bus number for graphics cards, 1:0:0 and 6:0:0 for instance.</p>
<p>sudo vi /etc/X11/xorg.conf</p>
<p>Under section &#8220;Device&#8221;, add</p>
<p>BusID &#8220;PCI:1:0:0&#8243;</p>
<p>Restart X and everything works like a charm.</p>
<p>http://wiki.linuxquestions.org/wiki/Using_multiple_monitors</p>
<p>[CUDA]</p>
<p>ISSUE: &#8220;error while loading shared libraries: libcudart.so.3: cannot open shared object file: No such file or directory&#8221;</p>
<p>SOLUTION:</p>
<p>sudo vim /etc/ld.so.conf</p>
<p>Add &#8220;/usr/local/cuda/lib&#8221;</p>
<p>Save and quit.</p>
<p>ld config -v | grep cuda</p>
<p>山寨的联通3G网卡，无型号，隆信通，在Ubuntu 11.10下使用：</p>
<p>lsusb信息如下：</p>
<p>Bus 003 Device 003: ID 05c6:6000 Qualcomm, Inc. Mass Storage Device.</p>
<p>使用如下命令切换到modem模式：</p>
<p>usb_modeswitch -v 05c6 -p 1000 -M 5553424312345678000000000000061b000000020000000000000000000000 -R 1<br />
切换成功后可ls /dev/tty*看到ttyUSBx的设备。</p>
<p>打开网络配置用户名和密码都为any，pin码为1234，网络为3gnet，其余默认。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.floatingvectors.com/blog/398/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPad RC Toy Tank</title>
		<link>http://www.floatingvectors.com/blog/388/</link>
		<comments>http://www.floatingvectors.com/blog/388/#comments</comments>
		<pubDate>Sun, 21 Nov 2010 07:50:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[电子[Electronics]]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.floatingvectors.com/blog/?p=388</guid>
		<description><![CDATA[
The drawing explains pretty much everything.

]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><object width="480" height="400"><param name="movie" value="http://player.youku.com/player.php/sid/XMjI0MTE0MjA4/v.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="never"></param><param name="allownetworking" value="internal"></param><param name="flashvars" value="isShowRelatedVideo=false&showAd=0&show_pre=1&show_next=1&isAutoPlay=false&isDebug=false&UserID=&winType=interior&playMovie=true&MMControl=false&MMout=false&RecordCode=1001,1002,1003,1004,1005,1006,2001,3001,3002,3003,3004,3005,3007,3008,9999" /><embed src="http://player.youku.com/player.php/sid/XMjI0MTE0MjA4/v.swf" type="application/x-shockwave-flash" allowscriptaccess="never" allownetworking="internal" allowfullscreen="true" width="480" height="400" flashvars="isShowRelatedVideo=false&showAd=0&show_pre=1&show_next=1&isAutoPlay=false&isDebug=false&UserID=&winType=interior&playMovie=true&MMControl=false&MMout=false&RecordCode=1001,1002,1003,1004,1005,1006,2001,3001,3002,3003,3004,3005,3007,3008,9999"></embed></object></p>
<p>The drawing explains pretty much everything.<br />
<a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/11/iphonecar1.png"><img class="size-full wp-image-389 alignnone" title="iphonecar" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/11/iphonecar1.png" alt="" width="648" height="445" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.floatingvectors.com/blog/388/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Compile PTAM&amp;PTAMM on Snow Leopard</title>
		<link>http://www.floatingvectors.com/blog/367/</link>
		<comments>http://www.floatingvectors.com/blog/367/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 14:15:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[软件[Code]]]></category>
		<category><![CDATA[AR]]></category>
		<category><![CDATA[Augmented Reality]]></category>
		<category><![CDATA[PTAM]]></category>
		<category><![CDATA[PTAMM]]></category>

		<guid isPermaLink="false">http://www.floatingvectors.com/blog/?p=367</guid>
		<description><![CDATA[1. Compile PTAM
1). Install TooN lib.
Download Toon.
-&#62;  cvs -z3 -d:pserver:anoncvs@cvs.savannah.nongnu.org:/cvsroot/toon co TooN
Make and install.
-&#62; ./configure
-&#62; make
-&#62; make install
2). Install libcvd(32bit).
a) Download libcvd.
-&#62; cvs -z3 -d:pserver:anoncvs@cvs.savannah.nongnu.org:/cvsroot/libcvd co libcvd
b) Edit cvd/gl_helpers.h. Use OpenGL/gl.h and OpenGL/glu.h.
c) Edit progs/calibrate.cxx. Replace GL_TEXTURE_RECTANGLE_NV with GL_TEXTURE_RECTANGLE_ARB.
d) Edit cvd_src/OSX/qtbuffer.cpp. Add #include &#60;vector&#62;
e) Create a new configure script configure_mac.sh:
#!/bin/bash

SDK="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
SDKLIB="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk"
export MACOSX_DEPLOYMENT_TARGET="10.5"

ARCH="-arch i386"

export CFLAGS="$ARCH $SDK -mmacosx-version-min=10.5 -I [...]]]></description>
			<content:encoded><![CDATA[<h1>1. Compile PTAM</h1>
<h2>1). Install TooN lib.</h2>
<p>Download Toon.</p>
<p>-&gt;  cvs -z3 -d:pserver:<a href="mailto:anoncvs@cvs.savannah.nongnu.org">anoncvs@cvs.savannah.nongnu.org</a>:/cvsroot/toon co <a href="http://mi.eng.cam.ac.uk/~twd20/TooNhtml/namespaceTooN.html">TooN</a></p>
<p>Make and install.</p>
<p><a href="http://mi.eng.cam.ac.uk/~twd20/TooNhtml/namespaceTooN.html"></a>-&gt; ./configure</p>
<p>-&gt; make</p>
<p>-&gt; make install</p>
<h2>2). Install libcvd(32bit).</h2>
<p>a) Download libcvd.</p>
<p>-&gt; <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">cvs -z3 -d:pserver:anoncvs@cvs.savannah.nongnu.org:/cvsroot/libcvd co libcvd</span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;">b) Edit cvd/gl_helpers.h. Use OpenGL/gl.h and OpenGL/glu.h.</span></span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;">c) Edit progs/calibrate.cxx. Replace GL_TEXTURE_RECTANGLE_NV with GL_TEXTURE_RECTANGLE_ARB.</span></span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;">d) Edit cvd_src/OSX/qtbuffer.cpp. Add #include &lt;vector&gt;</span></span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;">e) Create a new configure script configure_mac.sh:</span></span></p>
<pre><code>#!/bin/bash

SDK="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
SDKLIB="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk"
export MACOSX_DEPLOYMENT_TARGET="10.5"

ARCH="-arch i386"

export CFLAGS="$ARCH $SDK -mmacosx-version-min=10.5 -I /usr/local/include"
export CXXFLAGS="$ARCH $SDK -mmacosx-version-min=10.5 -I /usr/local/include"
export CPPFLAGS="$ARCH $SDK -mmacosx-version-min=10.5 -I /usr/local/include"
export LDFLAGS="$ARCH $SDKLIB -mmacosx-version-min=10.5 -I /usr/local/include"

CC="/usr/bin/gcc-4.2"
CXX="/usr/bin/g++-4.2"
OBJC="/usr/bin/gcc-4.2"

./configure $1 $2 $3 $4 $5 $6 $7 $8 $9
</code></pre>
<pre><span style="font-family: monospace, Monaco, 'Courier New', Courier, monospace;">f) Configure.</span></pre>
<pre><span style="font-family: monospace, Monaco, 'Courier New', Courier, monospace;">-&gt; ./configure_mac.sh --without-ffmpeg --x-libraries=/Developer/SDKs/MacOSX10.5.sdk/usr/X11/lib/ --x-includes=/Developer/SDKs/MacOSX10.5.sdk/usr/X11/include</span></pre>
<p>g)  Edit makefile.</p>
<p>Move all -L/opt/local/lib to the end of the argument list, giving priority to OSX10.5.sdk version of X11</p>
<p>h) Make and Install</p>
<p>-&gt; make</p>
<p>-&gt; install</p>
<h2>3). Install gvars3</h2>
<p>a) Download gvars3</p>
<p>-&gt; <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">cvs -z3 -d:pserver:anoncvs@cvs.savannah.nongnu.org:/cvsroot/libcvd co gvars3</span></p>
<pre>b) Copy the previous configure_mac.sh.</pre>
<pre>-&gt; sh configure_mac.sh --disable-widgets</pre>
<pre>-&gt; make</pre>
<pre>-&gt; make install</pre>
<h2>4). Compile PTAM</h2>
<pre>a) Copy /Build/OSX/Makefile and VideoSource_OSX.cc to source root directory.</pre>
<pre>b) Edit makefile. Compile 32bit.</pre>
<pre>-&gt; CC = g++ -g -O3 -arch i386</pre>
<pre>-&gt; make</pre>
<pre>-&gt; make install</pre>
<h1>2. Compile PTAMM</h1>
<p>a. Install lib3ds. Download the source. Copy configure_mac.sh. Do the same as above.</p>
<p>b. Copy PTAM/V<span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">ideoSource_OSX.cc to PTAMM. </span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">c. Copy PTAMM/Build/Linux/Makefile to PTAMM.</span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">d. Edit VideoSource_OSX.cc. Add &#8220;namespace PTAMM{&#8221; after the includes and &#8220;}&#8221; at the end.</span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;">e. Edit makefile. </span></span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;">Change &#8220;LINKFLAGS = -L MY_CUSTOM_LINK_PATH -lGVars3 -lcvd $(3DSLIB)&#8221; =&gt; &#8220;LINKFLAGS = -framework OpenGL -framework VecLib -lGVars3 -lcvd $(3DSLIB)&#8221;.</span></span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;">Change &#8220;VIDEOSOURCE = VideoSource_Linux_DV.o&#8221; =&gt; &#8220;VIDEOSOURCE = VideoSource_OSX.o&#8221;</span></span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;">f. make and install.</span></span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;">Have fun:)</span></span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;"><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/09/PTAMM.png"><img class="aligncenter size-full wp-image-376" title="PTAMM" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/09/PTAMM.png" alt="" width="580" height="452" /></a></p>
<p></span></span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;"></p>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.floatingvectors.com/blog/367/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPF path animation as opacity mask</title>
		<link>http://www.floatingvectors.com/blog/357/</link>
		<comments>http://www.floatingvectors.com/blog/357/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 15:45:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[软件[Code]]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.floatingvectors.com/blog/?p=357</guid>
		<description><![CDATA[CODE
&#60;Window x:Class=&#8221;WpfApplication1.MainWindow&#8221;
       xmlns=&#8221;http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
       xmlns:x=&#8221;http://schemas.microsoft.com/winfx/2006/xaml&#8221;
       x:Name=&#8221;Window&#8221;
       Title=&#8221;Path Opacity Mask Animation Demo&#8221;
       Width=&#8221;640&#8243; Height=&#8221;480&#8243; xmlns:System=&#8221;clr-namespace:System;assembly=mscorlib&#8221;&#62;
       &#60;Window.Resources&#62;
              &#60;Storyboard x:Key=&#8221;Timeline1&#8243;&#62;
                     &#60;DoubleAnimationUsingKeyFrames BeginTime=&#8221;00:00:00&#8243; Storyboard.TargetName=&#8221;path1&#8243;      Storyboard.TargetProperty=&#8221;(Shape.StrokeDashOffset)&#8221;&#62;
                           &#60;SplineDoubleKeyFrame KeyTime=&#8221;00:00:01&#8243; Value=&#8221;25&#8243;/&#62;
                           &#60;SplineDoubleKeyFrame KeyTime=&#8221;00:00:02&#8243; Value=&#8221;0&#8243;/&#62;
                     &#60;/DoubleAnimationUsingKeyFrames&#62;
                     &#60;DoubleAnimationUsingKeyFrames BeginTime=&#8221;00:00:00&#8243; Storyboard.TargetName=&#8221;path2&#8243;  Storyboard.TargetProperty=&#8221;(Shape.StrokeDashOffset)&#8221;&#62;
                           &#60;SplineDoubleKeyFrame KeyTime=&#8221;00:00:03&#8243; Value=&#8221;25&#8243;/&#62;
                           &#60;SplineDoubleKeyFrame KeyTime=&#8221;00:00:04&#8243; Value=&#8221;0&#8243;/&#62;
                     &#60;/DoubleAnimationUsingKeyFrames&#62;
    &#60;/Storyboard&#62;
       &#60;/Window.Resources&#62;
       &#60;Window.Triggers&#62;
              &#60;EventTrigger RoutedEvent=&#8221;FrameworkElement.Loaded&#8221;&#62;
                     &#60;BeginStoryboard Storyboard=&#8221;{StaticResource Timeline1}&#8221;/&#62;
              &#60;/EventTrigger&#62;
       &#60;/Window.Triggers&#62;
       &#60;Grid x:Name=&#8221;LayoutRoot&#8221;&#62;
              &#60;Image Source=&#8221;Hydrangeas.jpg&#8221; Stretch=&#8221;Fill&#8221;&#62;
      &#60;Image.OpacityMask&#62;
    &#60;VisualBrush&#62;
             &#60;VisualBrush.Visual&#62;
               &#60;Path [...]]]></description>
			<content:encoded><![CDATA[<p>CODE</p>
<p>&lt;Window x:Class=&#8221;WpfApplication1.MainWindow&#8221;<br />
       xmlns=&#8221;<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>&#8221;<br />
       xmlns:x=&#8221;<a href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>&#8221;<br />
       x:Name=&#8221;Window&#8221;<br />
       Title=&#8221;Path Opacity Mask Animation Demo&#8221;<br />
       Width=&#8221;640&#8243; Height=&#8221;480&#8243; xmlns:System=&#8221;clr-namespace:System;assembly=mscorlib&#8221;&gt;</p>
<p>       &lt;Window.Resources&gt;<br />
              &lt;Storyboard x:Key=&#8221;Timeline1&#8243;&gt;<br />
                     &lt;DoubleAnimationUsingKeyFrames BeginTime=&#8221;00:00:00&#8243; Storyboard.TargetName=&#8221;path1&#8243;      Storyboard.TargetProperty=&#8221;(Shape.StrokeDashOffset)&#8221;&gt;<br />
                           &lt;SplineDoubleKeyFrame KeyTime=&#8221;00:00:01&#8243; Value=&#8221;25&#8243;/&gt;<br />
                           &lt;SplineDoubleKeyFrame KeyTime=&#8221;00:00:02&#8243; Value=&#8221;0&#8243;/&gt;<br />
                     &lt;/DoubleAnimationUsingKeyFrames&gt;<br />
                     &lt;DoubleAnimationUsingKeyFrames BeginTime=&#8221;00:00:00&#8243; Storyboard.TargetName=&#8221;path2&#8243;  Storyboard.TargetProperty=&#8221;(Shape.StrokeDashOffset)&#8221;&gt;<br />
                           &lt;SplineDoubleKeyFrame KeyTime=&#8221;00:00:03&#8243; Value=&#8221;25&#8243;/&gt;<br />
                           &lt;SplineDoubleKeyFrame KeyTime=&#8221;00:00:04&#8243; Value=&#8221;0&#8243;/&gt;<br />
                     &lt;/DoubleAnimationUsingKeyFrames&gt;<br />
    &lt;/Storyboard&gt;<br />
       &lt;/Window.Resources&gt;<br />
       &lt;Window.Triggers&gt;<br />
              &lt;EventTrigger RoutedEvent=&#8221;FrameworkElement.Loaded&#8221;&gt;<br />
                     &lt;BeginStoryboard Storyboard=&#8221;{StaticResource Timeline1}&#8221;/&gt;<br />
              &lt;/EventTrigger&gt;<br />
       &lt;/Window.Triggers&gt;</p>
<p>       &lt;Grid x:Name=&#8221;LayoutRoot&#8221;&gt;<br />
              &lt;Image Source=&#8221;Hydrangeas.jpg&#8221; Stretch=&#8221;Fill&#8221;&gt;<br />
      &lt;Image.OpacityMask&gt;<br />
    &lt;VisualBrush&gt;<br />
             &lt;VisualBrush.Visual&gt;<br />
               &lt;Path x:Name=&#8221;path1&#8243; Stretch=&#8221;Fill&#8221; Stroke=&#8221;#FF000000&#8243; StrokeDashOffset=&#8221;1000&#8243; StrokeEndLineCap=&#8221;Round&#8221; StrokeStartLineCap=&#8221;Round&#8221; StrokeThickness=&#8221;20&#8243; HorizontalAlignment=&#8221;Left&#8221; Margin=&#8221;228,145.336,0,188.972&#8243; Width=&#8221;71&#8243; Data=&#8221;M294,171 C289,162 283,147 268,151 253,155 244,164.99992 244,177.00008 244,189.00024 284,196.00033 287,207.00047 290,218.00062 286,249.00103 259,250.00104 232,251.00105 235,225.00071 233,219.00063&#8243; StrokeDashArray=&#8221;25 1000&#8243;/&gt;<br />
             &lt;/VisualBrush.Visual&gt;<br />
           &lt;/VisualBrush&gt;<br />
    &lt;/Image.OpacityMask&gt;<br />
     &lt;/Image&gt;<br />
    <br />
    &lt;Path x:Name=&#8221;path2&#8243; Stretch=&#8221;Fill&#8221; Stroke=&#8221;#FF000000&#8243; StrokeDashOffset=&#8221;1000&#8243; StrokeEndLineCap=&#8221;Round&#8221; StrokeStartLineCap=&#8221;Round&#8221; StrokeThickness=&#8221;20&#8243; HorizontalAlignment=&#8221;Left&#8221; Margin=&#8221;228,145.336,0,188.972&#8243; Width=&#8221;71&#8243; Data=&#8221;M294,171 C289,162 283,147 268,151 253,155 244,164.99992 244,177.00008 244,189.00024 284,196.00033 287,207.00047 290,218.00062 286,249.00103 259,250.00104 232,251.00105 235,225.00071 233,219.00063&#8243; StrokeDashArray=&#8221;25 1000&#8243;/&gt;<br />
          <br />
  &lt;/Grid&gt;<br />
&lt;/Window&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.floatingvectors.com/blog/357/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Heatsink Calculation</title>
		<link>http://www.floatingvectors.com/blog/353/</link>
		<comments>http://www.floatingvectors.com/blog/353/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 11:15:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[电子[Electronics]]]></category>

		<guid isPermaLink="false">http://www.floatingvectors.com/blog/?p=353</guid>
		<description><![CDATA[When design power electronics, to prevent devices from overheating and damage, heatsinks are commonly used. How to calculate heatsinks is thus an issue.
The basic theory is a thermal equivalent of Ohm’s Law. For a power transistor:
T(j-a) = Pd x Rth(j-a)
T(j-a) (in degrees Celsius) is the temperature rise of the transistor above ‘ambient ’ temperature.
Pd (in [...]]]></description>
			<content:encoded><![CDATA[<p>When design power electronics, to prevent devices from overheating and damage, heatsinks are commonly used. How to calculate heatsinks is thus an issue.</p>
<p>The basic theory is a thermal equivalent of Ohm’s Law. For a power transistor:</p>
<p>T(j-a) = Pd x Rth(j-a)</p>
<p>T(j-a) (in degrees Celsius) is the temperature rise of the transistor above ‘ambient ’ temperature.</p>
<p>Pd (in watts)is the power disspipated.</p>
<p>Rth(j-a) (in degress Celsius per watt)is the total thermal resistance between the junction and the ambient.</p>
<p>A design example:</p>
<p><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/03/heatsink_selection.gif"><img class="aligncenter size-full wp-image-354" title="heatsink_selection" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/03/heatsink_selection.gif" alt="" width="640" height="400" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.floatingvectors.com/blog/353/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unity3D with Windows 7 Multitouch</title>
		<link>http://www.floatingvectors.com/blog/331/</link>
		<comments>http://www.floatingvectors.com/blog/331/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 07:08:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[软件[Code]]]></category>
		<category><![CDATA[Multitouch]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://www.floatingvectors.com/blog/?p=331</guid>
		<description><![CDATA[[There is a video that cannot be displayed in this feed. Visit the blog entry to see the video.]
Here it goes. Build Unity 3D multitouch application on Windows 7 machines.
This video demonstrates an application built with Unity 3D with Windowns 7 multitouch input.
Thanks to Unity explosion framework Detonator. Nice work!
]]></description>
			<content:encoded><![CDATA[<p>[There is a video that cannot be displayed in this feed. <a href="http://www.floatingvectors.com/blog/331/">Visit the blog entry to see the video.]</a></p>
<p>Here it goes. Build Unity 3D multitouch application on Windows 7 machines.</p>
<p>This video demonstrates an application built with Unity 3D with Windowns 7 multitouch input.</p>
<p>Thanks to Unity explosion framework <a href="http://unity3d.com/support/resources/unity-extensions/explosion-framework.html">Detonator</a>. Nice work!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.floatingvectors.com/blog/331/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://www.floatingvectors.com/blog/wp-content/uploads/2010/02/UnityWindows7Multitouch.mov" length="3904385" type="video/quicktime" />
		</item>
		<item>
		<title>Unity 3D First Try</title>
		<link>http://www.floatingvectors.com/blog/316/</link>
		<comments>http://www.floatingvectors.com/blog/316/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 02:51:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[软件[Code]]]></category>
		<category><![CDATA[Unity]]></category>

		<guid isPermaLink="false">http://www.floatingvectors.com/blog/?p=316</guid>
		<description><![CDATA[Please view the full post to see the Unity content.
This is part of a tutorial in  the book &#8220;Unity Game Development Essentials&#8221;
Use mouse and keyboard to control walk through.
Up/W: Forward
Down/S: Backward
Left/A: Left
Right/D: Right
Mouse: Look around and turn the player
]]></description>
			<content:encoded><![CDATA[<p><em>Please view the full post to see the Unity content.</em></p>
<p>This is part of a tutorial in  the book &#8220;Unity Game Development Essentials&#8221;</p>
<p>Use mouse and keyboard to control walk through.</p>
<p>Up/W: Forward</p>
<p>Down/S: Backward</p>
<p>Left/A: Left</p>
<p>Right/D: Right</p>
<p>Mouse: Look around and turn the player</p>
]]></content:encoded>
			<wfw:commentRss>http://www.floatingvectors.com/blog/316/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Motor Control Tutorial(Part I)</title>
		<link>http://www.floatingvectors.com/blog/282/</link>
		<comments>http://www.floatingvectors.com/blog/282/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 12:40:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[电子[Electronics]]]></category>
		<category><![CDATA[Motor control]]></category>

		<guid isPermaLink="false">http://www.floatingvectors.com/blog/?p=282</guid>
		<description><![CDATA[Motor Control Tutorial (Part I)
 
After working on several motor control projects, I decided to write this article about PID controller. This article will tell how to implement control loops (PID loops) in software. The hardware part will come soon.
PID Controller
A PID (proportional-integral-derivative) controller is a generic controller widely used in control systems. It calculates the [...]]]></description>
			<content:encoded><![CDATA[<h1>Motor Control Tutorial (Part I)</h1>
<p> </p>
<p>After working on several motor control projects, I decided to write this article about PID controller. This article will tell how to implement control loops (PID loops) in software. The hardware part will come soon.</p>
<p><strong>PID Controller</strong></p>
<p>A PID (proportional-integral-derivative) controller is a generic controller widely used in control systems. It calculates the difference value between a given set-point and measured value and attempts to minimize the difference.</p>
<p>The terminology “PID” tells that it includes three terms. Each term has a different effect on the controlled system. Figure 1 shows a block diagram of a basic PID controller.</p>
<p><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/basic_pid.png"><img class="aligncenter size-full wp-image-283" title="basic_pid" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/basic_pid.png" alt="" width="446" height="236" /></a> </p>
<p style="text-align: center;">Figure 1 Basic PID Controller</p>
<p>The standard mathematic form is</p>
<p><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_math.png"><img class="aligncenter size-full wp-image-284" title="pid_math" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_math.png" alt="" width="416" height="97" /></a></p>
<p>The three terms are</p>
<p><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_terms.png"><img class="aligncenter size-full wp-image-285" title="pid_terms" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_terms.png" alt="" width="416" height="109" /></a></p>
<p>Implementation of a PID controller in a MCU chip requires a discrete form however.</p>
<p><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_discrete.png"><img class="aligncenter size-full wp-image-286" title="pid_discrete" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_discrete.png" alt="" width="416" height="187" /></a></p>
<p>Where</p>
<p> T is the sample period (sec).</p>
<p> Ti is the integral period (sec).</p>
<p> Td is the derivative period (sec).</p>
<p>Then the three terms finally become</p>
<p style="text-align: center;"><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_final.png"></a><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_final1.png"><img class="aligncenter size-full wp-image-312" title="pid_final" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_final1.png" alt="" width="416" height="124" /></a></p>
<p>Integrator Anti-windup</p>
<p>There are limitations in actuators. For a system that operates over a wide range of conditions, it may happen that the control variable reaches the actuator limits. When this happens, the feedback loop is broken. The integral term will build up since the error is nonzero. The controller output will become very large. When the control input changes, it may take a long time before the integrator and the controller output come back inside the saturation range. To avoid this situation, some anti-windup correction is need.</p>
<p>Below is one way to implement anti-windup in a conventional PID controller.</p>
<p><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_antiwindup.png"><img class="aligncenter size-full wp-image-313" title="pid_antiwindup" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_antiwindup.png" alt="" width="558" height="192" /></a></p>
<p>If the actuator is saturated, the error will decrease integrator and thus prevent windup.</p>
<p><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_antiwindup_final.png"><img class="aligncenter size-full wp-image-314" title="pid_antiwindup_final" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/pid_antiwindup_final.png" alt="" width="416" height="156" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.floatingvectors.com/blog/282/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Passing Parameters</title>
		<link>http://www.floatingvectors.com/blog/276/</link>
		<comments>http://www.floatingvectors.com/blog/276/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 12:01:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[软件[Code]]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.floatingvectors.com/blog/?p=276</guid>
		<description><![CDATA[C# Passing Parameters

Passing Value-Type Parameters
A value-type variable contains its data directly as opposed to a reference-type variable, which contains a reference to its data. Therefore, passing a value-type variable to a method means passing a copy of the variable to the method. Any changes to the parameter that take place inside the method have no [...]]]></description>
			<content:encoded><![CDATA[<h1>C# Passing Parameters</h1>
<p><strong></strong></p>
<p><strong>Passing Value-Type Parameters</strong></p>
<p>A value-type variable contains its data directly as opposed to a reference-type variable, which contains a reference to its data. Therefore, passing a value-type variable to a method means passing a copy of the variable to the method. Any changes to the parameter that take place inside the method have no affect on the original data stored in the variable. If you want the called method to change the value of the parameter, you have to pass it by reference, using the ref or out keyword.</p>
<p>The following example demonstrates passing value-type parameters by value. The variable n is passed by value to the method SquareIt. Any changes that take place inside the method have no affect on the original value of the variable.</p>
<pre class="brush: c#">

class PassingValByVal
{
    static void SquareIt(int x)
    // The parameter x is passed by value.
    // Changes to x will not affect the original value of x.
    {
        x *= x;
        System.Console.WriteLine(&quot;The value inside the method: {0}&quot;, x);
    }
    static void Main()
    {
        int n = 5;
        System.Console.WriteLine(&quot;The value before calling the method: {0}&quot;, n);

        SquareIt(n);  // Passing the variable by value.
        System.Console.WriteLine(&quot;The value after calling the method: {0}&quot;, n);

        // Keep the console window open in debug mode.
        System.Console.WriteLine(&quot;Press any key to exit.&quot;);
        System.Console.ReadKey();
    }
}
/* Output:
    The value before calling the method: 5
    The value inside the method: 25
    The value after calling the method: 5
*/
</pre>
<p>The variable n, being a value type, contains its data, the value 5. When SquareIt is invoked, the contents of n are copied into the parameter x, which is squared inside the method. In Main, however, the value of n is the same, before and after calling the SquareIt method. In fact, the change that takes place inside the method only affects the local variable x.</p>
<p>The following example is the same as the previous example, except for passing the parameter using the <strong>ref</strong> keyword. The value of the parameter is changed after calling the method.</p>
<pre class="brush: c#">

class PassingValByRef
{
    static void SquareIt(ref int x)
    // The parameter x is passed by reference.
    // Changes to x will affect the original value of x.
    {
        x *= x;
        System.Console.WriteLine(&quot;The value inside the method: {0}&quot;, x);
    }
    static void Main()
    {
        int n = 5;
        System.Console.WriteLine(&quot;The value before calling the method: {0}&quot;, n);

        SquareIt(ref n);  // Passing the variable by reference.
        System.Console.WriteLine(&quot;The value after calling the method: {0}&quot;, n);

        // Keep the console window open in debug mode.
        System.Console.WriteLine(&quot;Press any key to exit.&quot;);
        System.Console.ReadKey();
    }
}
/* Output:
    The value before calling the method: 5
    The value inside the method: 25
    The value after calling the method: 25
*/
</pre>
<p><strong>Passing Reference-Type Parameters</strong></p>
<p>A variable of a reference type does not contain its data directly; it contains a reference to its data. When you pass a reference-type parameter by value, it is possible to change the data pointed to by the reference, such as the value of a class member. However, you cannot change the value of the reference itself; that is, you cannot use the same reference to allocate memory for a new class and have it persist outside the block. To do that, pass the parameter using the ref or out keyword.</p>
<p>The following example demonstrates passing a reference-type parameter, arr, by value, to a method, Change. Because the parameter is a reference to arr, it is possible to change the values of the array elements. However, the attempt to reassign the parameter to a different memory location only works inside the method and does not affect the original variable, arr.</p>
<pre class="brush: c#">

class PassingRefByVal
{
    static void Change(int[] pArray)
    {
        pArray[0] = 888;  // This change affects the original element.
        pArray = new int[5] {-3, -1, -2, -3, -4};   // This change is local.
        System.Console.WriteLine(&quot;Inside the method, the first element is: {0}&quot;, pArray[0]);
    }

    static void Main()
    {
        int[] arr = {1, 4, 5};
        System.Console.WriteLine(&quot;Inside Main, before calling the method, the first element is: {0}&quot;, arr [0]);

        Change(arr);
        System.Console.WriteLine(&quot;Inside Main, after calling the method, the first element is: {0}&quot;, arr [0]);
    }
}
/* Output:
    Inside Main, before calling the method, the first element is: 1
    Inside the method, the first element is: -3
    Inside Main, after calling the method, the first element is: 888
*/
</pre>
<p>In the preceding example, the array, arr, which is a reference type, is passed to the method without the <em>ref</em> parameter. In such a case, a copy of the reference, which points to arr, is passed to the method. The output shows that it is possible for the method to change the contents of an array element, in this case from 1 to 888. However, allocating a new portion of memory by using the new operator inside the Change method makes the variable pArray reference a new array. Thus, any changes after that will not affect the original array, arr, which is created inside Main. In fact, two arrays are created in this example, one inside Main and one inside the Change method.</p>
<p>This example is the same as the previous example, except for using the <strong>ref</strong> keyword in the method header and call. Any changes that take place in the method will affect the original variables in the calling program.</p>
<pre class="brush: c#">

class PassingRefByRef
{
    static void Change(ref int[] pArray)
    {
        // Both of the following changes will affect the original variables:
        pArray[0] = 888;
        pArray = new int[5] {-3, -1, -2, -3, -4};
        System.Console.WriteLine(&quot;Inside the method, the first element is: {0}&quot;, pArray[0]);
    }

    static void Main()
    {
        int[] arr = {1, 4, 5};
        System.Console.WriteLine(&quot;Inside Main, before calling the method, the first element is: {0}&quot;, arr[0]);

        Change(ref arr);
        System.Console.WriteLine(&quot;Inside Main, after calling the method, the first element is: {0}&quot;, arr[0]);
    }
}
/* Output:
    Inside Main, before calling the method, the first element is: 1
    Inside the method, the first element is: -3
    Inside Main, after calling the method, the first element is: -3
*/
</pre>
<p>All of the changes that take place inside the method affect the original array in Main. In fact, the original array is reallocated using the <strong>new</strong> operator. Thus, after calling the Change method, any reference to arr points to the five-element array, which is created in the Change method.</p>
<p>Swapping strings is a good example of passing reference-type parameters by reference. In the example, two strings, str1 and str2, are initialized in Main and passed to the SwapStrings method as parameters modified by the <strong>ref</strong> keyword. The two strings are swapped inside the method and inside Main as well.</p>
<pre class="brush: c#">

class SwappingStrings
 {
     static void SwapStrings(ref string s1, ref string s2)
     // The string parameter is passed by reference.
     // Any changes on parameters will affect the original variables.
     {
         string temp = s1;
         s1 = s2;
         s2 = temp;
         System.Console.WriteLine(&quot;Inside the method: {0} {1}&quot;, s1, s2);
     }

     static void Main()
     {
         string str1 = &quot;John&quot;;
         string str2 = &quot;Smith&quot;;
         System.Console.WriteLine(&quot;Inside Main, before swapping: {0} {1}&quot;, str1, str2);

         SwapStrings(ref str1, ref str2);   // Passing strings by reference
         System.Console.WriteLine(&quot;Inside Main, after swapping: {0} {1}&quot;, str1, str2);
     }
 }
 /* Output:
     Inside Main, before swapping: John Smith
     Inside the method: Smith John
     Inside Main, after swapping: Smith John
*/
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.floatingvectors.com/blog/276/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Boxing and Unboxing</title>
		<link>http://www.floatingvectors.com/blog/256/</link>
		<comments>http://www.floatingvectors.com/blog/256/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 10:33:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[软件[Code]]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.floatingvectors.com/blog/?p=256</guid>
		<description><![CDATA[C# Boxing and Unboxing
 
Boxing is the process of converting a value type to the type object or to any interface type implemented by this value type. When the CLR boxes a value type, it wraps the value inside a System.Object and stores it on the managed heap. Unboxing extracts the value type from the object.
In [...]]]></description>
			<content:encoded><![CDATA[<h1>C# Boxing and Unboxing</h1>
<p> </p>
<p>Boxing is the process of converting a value type to the type <strong>object</strong> or to any interface type implemented by this value type. When the CLR boxes a value type, it wraps the value inside a System.Object and stores it on the managed heap. Unboxing extracts the value type from the object.</p>
<p>In relation to simple assignments, boxing and unboxing are computationally expensive processes. When a value type is boxed, a new object must be allocated and constructed. To a lesser degree, the cast required for unboxing is also expensive computationally.</p>
<h2>Boxing</h2>
<p>Boxing is used to store value types in the garbage-collected heap. Boxing is an implicit conversion of a value type to the type <strong>object</strong> or to any interface type implemented by this value type. Boxing a value type allocates an object instance on the heap and copies the value into the new object.</p>
<p>Consider the following declaration of a value-type variable:</p>
<pre class="brush: c#">

int i=123;
</pre>
<p>The following statement implicitly applies the boxing operation on the variable i:</p>
<pre class="brush: c#">

object o=i;      //Implicit boxing
</pre>
<p>The result of this statement is creating an object reference o, on the stack, that references a value of the type <strong>int</strong>, on the heap. This value is a copy of the value-type value assigned to the variable i. The difference between the two variables, i and o, is illustrated in the following figure.</p>
<p><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/boxing.png"><img class="aligncenter size-full wp-image-272" title="boxing" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/boxing.png" alt="" width="250" height="170" /></a></p>
<h2>Unboxing</h2>
<p>Unboxing is an explicit conversion from the type <strong>object</strong> to a value type or from an interface type to a value type that implements the interface. An unboxing operation consists of:</p>
<p>Checking the object instance to make sure that it is a boxed value of the given value type.</p>
<p>Copying the value from the instance into the value-type variable.</p>
<p>The following statements demonstrate both boxing and unboxing operations:</p>
<pre class="brush: c#">

int  i = 123;

object o = i;  //boxing

int j = (int) o;   //unboxing
</pre>
<p>The following figure demonstrates the result of the previous statements.</p>
<p><a href="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/unboxing.png"><img class="aligncenter size-full wp-image-273" title="unboxing" src="http://www.floatingvectors.com/blog/wp-content/uploads/2010/01/unboxing.png" alt="" width="250" height="219" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.floatingvectors.com/blog/256/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

