锘??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美日韩免费在线视频,欧美h视频在线,欧美午夜国产http://m.shnenglu.com/billhsu/category/7689.htmlzh-cnTue, 01 Feb 2011 08:19:05 GMTTue, 01 Feb 2011 08:19:05 GMT60Android娓告垙璁℃椂http://m.shnenglu.com/billhsu/archive/2011/01/30/139627.htmlBill HsuBill HsuSun, 30 Jan 2011 15:16:00 GMThttp://m.shnenglu.com/billhsu/archive/2011/01/30/139627.htmlhttp://m.shnenglu.com/billhsu/comments/139627.htmlhttp://m.shnenglu.com/billhsu/archive/2011/01/30/139627.html#Feedback0http://m.shnenglu.com/billhsu/comments/commentRss/139627.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/139627.htmlhttp://androgeek.info/?p=299

浠ュ墠浠g爜緇忛獙寰堝閮芥槸鍩轟簬windows鐨勶紝鎵浠ュandroid涓嬮潰鐨勮鏃跺嚱鏁頒笉鏄お浜嗚В銆?br>
鍦ㄥ啓Friut3D鏃訛紝鎴戠敤鐨勪唬鐮佹槸鐢╣ettimeofday()鏉ヨ鏃剁殑銆備絾鏄晥鏋滀笉濂斤紝娓告垙閲屾湁涓満鏅窇璧鋒潵鍗佸垎鍗★紝acepig鍏勫拰鎴戦兘瑙夊緱榪欎釜闂寰堣寮傘傚紑濮嬭寰楄繖鏄ā鍨嬬殑闂錛岀幇鍦ㄧ湅鏉ユ槸璁℃椂鍑芥暟涓嶇簿紜児寰楃ジ銆?br>
鐪嬬湅褰撴椂鍐欑殑鑾峰彇緋葷粺鏃墮棿鐨勪唬鐮侊細(xì)

static long getTime(void)

{
gettimeofday(
&now, NULL);
return (long)(now.tv_sec*1000 + now.tv_usec/1000);
}


浠婂ぉ鍦ㄤ竴涓猤oogle璁ㄨ緇勯噷寰楃煡gettimeofday()璁板緱鐨則ick鏄笉鍑嗙‘鐨勩傝岃繖涓父鎴忛昏緫渚濊禆浜巘ime delta鏉ヨ綆楀悇涓墿浣撹繍鍔紝璁℃椂涓嶇簿紜紝娓叉煋鑷劧浼?xì)鍗逖潃?br>
浜庢槸鐢ㄧ撼縐掔駭鐨勫噯紜害鐨刢lock_gettime()閲嶅啓浜唃etTime()鍑芥暟錛?br>
static long _getTime(void)

{
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, 
&now);
return now.tv_sec*1000000 + now.tv_nsec/1000;

}


鏀逛簡璁℃椂鍑芥暟鍚庯紝娓告垙鍚勪釜鍦烘櫙閮芥祦鐣呬簡銆?br>

Bill Hsu 2011-01-30 23:16 鍙戣〃璇勮
]]>
Android NDK 寮鍙慜penGL ES 2.0涓浜涙敞鎰忕偣http://m.shnenglu.com/billhsu/archive/2010/08/10/122914.htmlBill HsuBill HsuTue, 10 Aug 2010 03:37:00 GMThttp://m.shnenglu.com/billhsu/archive/2010/08/10/122914.htmlhttp://m.shnenglu.com/billhsu/comments/122914.htmlhttp://m.shnenglu.com/billhsu/archive/2010/08/10/122914.html#Feedback1http://m.shnenglu.com/billhsu/comments/commentRss/122914.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/122914.html鑷繁涔熻瘯浜嗚瘯鐢∟DK緙栦竴涓狾penGL ES 2.0鐨勭▼搴忥紝鍙槸錛岀紪璇戠殑鏃跺欏嚭鐜頒簡涓澶у爢閿欍?br>
濡傚浘錛屾弧灞忓箷閮芥槸 undefined reference to 閭d簺OpenGL ES鍑芥暟銆?br>鐪嬫潵鏄簱鏂囦歡娌℃湁閾炬帴榪涙潵銆?br>
榪欐槸NDK渚嬪瓙閲岀殑Android.mk鐨勫啓娉曪細(xì)
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    :
= libgl2jni
LOCAL_CFLAGS    :
= -Werror
LOCAL_SRC_FILES :
= gl_code.cpp
LOCAL_LDLIBS    :
= -llog -lGLESv2

include $(BUILD_SHARED_LIBRARY)

闂灝卞嚭鍦ㄧ敤綰㈣壊鏍囧嚭鐨勯偅琛屻?br>
鎶婇偅鍙ヤ慨鏀逛負(fù)錛?br>
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
LOCAL_LDLIBS
+=-L$(SYSROOT)/usr/lib -lGLESv2

灝卞彲浠ユ甯哥紪璇戜簡銆?br>
榪樻湁涓浜涙敞鎰忕偣鏄細(xì)
緙栬瘧紼嬪簭鍓嶈clean錛屽惁鍒欑紪璇戜細(xì)鍑洪敊錛?br>姣忔鏇存柊浜嗚嚜宸辯殑.so鏂囦歡鍚庯紝鍦╡clipse鐨勯偅涓猨ava欏圭洰閲岃璁扮潃refresh涓涓嬨?br>


Bill Hsu 2010-08-10 11:37 鍙戣〃璇勮
]]>
闈犲緱浣忕殑浼戠湢鍑芥暟XSleephttp://m.shnenglu.com/billhsu/archive/2010/07/30/121679.htmlBill HsuBill HsuFri, 30 Jul 2010 02:55:00 GMThttp://m.shnenglu.com/billhsu/archive/2010/07/30/121679.htmlhttp://m.shnenglu.com/billhsu/comments/121679.htmlhttp://m.shnenglu.com/billhsu/archive/2010/07/30/121679.html#Feedback0http://m.shnenglu.com/billhsu/comments/commentRss/121679.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/121679.html浠婂ぉ鍦╟sdn涓婄湅鍒頒簡涓綃囨枃绔狅細(xì)http://blog.csdn.net/lanzhengpeng2/archive/2008/05/06/2401554.aspx
璁茬殑涔熸濂芥槸榪欎釜闂錛岃褰曚竴涓嬨?br>
鍦ㄤ嬌鐢╰imeGetTime()鐨勪唬鐮佸潡鐨勫墠鍚庡姞涓?span class="Apple-style-span" style="border-collapse: separate; color: #000000; font-family: Simsun; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;">timeBeginPeriod(1)鍜?/span>timeEndPeriod(1)錛屽氨鍙互鎻愰珮timeGetTime()鐨勭簿搴︺?br>
鍚屾椂錛屽彲浠ュ埄鐢╰imeSetEvent鍐欎簡涓涓潬寰椾綇鐨勪紤鐪犲嚱鏁癧浠g爜鏉ヨ嚜涓婅堪鏂囩珷]錛?br>
static void XSleep(DWORD dwDelay,HANDLE hEvent)
 {
  MMRESULT hTimer 
= timeSetEvent(dwDelay,1,(LPTIMECALLBACK)hEvent,0,TIME_ONESHOT | TIME_CALLBACK_EVENT_SET);
  MsgWaitForMultipleObjectsEx(
1,&hEvent,INFINITE,QS_ALLINPUT,0); //褰撴湁Windows娑堟伅鏃訛紝榪樿兘緇х畫澶勭悊Windows娑堟伅銆傛晠閫夋嫨浜嗚繖涓嚱鏁般?/span>
  timeKillEvent(hTimer);
 }

娑堟伅寰幆[浠g爜鏉ヨ嚜涓婅堪鏂囩珷]錛?br>
 MSG msg;
 DWORD dwLastTime;
 HANDLE hSleepEvent 
= CreateEvent(NULL,FALSE,FALSE,NULL);

 timeBeginPeriod(
1);

 dwLastTime 
= timeGetTime();
 
while(isActive())
 {
  
//闇瑕佷竴鐩村鐞哤indows娑堟伅鍒版棤娑堟伅澶勭悊涓烘
  for(;PeekMessage(&msg,NULL,0,0,PM_REMOVE);)
  {
   
if(msg.message == WM_QUIT)
   {
    CloseHandle(hSleepEvent);
    timeEndPeriod(
1);
    
return ;
   }
   
if(!TranslateAccelerator(msg.hwnd,hAccelTable,&msg))
   {
    TranslateMessage(
&msg);
    DispatchMessage(
&msg);
   }
  }

  DWORD FrameDelay 
= max(1,1000/max(1,GetMaxFPS()));
  DWORD dwTime 
= timeGetTime();
  
if(dwLastTime + FrameDelay > dwTime)
  {
   XSleep(dwLastTime 
+ FrameDelay - dwTime,hSleepEvent);
  }
  
else
  {
   update();
   dwLastTime 
+= ((dwTime - dwLastTime) / FrameDelay) * FrameDelay; //褰撳疄闄呭撫鏁頒弗閲嶄綆浜庨鏈熷撫鏁版椂錛岃繖孌典唬鐮佸彲浠ュ畬鎴愯煩甯у姛鑳斤紱褰撳疄闄呭撫鏁板ぇ浜庣瓑浜庨鏈熷撫鏁版椂錛岃繖孌典唬鐮佷粛鐒跺彲浠ヤ嬌甯т箣闂寸殑鏃墮棿闂撮殧鍥哄畾銆備箣鍓嶈阿Boss娌℃湁澶勭悊濂界殑涓昏灝辨槸榪欎釜銆?/span>
  }
 }

 CloseHandle(hSleepEvent);
 timeEndPeriod(
1);
榪欐牱錛屾椂闂磋宸氨浼?xì)鍦?ms涔嬪唴浜嗭紝娓告垙涔熷氨涓嶄細(xì)鎶栧姩浜嗐?br>

Bill Hsu 2010-07-30 10:55 鍙戣〃璇勮
]]>
fstream閭d簺浜?/title><link>http://m.shnenglu.com/billhsu/archive/2010/03/27/110683.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Sat, 27 Mar 2010 10:37:00 GMT</pubDate><guid>http://m.shnenglu.com/billhsu/archive/2010/03/27/110683.html</guid><wfw:comment>http://m.shnenglu.com/billhsu/comments/110683.html</wfw:comment><comments>http://m.shnenglu.com/billhsu/archive/2010/03/27/110683.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://m.shnenglu.com/billhsu/comments/commentRss/110683.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/billhsu/services/trackbacks/110683.html</trackback:ping><description><![CDATA[鎰熻fstream鏈変簺鍦版柟璁捐鐨勪笉澶悎鐞嗭紝涓嶇煡閬撴槸bug榪樻槸閭d簺鐗沊浠晠鎰忚繖鏍風(fēng)殑銆?br /><br />棣栧厛錛宖stream绔熺劧鍦ㄤ腑鏂囪礬寰勮繖縐嶄笢瑗夸笂涓嶆敮鎸侊紝緗戜笂涔熷彲浠ョ湅鍒拌澶氬疄鐜版柟娉曪紝浣嗘湁鐨勬柟娉曞叾瀹炲茍涓嶆槸澶ソ銆?br />鎴戣寰楄繖鏍峰仛鏈綆鍗曪細(xì)<br /><div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">setlocale(LC_ALL,</span><span style="color: rgb(0, 0, 0);">""</span><span style="color: rgb(0, 0, 0);">);</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">璁劇疆鎴愬綋鍓嶈璦鐜</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">ofstream聽</span><span style="color: rgb(0, 0, 255);">out</span><span style="color: rgb(0, 0, 0);">(filename);</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鎵撳紑鏂囦歡</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">setlocale(LC_CTYPE,聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">);</span></div><br />榪樻湁錛宖stream鐨刧etline涔熸湁闂錛屽浜庨偅浜沑n \r 絀鴻 浠涔堢殑閮芥病鑰冭檻錛岀敤璧鋒潵浼?xì)鍑洪敊銆?br />鍦ㄧ綉涓婄湅鍒頒竴涓嚱鏁板彲浠ュ畬緹庤В鍐寵繖涓棶棰橈細(xì)<br /><div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">聽readline(ifstream</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">聽infile,聽</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">聽textline)<br />{<br /><br /></span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(getline(infile,聽textline,聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">\n</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">))<br />{<br />聽聽</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">聽prev_pos聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鏈寮濮嬫湁鏁堝瓧絎︿綅緗?</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">聽post_pos聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鏈鍚庢湁鏁堝瓧絎︿綅緗?br />聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">涓嬮潰鐨勫驚鐜鍙ヨ兘澶熺敤textline.find_first_not_of(filter,pos)鏉ュ鐞?鍑轟簬鏁堢巼鑰冭檻鏈浣跨敤榪欐牱鐨勭畻娉?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(textline[prev_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);">聽textline[prev_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">\t</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);">聽textline[prev_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">\r</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">榪囨護(hù)寮濮嬬┖鐧?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽prev_pos</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">;<br />聽聽</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(textline[prev_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">\0</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">)<br />聽聽聽</span><span style="color: rgb(0, 0, 255);">continue</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鍋囧鏄┖鐧借鍒欏啀璇諱竴琛岃繘琛屽鐞?</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"><br />聽聽{<br />聽聽聽聽聽聽 post_pos</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">textline.length()</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽聽聽 </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(textline[post_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);">聽textline[post_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">\t</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);">聽textline[post_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">\r</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">榪囨護(hù)鏈鍚庣殑絀虹櫧</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽 {<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 post_pos</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽聽聽聽聽聽聽聽聽 }<br />聽聽聽聽聽聽 textline</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">textline.substr(prev_pos,post_pos</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">prev_pos);<br />聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鎴愬姛璇誨彇涓鏈夋晥琛?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽}<br />聽聽<br />}<br /></span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">璇誨埌鏂囨。鐨勬湯灝?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">}<br /></span></div><br />鎴戞牴鎹笂闈㈣繖涓嚱鏁?閲嶈澆浜嗕竴涓猚har* 鐗堢殑錛?br /><div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">聽readline(ifstream</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">聽infile,聽</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽textline)<br />{<br /></span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(infile.getline(textline,</span><span style="color: rgb(0, 0, 0);">32</span><span style="color: rgb(0, 0, 0);">))<br />{<br />聽聽</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">聽prev_pos聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鏈寮濮嬫湁鏁堝瓧絎︿綅緗?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">聽post_pos聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鏈鍚庢湁鏁堝瓧絎︿綅緗?聽聽</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">聽str</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">textline;<br />聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">涓嬮潰鐨勫驚鐜鍙ヨ兘澶熺敤textline.find_first_not_of(filter,pos)鏉ュ鐞?鍑轟簬鏁堢巼鑰冭檻鏈浣跨敤榪欐牱鐨勭畻娉?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(str[prev_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);">聽str[prev_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">\t</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);">聽str[prev_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">\r</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">榪囨護(hù)寮濮嬬┖鐧?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽prev_pos</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">;<br />聽聽</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(str[prev_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">\0</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">)<br />聽聽聽</span><span style="color: rgb(0, 0, 255);">continue</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鍋囧鏄┖鐧借鍒欏啀璇諱竴琛岃繘琛屽鐞?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"><br />聽聽{<br />聽聽聽聽聽聽聽聽 post_pos</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">str.length()</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽聽聽聽聽 </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(str[post_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);">聽str[post_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">\t</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);">聽str[post_pos]聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">\r</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">榪囨護(hù)鏈鍚庣殑絀虹櫧</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽 {<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽 post_pos</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽聽聽聽聽 }<br />聽聽聽聽聽聽聽聽 </span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">聽str2</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">str.substr(prev_pos,post_pos</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">prev_pos);<br />聽聽聽聽聽聽聽聽 strcpy(textline,str2.c_str());<br />聽聽聽聽聽聽聽聽 </span><span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鎴愬姛璇誨彇涓鏈夋晥琛?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽}<br />}<br /></span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">璇誨埌鏂囨。鐨勬湯灝?/span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">}</span></div><br /><br /><img src ="http://m.shnenglu.com/billhsu/aggbug/110683.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2010-03-27 18:37 <a href="http://m.shnenglu.com/billhsu/archive/2010/03/27/110683.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>GPU姘撮潰妯℃嫙http://m.shnenglu.com/billhsu/archive/2010/03/23/110376.htmlBill HsuBill HsuTue, 23 Mar 2010 12:59:00 GMThttp://m.shnenglu.com/billhsu/archive/2010/03/23/110376.htmlhttp://m.shnenglu.com/billhsu/comments/110376.htmlhttp://m.shnenglu.com/billhsu/archive/2010/03/23/110376.html#Feedback0http://m.shnenglu.com/billhsu/comments/commentRss/110376.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/110376.html

鏁堟灉姣旇緝綆鍗曪紝鍙槸妯℃嫙浜嗕笅姘撮潰鐨勫弽灝勬晥鏋溿傛姌灝勪笌Fresnel緋繪暟娌℃湁鑰冭檻銆?br />
姘撮潰妯℃嫙澶ц嚧闇瑕佸垎榪欎箞鍑犳錛?br />1.鍓鎺夋按闈互涓嬬殑欏剁偣[gpu閲岀殑clipplane瑕佹敞鎰忚漿鎹㈠埌Clip Space]錛?br />灝嗘憚鍍忔満鏀懼埌鍚屽師鎽勫儚鏈哄叧浜庢按闈㈠縐扮殑浣嶇疆錛屾瘮濡傚師鏉ユ憚鍍忔満鍦?x,y,z)錛?br />姝ゆ椂灝辮鎶婃憚鍍忔満鏀懼湪(x,-y,z)錛寀p鍚戦噺涔熻璁劇疆鎴愬悜涓嬬殑銆?br />鍐嶆妸鍦烘櫙娓叉煋鍒癛ender Target鐨勭汗鐞嗕笂(鎴戠敤鐨勭汗鐞嗗ぇ灝忔槸256*256)錛屼笉鐭ラ亾涓轟粈涔圧ender Target鐨勭汗鐞嗗ぇ灝忎笉鑳借秴榪囩獥鍙eぇ灝忥紝瓚呰繃鐨勮瘽娓叉煋浼?xì)鍑洪敊锛岀煡閬撶殑澶уぇ鍛婅瘔鎴戜竴涓嬪搱銆?br />
浜庢槸錛屽氨寰楀埌浜嗚繖鏍蜂竴涓汗鐞嗭細(xì)


2.灝嗕笂闈㈠緱鍒扮殑綰圭悊涓庢按闈㈢殑欏剁偣瀵瑰簲.
鎶奦ertex Shader涓箻榪囧彉鎹㈢煩闃靛悗鐨勫潗鏍囦紶鍒癙ixel Shader,
鍦≒S涓綆?br />
聽聽 聽聽聽聽 float2 clipspace = input.Coord.xy / input.Coord.w;
聽聽 聽聽聽聽 clipspace.x=((clipspace.x * 0.5f) + 0.5f);
聽聽 聽聽聽聽 clipspace.y = ((clipspace.y * -0.5f) + 0.5f);
聽聽 聽聽聽聽 clipspace.x=1-clipspace.x;
鏃㈠彲浠ヨ姘撮潰欏剁偣涓庣汗鐞嗗搴旓紝鐒跺悗鍐嶆兂鍔炴硶鎶婄汗鐞嗗潗鏍囨壈涔辨潵妯℃嫙姘撮潰娉㈠姩銆?br />
3.鍐嶆覆鏌撲竴嬈″満鏅氨鍙互浜嗐?br />
澶у涔熷彲浠ュ弬鑰冧笅Azure鐨勬按闈㈡覆鏌撴簮浠g爜錛?a temp_href=" http://www.azure.com.cn/article.asp?id=186" href="%20http://www.azure.com.cn/article.asp?id=186">
http://www.azure.com.cn/article.asp?id=186


Bill Hsu 2010-03-23 20:59 鍙戣〃璇勮
]]>
鍙紪紼嬬閬撲笅鐨勫壀瑁佸鉤闈?/title><link>http://m.shnenglu.com/billhsu/archive/2010/01/20/106088.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Wed, 20 Jan 2010 14:00:00 GMT</pubDate><guid>http://m.shnenglu.com/billhsu/archive/2010/01/20/106088.html</guid><wfw:comment>http://m.shnenglu.com/billhsu/comments/106088.html</wfw:comment><comments>http://m.shnenglu.com/billhsu/archive/2010/01/20/106088.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://m.shnenglu.com/billhsu/comments/commentRss/106088.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/billhsu/services/trackbacks/106088.html</trackback:ping><description><![CDATA[ <p class="MsoNormal"> <span>鍓騫抽潰</span> <span>(Clip Plane)</span> <span>鍦ㄥ浘褰㈠棰嗗煙鏈夌潃閲嶈鐨勪綔鐢紝姣斿姘撮潰妯℃嫙涓紝娓叉煋鎶樺皠綰圭悊鏃訛紝鎴戜滑灝卞繀欏誨皢姘撮潰浠ヤ笂鐨勯《鐐歸氳繃鍓騫抽潰鍓鎺夈?/span> </p> <p class="MsoNormal"> <span>鍦ㄨ繃鍘葷殑鍥哄畾娓叉煋綆¢亾鏃朵唬錛屽壀瑁佸鉤闈㈢殑瀹炵幇杈冧負(fù)綆鍗曪紝姣斿鍦?/span> <span>DirectX 9</span> <span>涓紝鍙互鍏堣瀹氬壀瑁佸鉤闈㈠湪涓栫晫鍧愭爣緋諱笅鐨勬柟紼?/span> <span>(ax+by+cz+d=0)</span> <span>錛屽啀璋冪敤</span> <span>SetClipPlane(DWORD Index,CONST float * pPlane)</span> <span>榪欎釜</span> <span>API</span> <span>鍑芥暟灝卞彲浠ヤ簡銆?/span> </p> <p class="MsoNormal"> <span>聽</span> </p> <p class="MsoNormal"> <span>闄勪笂渚嬪瓙紼嬪簭錛?/span> </p> <p class="MsoNormal" style="background: none repeat scroll 0% 0% rgb(238, 238, 238); text-align: left; -moz-background-inline-policy: continuous;" align="left"> <span style="font-size: 10pt; color: black;">vPosition=D3DXVECTOR3(0,0,0);</span> <span style="font-size: 10pt; color: green;">//</span> <span style="font-size: 10pt; color: green;">騫抽潰涓婁竴涓偣<span><br /></span></span> <span style="font-size: 10pt; color: black;">vNormal=D3DXVECTOR3(0,1,0);</span> <span style="font-size: 10pt; color: green;">//</span> <span style="font-size: 10pt; color: green;">娉曞悜閲?span><br /></span></span> <span style="font-size: 10pt; color: black;">D3DXPlaneFromPointNormal(聽&clipplane,聽&vPosition,聽&vNormal聽);</span> <span style="font-size: 10pt; color: green;">//</span> <span style="font-size: 10pt; color: green;">鐢熸垚鍓騫抽潰<span><br /></span></span> <span style="font-size: 10pt; color: black;"> <br /> m_pDevice()->SetClipPlane(聽0,聽(</span> <span style="font-size: 10pt; color: blue;">float</span> <span style="font-size: 10pt; color: black;">*)clipplane);聽</span> </p> <p class="MsoNormal"> <span>聽</span> </p> <p class="MsoNormal"> <span>鐒惰岋紝鍦ㄧ幇鍦ㄧ殑鍙紪紼嬬閬?/span> <span>(programmable pipeline)</span> <span>涓嬶紝璁劇疆鐨勫壀瑁佸鉤闈細(xì)琚湪鍓鍧愭爣緋諱笅澶勭悊錛岃屼笉鏄湪涓栫晫鍧愭爣緋諱笅銆?/span> </p> 瑙e喅榪欎釜闂鐨勬柟娉曟湁錛?br /><br /> 1錛壜?緇欒鍓鐨勯《鐐瑰仛鏍囪錛屽湪Pixel Shader涓妸瀹冨壀瑁佹帀銆?br /><br /> 2錛壜?浣跨敤榪戞枩騫抽潰瑁佸壀錛圤blique Near-Plane Clipping錛夛紝鍗充慨鏀規(guī)姇褰辯煩闃碉紝灝嗚鍓鐨勯《鐐規(guī)斁鍦ㄨ鎴綋涔嬪錛屼粠鑰岄伩鍏嶄簡璇ラ《鐐圭殑緇樺埗銆?br /><br /> 3錛壜?淇敼騫抽潰鏂圭▼錛屼嬌涔嬩粠涓栫晫鍧愭爣緋昏漿鎹㈠埌鍓鍧愭爣緋匯?span><br /><br /><br /> 涓婅堪鏂規(guī)硶涓紝絎竴縐嶅拰絎簩縐嶆晥鐜囧茍涓嶉珮錛氬湪</span><span>Pixel Shader</span><span>涓壀瑁佹病鏈夊噺灝戜換浣曚笉蹇呰鐨勯《鐐瑰鐞嗭紝鑰岃綆楄繎鏂滃鉤闈㈣鍓煩闃佃緝涓虹箒鐞愩傛墍浠ワ紝鏂規(guī)硶涓夋槸鏈浣抽夋嫨銆?/span><p class="MsoNormal"><span>聽</span><span>瑕佸皢涓涓鉤闈粠涓栫晫鍧愭爣緋昏漿鎹㈠埌鍓鍧愭爣緋伙紝蹇呴』姹傚嚭榪欎釜鍙樻崲鐭╅樀銆?/span></p><p class="MsoNormal"><span>璁懼鉤闈㈡柟紼?/span><span>ax+by+cz+d=0</span><span>錛岀敤涓涓?/span><span>4</span><span>緇村悜閲忔潵</span><span>n</span><span>琛ㄧず</span><span>(a,b,c,d)</span><span>錛岃騫抽潰涓婃湁涓偣</span><span>p:(x,y,z,1)</span><span>銆傛牴鎹鉤闈㈡柟紼嬬殑瀹氫箟錛屾湁錛?/span></p><p class="MsoNormal"><span><br /></span></p><p class="MsoNormal"><strong>n</strong><sup>T</sup><strong>p</strong> = ax + by + cz + d = 0</p><p class="MsoNormal"></p><p class="MsoNormal"><span>璁劇煩闃?/span><span>R</span><span>鍙互璁╃偣</span><span>P</span><span>浠庝笘鐣屽潗鏍囩郴杞崲鍒板壀瑁佸潗鏍囩郴錛岀煩闃?/span><span>Q</span><span>鍙互璁╁鉤闈?/span><span>n</span><span>瀹炵幇鍚屾牱鐨勫彉鎹€傞偅涔堬紝鏈夛細(xì)</span></p><p class="MsoNormal" style="text-align: center;" align="center"></p><div align="left"><strong>p</strong>'= <strong>R</strong><strong>p</strong></div><div align="left"><strong>n'</strong>= <strong>Q</strong><strong>n</strong></div><p class="MsoNormal"><span>鍏朵腑</span><span>p'</span><span>銆?/span><span>n'</span><span>鍒嗗埆鏄漿鎹㈠悗鐨勭偣涓庡鉤闈€?/span></p><br /><div align="left"><strong>n</strong><span>'</span><sup>T</sup><strong>p'</strong>= 0</div><div align="left">(<strong>Q</strong><strong>n</strong>)<sup>T</sup> (<strong>R</strong><strong>p</strong>) = 0 <br /><strong>n</strong><sup>T</sup><strong>Q</strong><sup>T</sup><strong>R</strong><strong>p</strong> = 0<br /><br /><br /><span>濡傛灉錛?/span><strong>Q</strong><sup>T</sup><strong>R</strong> = <strong>I</strong></div><br /><p class="MsoNormal"><span>閭d箞錛?/span></p><p class="MsoNormal"><strong>n</strong><sup>T</sup><strong>Q</strong><sup>T</sup><strong>R</strong><strong>p</strong> = <strong>n</strong><sup>T</sup><strong>I</strong><strong>p</strong> = <strong>n</strong><sup>T</sup><strong>p</strong> = 0</p><p class="MsoNormal"><span>浜庢槸錛?/span></p><div align="left"><strong>Q</strong><sup>T</sup> = <strong>R</strong><sup>-1</sup><strong><br /> Q</strong> = (<strong>R</strong><sup>-1</sup>)<sup>T</sup></div><br /><p class="MsoNormal"><span>鍦?/span><span>DirectX 3D</span><span>涓紝灝嗕竴涓偣浠庝笘鐣屽潗鏍囩郴杞崲鍒板壀瑁佸潗鏍囩郴錛屾墍鐢ㄧ殑鐭╅樀涓鴻瀵熺煩闃典笌鎶曞獎鐭╅樀鐨勪箻縐紝鍗籌細(xì)</span></p><p class="MsoNormal" style="background: none repeat scroll 0% 0% rgb(238, 238, 238); -moz-background-inline-policy: continuous;"><span style="font-size: 10pt; color: black;">D3DXMATRIX聽聽TranMatrix聽=聽matView*matProj;</span></p><p class="MsoNormal"><span style="font-size: 9pt;">(TranMatrix</span><span style="font-size: 9pt;">涓烘墍姹傜殑鍙樻崲鐭╅樀錛?span>matView</span>鍜?span>matProj</span>鍒嗗埆涓?/span><span>瑙傚療鐭╅樀涓庢姇褰辯煩闃?/span><span>)</span></p><p class="MsoNormal"><span>聽</span></p><p class="MsoNormal"><span>闄勪笂鍦?/span><span>D3D</span><span>涓彉鎹㈢殑瀹屾暣浠g爜錛?/span></p><p class="MsoNormal" style="background: none repeat scroll 0% 0% rgb(238, 238, 238); text-align: left; -moz-background-inline-policy: continuous;" align="left"><span style="font-size: 10pt; color: black;">D3DXPLANE聽tempPlane聽=聽clipplane;<br /> D3DXPlaneNormalize(&tempPlane,聽&tempPlane);<br /><br /> D3DXMATRIX聽聽TranMatrix聽=聽matView*matProj;<br /> D3DXMatrixInverse(&TranMatrix,聽NULL,聽&TranMatrix);<br /> D3DXMatrixTranspose(&TranMatrix,聽&TranMatrix);<br /> D3DXPlaneTransform(&tempPlane,聽&tempPlane,聽&TranMatrix);</span></p><p class="MsoNormal" style="background: none repeat scroll 0% 0% rgb(238, 238, 238); text-align: left; -moz-background-inline-policy: continuous;" align="left"></p><p class="MsoNormal"></p><p class="MsoNormal"><span>鍙傝冭祫鏂欙細(xì)</span></p><p class="MsoNormal"><span>1.Back Face Culling Notes ,Jordan Smith (University of California, Berkeley)<br /></span></p><p class="MsoNormal"><span>http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/backfacecull.shtml</span>聽</p><p class="MsoNormal">2.GameDev Forum</p><p class="MsoNormal">http://www.gamedev.net/community/forums/topic.asp?topic_id=402381</p><p class="MsoNormal">3.Oblique Near-Plane Clipping with Orthographic Camera ,Aras</p><p class="MsoNormal">http://aras-p.info/texts/obliqueortho.html</p><img src ="http://m.shnenglu.com/billhsu/aggbug/106088.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2010-01-20 22:00 <a href="http://m.shnenglu.com/billhsu/archive/2010/01/20/106088.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鐭╅樀姹傞嗕唬鐮?/title><link>http://m.shnenglu.com/billhsu/archive/2009/12/11/103010.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Fri, 11 Dec 2009 14:23:00 GMT</pubDate><guid>http://m.shnenglu.com/billhsu/archive/2009/12/11/103010.html</guid><wfw:comment>http://m.shnenglu.com/billhsu/comments/103010.html</wfw:comment><comments>http://m.shnenglu.com/billhsu/archive/2009/12/11/103010.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://m.shnenglu.com/billhsu/comments/commentRss/103010.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/billhsu/services/trackbacks/103010.html</trackback:ping><description><![CDATA[     鎽樿: 鎰熻綰挎т唬鏁頒綔涓氶噷涓鐩村皯涓嶄簡鐭╅樀姹傞嗭紝 <br> <br>鍐欎釜甯﹁緭鍑虹畻閫嗙煩闃電殑姝ラ鐨勭煩闃墊眰閫嗙▼搴忥紝甯屾湜緇欏嵆灝嗘垨姝e湪瀛︾嚎浠g殑鍚屽涓鐐規(guī)柟渚褲?nbsp; <a href='http://m.shnenglu.com/billhsu/archive/2009/12/11/103010.html'>闃呰鍏ㄦ枃</a><img src ="http://m.shnenglu.com/billhsu/aggbug/103010.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2009-12-11 22:23 <a href="http://m.shnenglu.com/billhsu/archive/2009/12/11/103010.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍙戞棩蹇楃邯蹇祣~絎竴嬈″啓瀵煎嚭鎻掍歡http://m.shnenglu.com/billhsu/archive/2009/11/25/101921.htmlBill HsuBill HsuWed, 25 Nov 2009 11:25:00 GMThttp://m.shnenglu.com/billhsu/archive/2009/11/25/101921.htmlhttp://m.shnenglu.com/billhsu/comments/101921.htmlhttp://m.shnenglu.com/billhsu/archive/2009/11/25/101921.html#Feedback2http://m.shnenglu.com/billhsu/comments/commentRss/101921.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/101921.html

浠婂ぉ緇堜簬鎶婃ā鍨嬪鍑烘彃浠舵渶鍩烘湰鐨勫姛鑳?-瀵煎嚭緗戞牸緇欏啓濂戒簡銆?/p>

c++鍜宮ax sdk涓璧風(fēng)敤鐨勬劅瑙夊緢鎬紝緋葷粺宕╂簝浜哊嬈★紝涓嶈繃錛屾葷畻鑳藉鍑虹綉鏍間簡~

鏈夊浘鏈夌湡鐩革紝鎴浘綰康

(娉ㄦ剰錛氭ā鍨嬫槸浠巚alue鐨刢sol涓紕鍑烘潵鐨?

鍦╠3d涓覆鏌撳鍑虹殑妯″瀷顱

鍦╠3d涓覆鏌撳鍑虹殑妯″瀷顱


鎴戠殑妯″瀷瀵煎嚭鎻掍歡顱

瀵煎嚭鏁版嵁鏍鋒湰錛?/p>

[榪欐槸涓涓甫璐村浘鐨勭珛鏂逛綋鐨勫鍑烘暟鎹甝

8//銆銆8涓《鐐?br /> -6.70302 -21.2068 -5.46039
17.1883 -6.46757 0.162097
-22.4049 2.22378 -0.162097
1.48644 16.963 5.46039
-8.48039 -28.3257 20.7542
15.411 -13.5865 26.3767
-24.1823 -4.89514 26.0525
-0.290929 9.84411 31.675

12//銆銆12涓汗鐞嗗潗鏍?br /> 0 1 0
1 1 0
0 0 0
1 0 0
0 1 0
1 1 0
0 0 0
1 0 0
0 1 0
1 1 0
0 0 0
1 0 0

12//銆銆12涓潰寮曠儲
0 9 2 11 3 10
3 10 1 8 0 9
4 8 5 9 7 11
7 11 6 10 4 8
0 4 1 5 5 7
5 7 4 6 0 4
1 0 3 1 7 3
7 3 5 2 1 0
3 4 2 5 6 7
6 7 7 6 3 4
2 0 0 1 4 3
4 3 6 2 2 0



Bill Hsu 2009-11-25 19:25 鍙戣〃璇勮
]]>
DirectX 3D 璁懼涓㈠け(lost device)鐨勫鐞?/title><link>http://m.shnenglu.com/billhsu/archive/2009/10/17/98823.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Sat, 17 Oct 2009 05:10:00 GMT</pubDate><guid>http://m.shnenglu.com/billhsu/archive/2009/10/17/98823.html</guid><wfw:comment>http://m.shnenglu.com/billhsu/comments/98823.html</wfw:comment><comments>http://m.shnenglu.com/billhsu/archive/2009/10/17/98823.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://m.shnenglu.com/billhsu/comments/commentRss/98823.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/billhsu/services/trackbacks/98823.html</trackback:ping><description><![CDATA[ <font color="#000000"> 浣庢墜浜ゆ祦錛岄珮鎵嬪嬁鍏?br /><br />褰撳垵瑙夊緱DX涓澶囦涪澶卞緢璁ㄥ帉錛屽樊鐐瑰氨鎶曞OpenGL浜嗐?br /> 涓嶈繃鐜板湪鍙戠幇鍏跺疄涔熸病閭d箞楹葷儲鍟︼紝鍐欑偣涓滆タ錛岀粰涓嶆竻妤?/font> <font color="#000000">璁懼涓㈠け鎬庝箞澶勭悊鐨勫悓瀛﹀弬鑰冧笅銆?br /><br /></font>鍦ㄥ垱寤烘椂浣跨敤D3DPOOL_MANAGED鏍囧織鐨勮祫婧愬彲浠ヤ笉闇瑕侀噸鏂拌澆鍏ワ紝浣咲3DPOOL_DEFAULT鍔犺澆鐨勮祫婧愬氨闇瑕佸厛閲婃斁錛屽悗閲嶅緩銆?br /><br />閫氬父闇瑕佽繖鏍峰鐞嗙殑鏈塈D3DXFont鍜孖D3DXSprite錛岃?X妯″瀷浠涔堢殑灝變笉闇瑕併?br />鍦ㄥ彂鐜拌澶囦涪澶辨椂錛屾垜浠璋冪敤 <span style="color: rgb(0, 0, 0);">OnLostDevice(</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">)</span>鍑芥暟璁〥3DPOOL_DEFAULT鍔犺澆鐨勮祫婧愰噴鏀炬帀銆?br />濂藉湪ID3DXFont鍜孖D3DXSprite鏈夎澶囦涪澶卞鐞嗗嚱鏁幫紝鐩存帴璋冪敤灝卞ソ浜?div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">聽OnLostDevice(</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">)<br />{<br /></span><span style="color: rgb(0, 0, 0);">聽聽聽 m_sprite</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">OnLostDevice();</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽m_font</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">OnLostDevice();<br />}<br /></span></div><br />鍙槸錛屾庝箞鐭ラ亾璁懼涓㈠け浜嗗憿錛?br />濡傛灉璁懼涓㈠け錛孭resent()鍑芥暟灝變細(xì)鈥滃嚭闂鈥濓紝榪斿洖鍊兼槸D3DERR_DEVICELOST銆?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">EndScene();<br /><br />HRESULT聽hr;<br />hr聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">Present(NULL,聽NULL,聽NULL,聽NULL);<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(hr聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽D3DERR_DEVICELOST)<br />{<br />聽聽聽 </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">TestCooperativeLevel()聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽D3DERR_DEVICENOTRESET)<br />聽聽聽 {<br />聽聽聽聽聽聽聽 OnLostDevice();<br />聽聽聽聽聽聽聽 OnResetDevice();<br />聽聽聽 }<br />}</span></div><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">TestCooperativeLevel()</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽D3DERR_DEVICENOTRESET鏃訛紝灝卞彲浠ユ仮澶嶈澶囦簡銆?br />浜庢槸錛屾垜浠皟鐢?/span><span style="color: rgb(0, 0, 0);">OnLostDevice(</span><span style="color: rgb(0, 0, 0);">)</span>璁〥3DPOOL_DEFAULT鍔犺澆鐨勮祫婧愰噴鏀炬帀錛屼箣鍚庯紝璋冪敤<span style="color: rgb(0, 0, 0);">OnResetDevice()鏉ユ仮澶嶈澶囧氨鍙互浜嗐?br /><br />鎬庝箞鎭㈠璁懼鍛紵<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">聽OnResetDevice(</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">)<br />{<br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(FAILED(m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">Reset(</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">d3dpp)))<br />聽聽聽聽{<br />聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽}<br /><br />聽聽聽聽m_sprite</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">OnResetDevice();<br />聽聽聽聽m_font</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">OnResetDevice();<br /><br />聽聽聽聽InitDevice();<br />}</span></div>鍏堣D3D璁懼reset錛岀劧鍚庤皟鐢?/span>ID3DXFont鍜孖D3DXSprite鐨勬仮澶嶅嚱鏁幫紝鏈鍚庯紝闇瑕佹妸<span style="color: rgb(0, 0, 0);">D3D璁懼涓殑鐘舵佸晩錛岀煩闃靛彉鎹㈠晩榪欎簺閲嶆柊璁劇疆涓嬪氨瀹屾垚浜嗭紝涔熷氨鏄皟鐢?/span><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">InitDevice()銆?br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">聽InitDevice()<br />{<br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetRenderState(聽D3DRS_ZENABLE,聽TRUE聽);<br /><br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetRenderState(聽D3DRS_AMBIENT,聽</span><span style="color: rgb(0, 0, 0);">0xffffffff</span><span style="color: rgb(0, 0, 0);">聽);<br /><br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetSamplerState(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽D3DSAMP_MAGFILTER,聽D3DTEXF_LINEAR);<br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetSamplerState(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽D3DSAMP_MINFILTER,聽D3DTEXF_LINEAR);<br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetSamplerState(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,聽D3DSAMP_MIPFILTER,聽D3DTEXF_POINT);<br /><br />D3DXMatrixPerspectiveFovLH(聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">matProj,聽D3DX_PI</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">1.0f</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">1.0f</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">1000.0f</span><span style="color: rgb(0, 0, 0);">聽);<br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetTransform(聽D3DTS_PROJECTION,聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">matProj聽);<br /><br />vEyeVec</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">D3DXVECTOR3(</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1.0f</span><span style="color: rgb(0, 0, 0);">);<br />vLookatVec</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">D3DXVECTOR3(</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">);<br />vUpVec</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">D3DXVECTOR3(</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">1.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">);<br />D3DXMatrixLookAtLH(聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">matView,聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">vEyeVec,聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">vLookatVec,聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">vUpVec聽);<br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetTransform(聽D3DTS_VIEW,聽</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">matView聽);<br /><br />}</span></div><br /></span></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);"><br /></span><font color="#000000">鍟婏紝榪欐牱璁懼涓㈠け灝卞鐞嗗ソ浜?br /><br />//<br /></font><font color="#ffffff">tag:DirectX 3D聽 d3d lost device TestCooperativeLevel OnLostDevice</font><font color="#ffffff"> 鎭㈠璁懼 璁懼涓㈠け DeviceLost</font><font color="#000000"><br /></font><br /><img src ="http://m.shnenglu.com/billhsu/aggbug/98823.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2009-10-17 13:10 <a href="http://m.shnenglu.com/billhsu/archive/2009/10/17/98823.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鑷繁鍐欑殑Rap3d 寮曟搸 寮婧愬彂甯冨暒http://m.shnenglu.com/billhsu/archive/2009/07/25/91123.htmlBill HsuBill HsuSat, 25 Jul 2009 07:00:00 GMThttp://m.shnenglu.com/billhsu/archive/2009/07/25/91123.htmlhttp://m.shnenglu.com/billhsu/comments/91123.htmlhttp://m.shnenglu.com/billhsu/archive/2009/07/25/91123.html#Feedback5http://m.shnenglu.com/billhsu/comments/commentRss/91123.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/91123.html鎴戝湪sourceforge涓婄敵璇蜂簡寮婧愰」鐩紝鍦ㄩ偅閲屽彲浠ヤ笅杞藉埌Rap3d SDK.
http://rap3d.sf.net/

Rap3d SDK 涓湁寮曟搸鐨勪嬌鐢ㄨ鏄庡拰鍑犱釜渚嬪瓙錛屼笂鎵嬪緢蹇殑銆?br />

What Rap3d can do?

1.Display 3d models

2.Bill Board,Sprite,Animation..

3.Music playing

4.Draw text on screen

http://rap3d.sf.net/




Bill Hsu 2009-07-25 15:00 鍙戣〃璇勮
]]>
Rap3d鏇存柊http://m.shnenglu.com/billhsu/archive/2009/06/23/88346.htmlBill HsuBill HsuTue, 23 Jun 2009 02:12:00 GMThttp://m.shnenglu.com/billhsu/archive/2009/06/23/88346.htmlhttp://m.shnenglu.com/billhsu/comments/88346.htmlhttp://m.shnenglu.com/billhsu/archive/2009/06/23/88346.html#Feedback1http://m.shnenglu.com/billhsu/comments/commentRss/88346.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/88346.html
澧炲姞浜?TextureManager鍜?
BillBoard鍔ㄧ敾鎾斁,鏂逛究娓叉煋鐖嗙偢鏁堟灉


Bill Hsu 2009-06-23 10:12 鍙戣〃璇勮
]]>
娓告垙涓瑿PU浣跨敤鐜囩殑鎺у埗http://m.shnenglu.com/billhsu/archive/2009/06/12/87472.htmlBill HsuBill HsuFri, 12 Jun 2009 04:00:00 GMThttp://m.shnenglu.com/billhsu/archive/2009/06/12/87472.htmlhttp://m.shnenglu.com/billhsu/comments/87472.htmlhttp://m.shnenglu.com/billhsu/archive/2009/06/12/87472.html#Feedback18http://m.shnenglu.com/billhsu/comments/commentRss/87472.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/87472.html搴旇鐢⊿leep(1)鎶婂浣欑殑鐗囨榪樼粰C(jī)PU,
鍍忚繖鏍鳳細(xì)
while(true)
{
DWORD聽start_time聽
=聽GetTickCount();
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if聽(msg.message聽==聽WM_QUIT)聽break;
TranslateMessage(
&msg);
DispatchMessage(
&msg);
}

update(float(GetTickCount()聽-聽start_time));
while((GetTickCount()聽-聽start_time)聽<30)聽Sleep(1);
}

update(float timeDelta)鏄父鎴忛昏緫涓庣敾闈㈡洿鏂扮殑鍑芥暟銆?br />鏁堟灉鍥撅細(xì)



Bill Hsu 2009-06-12 12:00 鍙戣〃璇勮
]]>
3D寮曟搸璁″垝http://m.shnenglu.com/billhsu/archive/2009/06/10/87356.htmlBill HsuBill HsuWed, 10 Jun 2009 13:15:00 GMThttp://m.shnenglu.com/billhsu/archive/2009/06/10/87356.htmlhttp://m.shnenglu.com/billhsu/comments/87356.htmlhttp://m.shnenglu.com/billhsu/archive/2009/06/10/87356.html#Feedback0http://m.shnenglu.com/billhsu/comments/commentRss/87356.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/87356.html 鍏跺疄涔熷氨鏄妸涓浜涚被灝佽涓涓嬶紝璁╁紑鍙戞洿綆緇擄紝浠ュ紑婧愬拰瀹炵敤涓虹涓鍑嗗垯銆?br />



Bill Hsu 2009-06-10 21:15 鍙戣〃璇勮
]]>
鐢℅DI瀹炵幇3Dhttp://m.shnenglu.com/billhsu/archive/2008/12/27/70517.htmlBill HsuBill HsuSat, 27 Dec 2008 09:18:00 GMThttp://m.shnenglu.com/billhsu/archive/2008/12/27/70517.htmlhttp://m.shnenglu.com/billhsu/comments/70517.htmlhttp://m.shnenglu.com/billhsu/archive/2008/12/27/70517.html#Feedback1http://m.shnenglu.com/billhsu/comments/commentRss/70517.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/70517.html
涓嶈繃鎯蟲兂鐪嬶紝濂藉儚瀹炵幇璧鋒潵涔熷茍涓嶉毦銆傘傘?br />鍜屾墍鏈夊熀紜鐨?D紼嬪簭涓鏍鳳紝鍏堟妸瑙嗘鍙樻崲涓哄崟浣嶇珛鏂逛綋錛?br />3_thumb.jpg
鍙樻崲鐭╅樀涓猴細(xì)
5.jpg

褰撶劧錛孌irectX鍜孫penGL閲岄兘鏈夌幇鎴愮殑鍑芥暟錛?br />
//OpenGL
void聽gluPerspective(GLdouble聽fovy,
聽聽聽聽GLdouble聽aspect,
聽聽聽聽GLdouble聽zNear,
聽聽聽聽GLdouble聽zFar);

//DirectX
D3DXMatrixPerspectiveFovLH(聽D3DXMATRIX聽*pOut,
聽聽聽聽FLOAT聽fovY,
聽聽聽聽FLOAT聽Aspect,
聽聽聽聽FLOAT聽zn,
聽聽聽聽FLOAT聽zf
);聽

鍗曚綅绔嬫柟浣撲腑鐨勭偣姝d氦鎶曞獎寰楀埌鐨?x,y,z)*瑙嗗彛鍙樻崲鐭╅樀 寰楀埌 (x',y',z')銆?br />(x',y')瀵瑰簲灞忓箷鐐癸紝z'涓哄叾娣卞害錛岀敤浜庣偣鐨勭珵浜夈?br />鎶婃瘡涓笁瑙掗潰鍖歸厤綰圭悊鐢℅DI鍩烘湰鍑芥暟鐢誨嚭鏉ュ氨鍙互浜嗐?br />

CSDN鐨勯偅涓▼搴?br />rtwtsdgdg.JPG



Bill Hsu 2008-12-27 17:18 鍙戣〃璇勮
]]>
A* (A-star A鏄?瀵昏礬綆楁硶http://m.shnenglu.com/billhsu/archive/2008/11/01/65700.htmlBill HsuBill HsuSat, 01 Nov 2008 10:19:00 GMThttp://m.shnenglu.com/billhsu/archive/2008/11/01/65700.htmlhttp://m.shnenglu.com/billhsu/comments/65700.htmlhttp://m.shnenglu.com/billhsu/archive/2008/11/01/65700.html#Feedback0http://m.shnenglu.com/billhsu/comments/commentRss/65700.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/65700.html浠旂粏鐪嬩簡鐪媑amedev.net鐨勪竴鐗囨枃绔?A* Pathfinding for Beginners http://www.gamedev.net/reference/articles/article2003.asp )錛屽A*鏇翠簡瑙d簡涓鐐癸紝鍐欑偣涓滆タ璁板綍涓涓嬨?br />A*鏄竴縐嶅惎鍙戝紡鐨勭畻娉曪紝鎵璋撶殑"鍚彂寮?錛屽氨鏄姣忎竴涓悳绱㈢殑浣嶇疆榪涜璇勪及錛屼篃灝辨槸鎶婃壘鐨勪綅緗鐩爣鐨勮窛紱誨綋鎴愭壘鐐圭殑涓涓緷鎹紝鐒跺悗鐚滄祴榪欎釜鐐規(guī)槸鍚︽渶浣?"鍚彂寮?灝辨槸鐚滄祴)銆?br />
image001.jpg

涓轟簡鎵懼埌鏈浣崇殑閭d釜鐐?br />鍙互瑙勫畾錛?br />G = 浠庤搗鐐癸紝娌跨潃浜х敓鐨勮礬寰勶紝縐誨姩鍒扮綉鏍間笂鎸囧畾鏂規(guī)牸鐨勮窛紱匯?br />H = 浠庣綉鏍間笂閭d釜鏂規(guī)牸縐誨姩鍒扮粓鐐笲鐨勯浼扮Щ鍔ㄨ窛紱匯?br />
F = G + H
F鏈灝忕殑鐐瑰彲浠ヨ涓烘槸璇ラ夌殑鐐廣?br />
寮曠敤涓涓嬪師鏂囩殑緲昏瘧錛?br />鎴戜滑浠ゆ按騫蟲垨鑰呭瀭鐩寸Щ鍔ㄧ殑鑰楄垂涓?0錛屽瑙掔嚎鏂瑰悜鑰楄垂涓?4銆傛垜浠彇榪欎簺鍊兼槸鍥犱負(fù)娌垮瑙掔嚎鐨勮窛紱繪槸娌挎按騫蟲垨鍨傜洿縐誨姩鑰楄垂鐨勭殑鏍瑰彿2錛堝埆鎬曪級錛屾垨鑰呯害1.414鍊嶃備負(fù)浜嗙畝鍖栵紝鎴戜滑鐢?0鍜?4榪戜技銆傛瘮渚嬪熀鏈紜紝鍚屾椂鎴戜滑閬垮厤浜嗘眰鏍硅繍綆楀拰灝忔暟銆?br />

鏃㈢劧鎴戜滑鍦ㄨ綆楁部鐗瑰畾璺緞閫氬線鏌愪釜鏂規(guī)牸鐨凣鍊鹼紝姹傚肩殑鏂規(guī)硶灝辨槸鍙栧畠鐖惰妭鐐圭殑G鍊鹼紝鐒跺悗渚濈収瀹冪浉瀵圭埗鑺傜偣鏄瑙掔嚎鏂瑰悜鎴栬呯洿瑙掓柟鍚?闈炲瑙掔嚎)錛屽垎鍒鍔?4鍜?0銆備緥瀛愪腑榪欎釜鏂規(guī)硶鐨勯渶姹備細(xì)鍙樺緱鏇村錛屽洜涓烘垜浠粠璧風(fēng)偣鏂規(guī)牸浠ュ鑾峰彇浜嗕笉姝竴涓柟鏍箋?br />
H鍊煎彲浠ョ敤涓嶅悓鐨勬柟娉曚及綆椼傛垜浠繖閲屼嬌鐢ㄧ殑鏂規(guī)硶琚О涓烘浖鍝堥】鏂規(guī)硶錛屽畠璁$畻浠庡綋鍓嶆牸鍒扮洰鐨勬牸涔嬮棿姘村鉤鍜屽瀭鐩寸殑鏂規(guī)牸鐨勬暟閲忔誨拰錛屽拷鐣ュ瑙掔嚎鏂瑰悜銆傜劧鍚庢妸緇撴灉涔樹互10銆傝繖琚垚涓烘浖鍝堥】鏂規(guī)硶鏄洜涓哄畠鐪嬭搗鏉ュ儚璁$畻鍩庡競涓粠涓涓湴鏂瑰埌鍙﹀涓涓湴鏂圭殑琛楀尯鏁幫紝鍦ㄩ偅閲屼綘涓嶈兘娌垮瑙掔嚎鏂瑰悜絀胯繃琛楀尯銆傚緢閲嶈鐨勪竴鐐癸紝鎴戜滑蹇界暐浜嗕竴鍒囬殰紕嶇墿銆傝繖鏄鍓╀綑璺濈鐨勪竴涓及綆楋紝鑰岄潪瀹為檯鍊鹼紝榪欎篃鏄繖涓鏂規(guī)硶琚О涓哄惎鍙戝紡鐨勫師鍥犮傛兂鐭ラ亾鏇村錛熶綘鍙互鍦ㄨ繖閲屾壘鍒版柟紼嬪拰棰濆鐨勬敞瑙c?br />


絎竴姝ユ悳绱㈢殑緇撴灉鍙互鍦ㄤ笅闈㈢殑鍥捐〃涓湅鍒般侳,G鍜孒鐨勮瘎鍒嗚鍐欏湪姣忎釜鏂規(guī)牸閲屻傛濡傚湪绱ф尐璧峰鏍煎彸渚х殑鏂規(guī)牸鎵琛ㄧず鐨勶紝F琚墦鍗板湪宸︿笂瑙掞紝G鍦ㄥ乏涓嬭錛孒鍒欏湪鍙充笅瑙掋?/span>

image003.jpg

寮曠敤涓涓嬪師鏂囩殑緲昏瘧錛?/span>

鎴戜滑鍋氬涓嬫搷浣滃紑濮嬫悳绱細(xì)
聽聽聽
1錛屼粠鐐笰寮濮嬶紝騫朵笖鎶婂畠浣滀負(fù)寰呭鐞嗙偣瀛樺叆涓涓滃紑鍚垪琛ㄢ濄傚紑鍚垪琛ㄥ氨鍍忎竴寮犺喘鐗╂竻鍗曘傚敖綆$幇鍦ㄥ垪琛ㄩ噷鍙湁涓涓厓绱狅紝浣嗕互鍚庡氨浼?xì)澶氳典h潵銆備綘鐨勮礬寰勫彲鑳戒細(xì)閫氳繃瀹冨寘鍚殑鏂規(guī)牸錛屼篃鍙兘涓嶄細(xì)銆傚熀鏈笂錛岃繖鏄竴涓緟媯鏌ユ柟鏍肩殑鍒楄〃銆?br />聽聽聽2錛屽鎵捐搗鐐瑰懆鍥存墍鏈夊彲鍒拌揪鎴栬呭彲閫氳繃鐨勬柟鏍鹼紝璺寵繃鏈夊錛屾按錛屾垨鍏朵粬鏃犳硶閫氳繃鍦板艦鐨勬柟鏍箋備篃鎶婁粬浠姞鍏ュ紑鍚垪琛ㄣ備負(fù)鎵鏈夎繖浜涙柟鏍間繚瀛樼偣A浣滀負(fù)鈥滅埗鏂規(guī)牸鈥濄傚綋鎴戜滑鎯蟲弿榪拌礬寰勭殑鏃跺欙紝鐖舵柟鏍肩殑璧勬枡鏄崄鍒嗛噸瑕佺殑銆傚悗闈細(xì)瑙i噴瀹冪殑鍏蜂綋鐢ㄩ斻?br />聽聽聽3錛屼粠寮鍚垪琛ㄤ腑鍒犻櫎鐐笰錛屾妸瀹冨姞鍏ュ埌涓涓滃叧闂垪琛ㄢ濓紝鍒楄〃涓繚瀛樻墍鏈変笉闇瑕佸啀嬈℃鏌ョ殑鏂規(guī)牸銆?br />
涓轟簡緇х畫鎼滅儲錛屾垜浠畝鍗曠殑浠庡紑鍚垪琛ㄤ腑閫夋嫨F鍊兼渶浣庣殑鏂規(guī)牸銆傜劧鍚庯紝瀵歸変腑鐨勬柟鏍煎仛濡備笅澶勭悊錛?br />
聽聽聽
4錛屾妸瀹冧粠寮鍚垪琛ㄤ腑鍒犻櫎錛岀劧鍚庢坊鍔犲埌鍏抽棴鍒楄〃涓?br />聽聽聽5錛屾鏌ユ墍鏈夌浉閭繪牸瀛愩傝煩榪囬偅浜涘凡緇忓湪鍏抽棴鍒楄〃涓殑鎴栬呬笉鍙氳繃鐨?鏈夊錛屾按鐨勫湴褰紝鎴栬呭叾浠栨棤娉曢氳繃鐨勫湴褰?錛屾妸浠栦滑娣誨姞榪涘紑鍚垪琛紝濡傛灉浠栦滑榪樹笉鍦ㄩ噷闈㈢殑璇濄傛妸閫変腑鐨勬柟鏍間綔涓烘柊鐨勬柟鏍肩殑鐖惰妭鐐廣?br />聽聽聽6錛屽鏋滄煇涓浉閭繪牸宸茬粡鍦ㄥ紑鍚垪琛ㄩ噷浜嗭紝媯鏌ョ幇鍦ㄧ殑榪欐潯璺緞鏄惁鏇村ソ銆傛崲鍙ヨ瘽璇達(dá)紝媯鏌ュ鏋滄垜浠敤鏂扮殑璺緞鍒拌揪瀹冪殑璇濓紝G鍊兼槸鍚︿細(xì)鏇翠綆涓浜涖傚鏋滀笉鏄紝閭e氨浠涔堥兘涓嶅仛銆?br />聽聽聽聽聽聽鍙︿竴鏂歸潰錛屽鏋滄柊鐨凣鍊兼洿浣庯紝閭e氨鎶婄浉閭繪柟鏍肩殑鐖惰妭鐐規(guī)敼涓虹洰鍓嶉変腑鐨勬柟鏍鹼紙鍦ㄤ笂闈㈢殑鍥捐〃涓紝鎶婄澶寸殑鏂瑰悜鏀逛負(fù)鎸囧悜榪欎釜鏂規(guī)牸錛夈傛渶鍚庯紝閲嶆柊璁$畻F鍜孏鐨勫箋傚鏋滆繖鐪嬭搗鏉ヤ笉澶熸竻鏅幫紝浣犲彲浠ョ湅涓嬮潰鐨勫浘紺恒?/span>


image004.jpg

image005.jpg

image006.jpg

image007.jpg

榪欐牱灝卞彲浠ユ壘鍒版渶浣寵礬寰勪簡銆?br />



Bill Hsu 2008-11-01 18:19 鍙戣〃璇勮
]]>
娓告垙妗嗘灦http://m.shnenglu.com/billhsu/archive/2008/10/18/64311.htmlBill HsuBill HsuSat, 18 Oct 2008 09:46:00 GMThttp://m.shnenglu.com/billhsu/archive/2008/10/18/64311.htmlhttp://m.shnenglu.com/billhsu/comments/64311.htmlhttp://m.shnenglu.com/billhsu/archive/2008/10/18/64311.html#Feedback17http://m.shnenglu.com/billhsu/comments/commentRss/64311.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/64311.html鍙互鎶婂浘褰㈡覆鏌擄紝閫昏緫澶勭悊錛岀綉緇滆仈鏈虹瓑閮藉仛鎴愬樊涓嶅鐨勬ā鍧楋紝鐒跺悗鍔犲埌妗嗘灦錛岃繖鏍峰ソ綆$悊涓鐐廣?br />
class聽CFramework
{
public:
CFramework();
~CFramework();
void聽init();
void聽update();
void聽Shutdown();
void聽add(Module聽*module);//鍔犲叆妯″潡
};
Module 鏄竴涓函铏氬嚱鏁扮被
class聽Module
{
public:
virtualvoid聽init();
virtualvoid聽update(float聽dt);
};

鍥懼艦娓叉煋錛岄昏緫澶勭悊錛岀綉緇滆仈鏈烘ā鍧楀氨鍙互榪愯浜嗐?img src ="http://m.shnenglu.com/billhsu/aggbug/64311.html" width = "1" height = "1" />

Bill Hsu 2008-10-18 17:46 鍙戣〃璇勮
]]>
鏍堝璞″拰鍫嗗璞?/title><link>http://m.shnenglu.com/billhsu/archive/2008/10/10/63673.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Fri, 10 Oct 2008 09:36:00 GMT</pubDate><guid>http://m.shnenglu.com/billhsu/archive/2008/10/10/63673.html</guid><wfw:comment>http://m.shnenglu.com/billhsu/comments/63673.html</wfw:comment><comments>http://m.shnenglu.com/billhsu/archive/2008/10/10/63673.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/billhsu/comments/commentRss/63673.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/billhsu/services/trackbacks/63673.html</trackback:ping><description><![CDATA[鍦╣ameres涓婄湅瑙佷竴涓棶棰樺笘錛?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">浠涔堟椂鍊欒鐢燨bject聽</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">;<br /><br />浠涔堟椂鍊欒鐢燨bject聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽Object();</span></div>鎰熻鐪嬭搗鏉ユ病浠涔堝尯鍒紝鍏跺疄涓嶄竴鏍鳳細(xì)鍓嶄竴涓槸鏍堝璞★紝鍚庝竴涓槸鍫嗗璞°?br /><br />寮曠敤涓涓嬪埆浜哄鏍堝璞°佸爢瀵硅薄鐨勮В閲婏細(xì)<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">銆銆鏍堝璞$殑浼樺娍鏄湪閫傚綋鐨勬椂鍊欒嚜鍔ㄧ敓鎴愶紝鍙堝湪閫傚綋鐨勬椂鍊欒嚜鍔ㄩ攢姣侊紝涓嶉渶瑕佺▼搴忓憳鎿嶅績錛涜屼笖鏍堝璞$殑鍒涘緩閫熷害涓鑸緝鍫嗗璞″揩錛屽洜涓哄垎閰嶅爢瀵硅薄鏃訛紝浼?xì)璋冪敤?/span><span style="color: rgb(0, 0, 255);">operator</span><span style="color: rgb(0, 0, 0);">聽new鎿嶄綔錛?/span><span style="color: rgb(0, 0, 255);">operator</span><span style="color: rgb(0, 0, 0);">聽new浼?xì)閲囩敤鏌惪U嶅唴瀛樼┖闂存悳绱㈢畻娉曪紝鑰岃鎼滅儲榪囩▼鍙兘鏄緢璐規(guī)椂闂寸殑錛屼駭鐢熸爤瀵硅薄鍒欐病鏈夎繖涔堥夯鐑︼紝瀹冧粎浠呴渶瑕佺Щ鍔ㄦ爤欏舵寚閽堝氨鍙互浜嗐備絾鏄娉ㄦ剰鐨勬槸錛岄氬父鏍堢┖闂村閲忔瘮杈冨皬錛屼竴鑸槸1MB锝?MB錛屾墍浠ヤ綋縐瘮杈冨ぇ鐨勫璞′笉閫傚悎鍦ㄦ爤涓垎閰嶃傜壒鍒娉ㄦ剰閫掑綊鍑芥暟涓渶濂戒笉瑕佷嬌鐢ㄦ爤瀵硅薄錛屽洜涓洪殢鐫閫掑綊璋冪敤娣卞害鐨勫鍔狅紝鎵闇鐨勬爤絀洪棿涔熶細(xì)綰挎у鍔狅紝褰撴墍闇鏍堢┖闂翠笉澶熸椂錛屼究浼?xì)瀵艰嚧鏍堟孩鍑哄Q岃繖鏍峰氨浼?xì)漶旂敓杩愯鏃堕敊璇?br /><br />銆銆鍫嗗璞★紝鍏朵駭鐢熸椂鍒誨拰閿姣佹椂鍒婚兘瑕佺▼搴忓憳綺劇‘瀹氫箟錛屼篃灝辨槸璇達(dá)紝紼嬪簭鍛樺鍫嗗璞$殑鐢熷懡鍏鋒湁瀹屽叏鐨勬帶鍒舵潈銆傛垜浠父甯擱渶瑕佽繖鏍風(fēng)殑瀵硅薄錛屾瘮濡傦紝鎴戜滑闇瑕佸垱寤轟竴涓璞★紝鑳藉琚涓嚱鏁版墍璁塊棶錛屼絾鏄張涓嶆兂浣垮叾鎴愪負(fù)鍏ㄥ眬鐨勶紝閭d箞榪欎釜鏃跺欏垱寤轟竴涓爢瀵硅薄鏃犵枒鏄壇濂界殑閫夋嫨錛岀劧鍚庡湪鍚勪釜鍑芥暟涔嬮棿浼犻掕繖涓爢瀵硅薄鐨勬寚閽堬紝渚垮彲浠ュ疄鐜板璇ュ璞$殑鍏變韓銆傚彟澶栵紝鐩告瘮浜庢爤絀洪棿錛屽爢鐨勫閲忚澶у緱澶氥傚疄闄呬笂錛屽綋鐗╃悊鍐呭瓨涓嶅鏃訛紝濡傛灉榪欐椂榪橀渶瑕佺敓鎴愭柊鐨勫爢瀵硅薄錛岄氬父涓嶄細(xì)浜х敓榪愯鏃墮敊璇紝鑰屾槸緋葷粺浼?xì)鋴社敤铏氭嫙鍐呭瓨鏉ユ墿灞曞疄闄呯殑鐗╃悊鍐呭瓨銆?/span></div><br />鎵浠?br />褰撲綘鐭ラ亾浣犺浣跨敤鐨勭被鍨嬫嫢鏈夊噯紜暟閲忔椂浣跨敤<span style="color: rgb(0, 0, 0);"> Object聽</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">;</span><br />褰撲綘涓嶇煡閬撲綘瑕佸垱寤虹殑綾誨瀷鏈夊灝戜釜鏃朵嬌鐢?<span style="color: rgb(0, 0, 0);">Object聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">;<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 </span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽Object();</span><br /><br /><img src ="http://m.shnenglu.com/billhsu/aggbug/63673.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2008-10-10 17:36 <a href="http://m.shnenglu.com/billhsu/archive/2008/10/10/63673.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍥涘厓鏁板叆闂?/title><link>http://m.shnenglu.com/billhsu/archive/2008/09/30/63099.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Tue, 30 Sep 2008 11:34:00 GMT</pubDate><guid>http://m.shnenglu.com/billhsu/archive/2008/09/30/63099.html</guid><wfw:comment>http://m.shnenglu.com/billhsu/comments/63099.html</wfw:comment><comments>http://m.shnenglu.com/billhsu/archive/2008/09/30/63099.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://m.shnenglu.com/billhsu/comments/commentRss/63099.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/billhsu/services/trackbacks/63099.html</trackback:ping><description><![CDATA[鍥涘厓鏁板父甯稿彲浠ュ湪3D鐨勪功涓婄湅鍒般?br />浣嗘垜鐨勯偅鏈?D鍥懼艦瀛︿功涓婏紝鍦ㄦ病璁插洓鍏冩暟鏄共浠涔堢殑涔嬪墠錛屽氨鍒椾簡鍑犲紶綰哥殑鍏紡錛?br />澶ф鍥犱負(fù)鑷繁榪樺湪涓婇珮涓紝涓嶇煡閬撶殑澶錛岀湅浜嗗崐澶╂病鐪嬫噦銆傘傘?br />緇堜簬錛屽湪gameres涓婄湅鍒頒簡鏌愬己浜虹炕璇戠殑涓涓?鍏冩暟瀹濆吀 鈥濓紙鍘熸枃鏄棩鏈漢鍐欑殑銆傘傘傦級錛屾劅瑙夊緢濂斤紝鍒嗕韓涓嬨?br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">鈽呮棆杞瘒錛?br />銆鎴戝皢璇存槑浣跨敤浜嗗洓鍏冩暟錛坰i聽yuan聽shu,聽quaternion錛夌殑鏃嬭漿鐨勬搷浣滄楠?br />錛?/span><span style="color: rgb(0, 0, 0);">錛?/span><span style="color: rgb(0, 0, 0);">錛夊洓鍏冩暟鐨勮櫄閮紝瀹為儴鍜屽啓娉?br />鎵璋撳洓鍏冩暟錛屽氨鏄妸4涓疄鏁扮粍鍚堣搗鏉ョ殑涓滆タ銆?br />4涓厓绱犱腑錛屼竴涓槸瀹為儴錛屽叾浣?涓槸铏氶儴銆?br />姣斿錛屽彨鍋歈鐨勫洓鍏冩暟錛屽疄閮╰鑰岃櫄閮ㄦ槸x,y,z鏋勬垚錛屽垯鍍忎笅闈㈣繖鏍峰啓銆?br />Q聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽(t;聽x,聽y,聽z)聽<br />鍙堬紝浣跨敤鍚戦噺聽V</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">(x,y,z)錛?br />Q聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽(t;聽V)聽聽<br />涔熷彲浠ヨ繖涔堝啓銆?br /><br />姝h鍦扮敤铏氭暟鍗曚綅i,j,k鐨勫啓娉曠殑璇濓紝<br />Q聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽t聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽xi聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽yj聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽zk聽<br />涔熻繖鏍峰啓錛屼笉榪囷紝鎴戜笉澶т嬌鐢?br /><br />錛?/span><span style="color: rgb(0, 0, 0);">錛?/span><span style="color: rgb(0, 0, 0);">錛夊洓鍏冩暟涔嬮棿鐨勪箻娉?br />铏氭暟鍗曚綅涔嬮棿鐨勪箻娉暵?br />ii聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">,聽ij聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">ji聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽k聽(鍏朵粬鐨勭粍鍚堜篃鏄驚鐜湴浠ヤ笅鍚屾枃)聽<br />鏈夎繖涔堜竴縐嶈鍒欍傦紙鎴戞昏寰楋紝榪欏氨鍍忔槸鍚戦噺縐紙澶栫Н錛夛紝瀵瑰惂錛壜?br />鐢ㄨ繖涓鍒欎竴鐐圭偣鍦拌綆楀緢楹葷儲錛屾墍浠ヨ鐢ㄥ儚涓嬮潰榪欐牱鐨勫叕寮忚綆椼?br /><br />A聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽(a;聽U)聽<br />B聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽(b;聽V)聽<br />AB聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽(ab聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">聽U路V;聽aV聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽bU聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽U脳V)<br />涓嶈繃錛屸淯路V鈥濇槸鍐呯Н錛屻孶脳V銆嶆槸澶栫Н鐨勬剰鎬濄?br />娉ㄦ剰錛氫竴鑸珹B</span><span style="color: rgb(0, 0, 0);"><></span><span style="color: rgb(0, 0, 0);">BA鎵浠ヤ箻娉曠殑宸﹀彸瑕佹敞鎰忥紒<br /><br />錛?/span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">錛?嬈″厓鐨勫潗鏍囩殑鍥涘厓鏁拌〃紺?br />濡傝灝嗘煇鍧愭爣(x,y,z)鐢ㄥ洓鍏冩暟琛ㄧず錛?br />P聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;聽x,聽y,聽z)聽<br />鍒欒榪欎箞鍐欍?br />聽<br />鍙﹀錛屽嵆浣垮疄閮ㄦ槸闆朵互澶栫殑鍊鹼紝涓嬫枃鐨勭粨鏋滀篃涓鏍楓傜敤闆剁殑璇濈渷浜嬫墍浠ユ垜鎺ㄨ崘銆?br /><br />錛?/span><span style="color: rgb(0, 0, 0);">錛?/span><span style="color: rgb(0, 0, 0);">錛夋棆杞殑鍥涘厓鏁拌〃紺?br />浠ュ師鐐逛負(fù)鏃嬭漿涓績錛屾棆杞殑杞存槸(偽,聽尾,聽緯)<br />錛堜絾聽偽</span><span style="color: rgb(0, 0, 0);">^</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽尾</span><span style="color: rgb(0, 0, 0);">^</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽緯</span><span style="color: rgb(0, 0, 0);">^</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">錛夛紝聽<br />錛堝彸鎵嬬郴鐨勫潗鏍囧畾涔夌殑璇濓紝鏈涘悜鍚戦噺(偽,聽尾,聽緯)鐨勫墠榪涙柟鍚戝弽鏃墮拡鍦幫級聽<br />杞歌鐨勬棆杞紝鐢ㄥ洓鍏冩暟琛ㄧず灝辨槸錛?br />Q聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽(cos(胃</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">);聽偽聽sin(胃</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">),聽尾聽sin(胃</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">),聽緯聽sin(胃</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">))聽<br />R聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽(cos(胃</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">);聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">偽聽sin(胃</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">),聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">尾聽sin(胃</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">),聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">緯聽sin(胃</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">))聽<br />(鍙﹀R聽鍙燪聽鐨勫叡杞洓鍏冩暟銆傦級聽<br /><br />閭d箞錛屽瑕佸疄琛屾棆杞紝<br /><b>鍒櫬?font color="#ff6600">R聽P聽Q<font color="#ffcc00">聽</font></font></b></span><font color="#ffcc00"><b><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽(</span><span style="color: rgb(0, 0, 0);">0</span></b></font><span style="color: rgb(0, 0, 0);"><b><font color="#ff6600">;聽絳旀)</font>聽</b><br /><br />璇峰儚榪欐牱涓夋槑娌誨紡鍦拌綆椼傝繖涓肩殑铏氶儴灝辨槸鏃嬭漿涔嬪悗鐨勭偣鐨勫潗鏍囧箋?br />聽錛堝彟澶栵紝瀹為儴搴旇涓洪浂銆傝楠岀畻鐪嬬湅錛壜?/span></div><br />渚嬪瓙浠g爜<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">聽Quaternion.cpp聽<br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">聽(C)聽Toru聽Nakata,聽toru-nakata@aist.go.jp聽<br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">聽2004聽Dec聽29聽</span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽<br />#include聽</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">math.h</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">聽<br />#include聽</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">iostream.h</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">聽<br />聽聽<br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">聽Define聽Data聽type聽</span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">typedef聽</span><span style="color: rgb(0, 0, 255);">struct</span><span style="color: rgb(0, 0, 0);">聽<br />{聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽t;聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">聽real-component聽</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽x;聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">聽x-component聽</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽y;聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">聽y-component聽</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽z;聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">聽z-component聽</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">}聽quaternion;聽<br />聽聽<br /><br /></span><b><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">/ Bill 娉細(xì)Kakezan </span></b><span style="color: rgb(128, 128, 128);"><font color="#669900"><b>鍦ㄦ棩璇噷鏄?鈥滀箻娉曗濈殑鎰忔?/b></font><br /></span><span style="color: rgb(0, 0, 0);">quaternion聽Kakezan(quaternion聽left,聽quaternion聽right)聽<br />{聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽quaternion聽ans;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽d1,聽d2,聽d3,聽d4;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d1聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽left.t聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.t;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d2聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.x聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.x;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d3聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.y聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.y;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d4聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.z聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.z;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.t聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽d1</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d2</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d3</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d4;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d1聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽left.t聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.x;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d2聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽right.t聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽left.x;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d3聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽left.y聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.z;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d4聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.z聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.y;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.x聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽d1</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d2</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d3</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d4;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d1聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽left.t聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.y;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d2聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽right.t聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽left.y;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d3聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽left.z聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.x;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d4聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.x聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.z;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.y聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽d1</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d2</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d3</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d4;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d1聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽left.t聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.z;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d2聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽right.t聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽left.z;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d3聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽left.x聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.y;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽d4聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.y聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽right.x;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.z聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽聽d1</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d2</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d3</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽d4;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽ans;聽<br />}聽<br />聽聽<br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">/聽Make聽Rotational聽quaternion聽</span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">quaternion聽MakeRotationalQuaternion(</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽radian,聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽AxisX,聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽AxisY,聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽AxisZ)聽<br />{聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽quaternion聽ans;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽norm;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽ccc,聽sss;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.t聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽ans.x聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽ans.y聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽ans.z聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0.0</span><span style="color: rgb(0, 0, 0);">;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽norm聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽AxisX聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽聽AxisX聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽聽AxisY聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽聽AxisY聽</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">聽聽AxisZ聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽聽AxisZ;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(norm聽</span><span style="color: rgb(0, 0, 0);"><=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0.0</span><span style="color: rgb(0, 0, 0);">)聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽ans;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽norm聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">1.0</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">聽sqrt(norm);聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽AxisX聽</span><span style="color: rgb(0, 0, 0);">*=</span><span style="color: rgb(0, 0, 0);">聽norm;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽AxisY聽</span><span style="color: rgb(0, 0, 0);">*=</span><span style="color: rgb(0, 0, 0);">聽norm;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽AxisZ聽</span><span style="color: rgb(0, 0, 0);">*=</span><span style="color: rgb(0, 0, 0);">聽norm;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ccc聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽cos(</span><span style="color: rgb(0, 0, 0);">0.5</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽radian);聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽sss聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽sin(</span><span style="color: rgb(0, 0, 0);">0.5</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽radian);聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.t聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽ccc;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.x聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽sss聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽AxisX;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.y聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽sss聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽AxisY;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.z聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽sss聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽AxisZ;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽ans;聽<br />}聽<br />聽聽<br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">/聽Put聽XYZ聽into聽聽quaternion聽</span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">quaternion聽PutXYZToQuaternion(</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽PosX,聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽PosY,聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽PosZ)聽<br />{聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽quaternion聽ans;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.t聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0.0</span><span style="color: rgb(0, 0, 0);">;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.x聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽PosX;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.y聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽PosY;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ans.z聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽PosZ;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽ans;聽<br />}聽<br />聽聽<br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">//聽main聽</span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">聽main()聽<br />{聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽px,聽py,聽pz;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">聽ax,聽ay,聽az,聽th;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽quaternion聽ppp,聽qqq,聽rrr;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽cout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Point聽Position聽(x,聽y,聽z)聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽endl;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽cout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽聽x聽=聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽cin聽</span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);">聽px;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽cout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽聽y聽=聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽cin聽</span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);">聽py;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽cout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽聽z聽=聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽cin聽</span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);">聽pz;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽ppp聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽PutXYZToQuaternion(px,聽py,聽pz);聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">)聽{聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">\nRotation聽Degree聽?聽(Enter聽0聽to聽Quit)聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽endl;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽聽angle聽=聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cin聽</span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);">聽th;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(th聽</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0.0</span><span style="color: rgb(0, 0, 0);">)聽</span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Rotation聽Axis聽Direction聽?聽(x,聽y,聽z)聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽endl;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽聽x聽=聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cin聽</span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);">聽ax;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽聽y聽=聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cin聽</span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);">聽ay;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽聽z聽=聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cin聽</span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);">聽az;聽<br />聽聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽th聽</span><span style="color: rgb(0, 0, 0);">*=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">3.1415926535897932384626433832795</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">180.0</span><span style="color: rgb(0, 0, 0);">;聽</span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">聽Degree聽->聽radian;聽</span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽qqq聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽MakeRotationalQuaternion(th,聽ax,聽ay,聽az);聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽rrr聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽MakeRotationalQuaternion(</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">th,聽ax,聽ay,聽az);聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽ppp聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽Kakezan(rrr,聽ppp);聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽ppp聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽Kakezan(ppp,聽qqq);聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽cout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">\nAnser聽X聽=聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽ppp.x聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">\n聽聽聽聽聽聽Y聽=聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽ppp.y聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">\n聽聽聽聽聽聽Z聽=聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽ppp.z聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽endl;聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽}聽<br />聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;聽<br />}聽聽<br /></span></div>http://staff.aist.go.jp/toru-nakata/quaternion.html<br />http://bbs.gameres.com/showthread.asp?threadid=73511<br /><br /><img src ="http://m.shnenglu.com/billhsu/aggbug/63099.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2008-09-30 19:34 <a href="http://m.shnenglu.com/billhsu/archive/2008/09/30/63099.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>紲炵粡鍏冪綉緇滅殑瓚呯駭鍏ラ棬http://m.shnenglu.com/billhsu/archive/2008/08/30/60455.htmlBill HsuBill HsuSat, 30 Aug 2008 12:08:00 GMThttp://m.shnenglu.com/billhsu/archive/2008/08/30/60455.htmlhttp://m.shnenglu.com/billhsu/comments/60455.htmlhttp://m.shnenglu.com/billhsu/archive/2008/08/30/60455.html#Feedback2http://m.shnenglu.com/billhsu/comments/commentRss/60455.htmlhttp://m.shnenglu.com/billhsu/services/trackbacks/60455.html
2001 騫?nbsp;6 鏈?nbsp;01 鏃?br>
    紲炵粡緗戠粶涔熻鏄綆楁満璁$畻鐨勫皢鏉ワ紝涓涓簡瑙e畠鐨勫ソ鏂規(guī)硶鏄敤涓涓畠鍙互瑙e喅鐨勯毦棰樻潵璇存槑銆傚亣璁劇粰鍑?nbsp;
500 涓瓧絎︾殑浠g爜孌碉紝鎮(zhèn)ㄧ煡閬撳畠浠槸 C銆丆++銆丣ava 鎴栬?nbsp;Python銆傜幇鍦ㄦ瀯閫犱竴涓▼搴忥紝鏉ヨ瘑鍒紪鍐欒繖孌典唬鐮佺殑璇█銆備竴縐嶈В鍐蟲柟妗堟槸鏋勯犱竴涓兘澶熷涔?fàn)璇嗗埆杩欎簺璇a鐨勭緇忕綉緇溿傝繖綃囨枃绔犺璁轟簡紲炵粡緗戠粶鐨勫熀鏈姛鑳戒互鍙?qiáng)鏋勯犵緇忕綉緇滅殑鏂規(guī)硶錛岃繖鏍峰氨鍙互鍦ㄧ紪鐮佹椂搴旂敤瀹冧滑浜嗐?/span>

Bill娉細(xì)瑙i噴涓涓嬶紝榪欐枃绔犳槸鐢? ( _ . = ; " , ' * / { } : - 0 + 1 [ ] 榪?0涓壒孌婄鍙峰嚭鐜伴鐜?浜哄伐紲炵粡鍏冪殑鍒ゆ柇鏉ヨ瘑鍒?span style="color: #000000;">浠g爜孌?/span>鏄?nbsp;C銆丆++銆丣ava 鎴栬?nbsp;Python


鏍規(guī)嵁涓涓畝鍖栫殑緇熻錛屼漢鑴戠敱鐧句嚎鏉$緇忕粍鎴?鈥? 姣忔潯紲炵粡騫沖潎榪炵粨鍒板叾瀹冨嚑鍗冩潯紲炵粡銆傞氳繃榪欑榪炵粨鏂瑰紡錛岀緇忓彲浠ユ敹鍙戜笉鍚屾暟閲忕殑鑳介噺銆傜緇忕殑涓涓潪甯擱噸瑕佺殑鍔熻兘鏄畠浠鑳介噺鐨勬帴鍙楀茍涓嶆槸绔嬪嵆浣滃嚭鍝嶅簲錛岃? 鏄皢瀹冧滑绱姞璧鋒潵錛屽綋榪欎釜绱姞鐨勬誨拰杈懼埌鏌愪釜涓寸晫闃堝兼椂錛屽畠浠皢瀹冧滑鑷繁鐨勯偅閮ㄥ垎鑳介噺鍙戦佺粰鍏跺畠鐨勭緇忋傚ぇ鑴戦氳繃璋冭妭榪欎簺榪炵粨鐨勬暟鐩拰寮哄害榪涜瀛︿範(fàn)銆傚敖綆? 榪欐槸涓敓鐗╄涓虹殑綆鍖栨弿榪般備絾鍚屾牱鍙互鍏呭垎鏈夊姏鍦拌鐪嬩綔鏄緇忕綉緇滅殑妯″瀷銆?/p>

闃堝奸昏緫鍗曞厓錛圱hreshold Logic Unit錛孴LU錛?/span>

鐞嗚В紲炵粡緗戠粶鐨勭涓姝ユ槸浠庡鎶借薄鐢熺墿紲炵粡寮濮嬶紝騫舵妸閲嶇偣鏀懼湪 闃堝奸昏緫鍗曞厓錛圱LU錛?/em>榪欎竴鐗瑰緛涓娿備竴涓? TLU 鏄竴涓璞★紝瀹冨彲浠ヨ緭鍏ヤ竴緇勫姞鏉冪郴鏁扮殑閲忥紝瀵瑰畠浠繘琛屾眰鍜岋紝濡傛灉榪欎釜鍜岃揪鍒版垨鑰呰秴榪囦簡鏌愪釜闃堝鹼紝杈撳嚭涓涓噺銆? 璁╂垜浠敤絎﹀彿鏍囨敞榪欎簺鍔熻兘錛岄鍏堬紝鏈夎緭鍏ュ間互鍙?qiáng)瀹冧滑鐨勬潈绯绘晭图?xì)X 1, X 2, ..., X n鍜?W 1, W 2, ..., W n銆傛帴鐫鏄眰鍜岃綆楀嚭鐨?X i*W i 錛屼駭鐢熶簡嬋鍙戝眰 a錛屾崲涓縐嶆柟娉曡〃紺猴細(xì)

a = (X1 * W1)+(X2 * W2)+...+(Xi * Wi)+...+ (Xn * Wn)

闃堝肩О涓?theta銆傛渶鍚庯紝杈撳嚭緇撴灉 y銆傚綋 a >=theta 鏃?y=1錛屽弽涔? y=0銆傝娉ㄦ剰杈撳嚭鍙互鏄繛緇殑錛屽洜涓哄畠涔熷彲浠ョ敱涓涓?squash 鍑芥暟 s錛堟垨 sigma錛夊垽瀹氾紝璇ュ嚱鏁扮殑鑷彉閲忔槸 a錛屽嚱鏁板煎湪 0 鍜?1 涔嬮棿錛寉=s(a)銆?/p>
鍥?1. 闃堝奸昏緫鍗曞厓錛屽甫鏈?sigma 鍑芥暟錛堥《閮級鍜?cutoff 鍑芥暟錛堝簳閮級
闃堝奸昏緫鍗曞厓

TLU 浼?xì)鍒喚c伙紝鍋囪涓涓?TLU 鏈変袱涓緭鍏ュ鹼紝瀹冧滑鐨勬潈緋繪暟絳変簬 1錛宼heta 鍊肩瓑浜?1.5銆傚綋榪欎釜 TLU 杈撳叆 <0,0>銆?lt;0,1>銆?lt;1,0> 鍜?<1,1> 鏃訛紝瀹冪殑杈撳嚭鍒嗗埆涓?0銆?銆?銆?銆俆LU 灝嗚繖浜涜緭鍏ュ垎涓轟袱緇勶細(xì)0 緇勫拰 1 緇勩傚氨鍍忔噦寰楅昏緫榪炴帴錛堝竷?yōu)當(dāng)杩惤? AND錛夌殑浜鴻剳鍙互綾諱技鍦板皢閫昏緫榪炴帴鐨勫彞瀛愬垎綾婚偅鏍鳳紝TLU 涔熸噦寰椾竴鐐歸昏緫榪炴帴涔嬬被鐨勪笢瑗褲?/p>

TLU 鑳藉鐢ㄥ嚑浣曞涓婄殑瑙i噴鏉ラ槓鏄庤繖縐嶇幇璞°傚畠鐨勫洓縐嶅彲鑳借緭鍏ュ搴斾簬絎涘崱灝?dāng)鍥剧殑鍥涗釜鐐广備粠絳夊紡 X 1*W 1+ X 2*W 2 = theta錛屾崲鍙ヨ瘽璇達(dá)紝涔熷嵆 TLU 杞崲鍏跺垎綾昏涓虹殑鐐瑰紑濮嬶紝瀹冪殑鐐歸兘鍒嗗竷鍦ㄦ洸綰?X 2 = -X 1 + 1.5 涓娿傝繖涓柟紼嬬殑鏇茬嚎灝?4 涓彲鑳界殑杈撳叆鍒嗘垚浜嗕袱涓搴斾簬 TLU 鍒嗙被鐨勫尯鍩熴傝繖鏄?TLU 鍘熺悊涓洿涓烘櫘閫氱殑瀹炰緥銆傚湪 TLU 鏈変換鎰忔暟鐩殑 N 涓緭鍏ョ殑鎯呭喌涓嬶紝涓緇勫彲鑳界殑杈撳叆瀵瑰簲浜?N 緇寸┖闂翠腑鐨勪竴涓偣闆嗐傚鏋滆繖浜涚偣鍙互琚秴騫抽潰 鈥? 鎹㈠彞璇濊錛屽搴斾簬涓婇潰紺轟緥涓殑綰跨殑 N 緇寸殑鍑犱綍澶栧艦鍒囧壊錛岄偅涔堝氨鏈変竴緇勬潈緋繪暟鍜屼竴涓槇鍊兼潵瀹氫箟鍏跺垎綾誨垰濂戒笌榪欎釜鍒囧壊鐩稿尮閰嶇殑 TLU銆?

Bill娉細(xì)鎵璋撶殑N緇寸┖闂村氨鏄疦涓緭鍏ヨ妭鐐?br>

TLU 鐨勫涔?fàn)鍘熺?/span>

鏃㈢劧 TLU 鎳傚緱鍒嗙被錛屽畠浠氨鐭ラ亾绱犳潗銆傜緇忕綉緇滀篃鍙亣瀹氫負(fù)鍙互瀛︿範(fàn)銆傚畠浠殑瀛︿範(fàn)鏈哄埗鏄ā浠垮ぇ鑴戣皟鑺傜緇忚繛緇撶殑鍘熺悊銆俆LU 閫氳繃鏀瑰彉瀹冪殑鏉冪郴鏁板拰闃堝兼潵瀛︿範(fàn)銆傚疄闄呬笂錛屼粠鏁板鐨勮鐐圭湅錛屾潈緋繪暟闃堝肩殑鐗瑰緛鏈夌偣姝︽柇銆傝鎴戜滑鍥炴兂涓涓嬪綋 SUM(Xi * Wi) >= theta 鏃?TLU 鍦ㄤ復(fù)鐣岀偣鏃惰緭鍑虹殑鏄?1 鑰屼笉鏄? 0錛岃繖鐩稿綋浜庤涓寸晫鐐規(guī)槸鍑虹幇鍦?SUM(X i* W i)+ (-1 * theta) >= 0 鐨勬椂鍊欍傛墍浠ワ紝鎴戜滑鍙互鎶?-1 鐪嬫垚涓涓父閲忚緭鍏ワ紝瀹冪殑鏉冪郴鏁?theta 鍦ㄥ涔?fàn)锛堟垨鑰呯敤鎶鏈湳璇紝縐頒負(fù) 鍩硅錛夌殑榪囩▼涓繘琛岃皟鏁淬傝繖鏍鳳紝褰? SUM(X i* W i)+ (-1 * theta) >= 0 鏃訛紝y=1錛屽弽涔?y=0銆?

鍦ㄥ煿璁繃紼嬩腑錛岀緇忕綉緇滆緭鍏ワ細(xì)

  1. 涓緋誨垪闇瑕佸垎綾葷殑鏈紺轟緥
  2. 瀹冧滑鐨勬紜垎綾繪垨鑰呯洰鏍?/li>

榪欐牱鐨勮緭鍏ュ彲浠ョ湅鎴愪竴涓悜閲忥細(xì)<X 1, X 2, ..., X n, theta, t>錛岃繖閲?t 鏄竴涓洰鏍囨垨鑰呮紜垎綾匯傜緇忕綉緇滅敤榪欎簺鏉ヨ皟鏁存潈緋繪暟錛屽叾鐩殑浣垮煿璁腑鐨勭洰鏍囦笌鍏跺垎綾葷浉鍖歸厤銆傛洿紜垏鍦拌錛岃繖鏄湁鎸囧鐨勫煿璁紝涓庝箣鐩稿弽鐨勬槸鏃犳寚瀵肩殑鍩硅銆傚墠鑰呮槸鍩轟簬甯︾洰鏍囩殑紺轟緥錛岃屽悗鑰呭嵈鍙槸寤虹珛鍦ㄧ粺璁″垎鏋愮殑鍩虹涓娿傛潈緋繪暟鐨勮皟鏁存湁涓涓涔?fàn)瑙勫垯锛屼竴涓悊鎯沖寲鐨勫涔?fàn)绠楁硶濡備笅鎵紺猴細(xì)


娓呭崟 1. 鐞嗘兂鍖栫殑瀛︿範(fàn)綆楁硶
fully_trained = FALSE
DO UNTIL (fully_trained):
fully_trained = TRUE
FOR EACH training_vector = <X1, X2, ..., Xn, theta, target>::
# Weights compared to theta
a = (X1 * W1)+(X2 * W2)+...+(Xn * Wn) - theta
y = sigma(a)
IF y != target:
fully_trained = FALSE
FOR EACH Wi:
MODIFY_WEIGHT(Wi) # According to the training rule
IF (fully_trained):
BREAK

鎮(zhèn)ㄦ垨璁告兂鐭ラ亾錛?#8220;鍝簺鍩硅瑙勫垯錛?#8221;鏈夊緢澶氾紝涓嶈繃鏈変竴鏉′技涔庡悎鐞嗙殑瑙勫垯鏄熀浜庤繖鏍蜂竴縐嶆濇兂錛屽嵆鏉冪郴鏁板拰闃堝肩殑璋冩暣搴旇鐢卞垎寮? (t - y) 紜畾銆傝繖涓鍒欓氳繃寮曞叆 alpha (0 < alpha < 1) 瀹屾垚銆傛垜浠妸 alpha 縐頒負(fù) 瀛︿範(fàn)鐜?/em>銆俉 i 涓殑鏇存敼鍊肩瓑浜? (alpha * (t - y)* Xi)銆傚綋 alpha 瓚嬪悜浜?0 鏃訛紝紲炵粡緗戠粶鐨勬潈緋繪暟鐨勮皟鏁村彉寰椾繚瀹堜竴鐐癸紱褰?alpha 瓚嬪悜浜?1 鏃訛紝鏉冪郴鏁扮殑璋冩暣鍙樺緱嬋榪涖備竴涓嬌鐢ㄨ繖涓鍒欑殑紲炵粡緗戠粶縐頒負(fù) 鎰熺煡鍣?/em>錛屽茍涓旇繖涓鍒欒縐頒負(fù) 鎰熺煡鍣ㄥ涔?fàn)瑙勫?/em>銆俁osenblatt 浜?1962 騫翠笅鐨勭粨璁烘槸錛屽鏋?N 緇寸┖闂寸殑鐐歸泦琚秴騫抽潰鍒囧壊錛岄偅涔堟劅鐭ュ櫒鐨勫煿璁畻娉曠殑搴旂敤灝嗕細(xì)鏈緇堝鑷存潈緋繪暟鐨勫垎閰嶏紝浠庤屽畾涔変簡涓涓? TLU錛屽畠鐨勮秴騫抽潰浼?xì)杩涜闇瑕佺殑鍒嗗壊銆傚綋鐒訛紝涓轟簡璁拌搗 Keynes錛屾渶緇堟垜浠兘鍒囨柇浜嗕笌澶栫晫鐨勮仈緋伙紝涓撳績鎬濊冦備絾鏄湪璁$畻鏃墮棿涔嬪錛屾垜浠粛嬋掍復(fù)鍗遍櫓錛屽洜涓烘垜浠渶瑕佽嚜宸辯殑紲炵粡緗戠粶瀵瑰彲鑳借緭鍏ョ殑絀洪棿榪涜涓嶆涓嬈$殑鍒囧壊銆?

鏂囩珷寮濮嬬殑闅鵑涓句緥璇存槑浜嗚繖涓紝鍋囪緇欐?zhèn)?N 涓瓧絎︾殑浠g爜孌碉紝鎮(zhèn)ㄧ煡閬撴槸 C銆丆++銆丣ava 鎴栬? Python銆傞毦鐨勬槸鏋勯犱竴涓▼搴忔潵鏍囪瘑緙栧啓榪欐浠g爜鐨勮璦銆傜敤 TLU 鏉ュ疄鐜伴渶瑕佸鍙兘鐨勮緭鍏ョ┖闂磋繘琛屼笉姝竴嬈$殑鍒嗗壊銆傚畠闇瑕佹妸絀洪棿鍒嗘垚鍥涗釜鍖哄煙銆傛瘡縐嶈璦涓涓尯鍩熴傛妸紲炵粡緗戠粶鍩硅鎴愯兘瀹炵幇涓や釜鍒囧壊灝卞彲瀹屾垚榪欑宸ヤ綔銆傜涓涓垏鍓插皢 C/C++ 鍜?Java/Python 鍒嗗紑鏉ワ紝鍙︿竴涓皢 C/Java 鍜?C++/Python 鍒嗗紑銆備竴涓兘澶熷畬鎴愯繖浜涘垏鍓茬殑緗戠粶鍚屾牱鍙互璇嗗埆婧愪唬鐮佹牱鏈腑鐨勮璦銆備絾鏄繖闇瑕佺綉緇滄湁涓嶅悓緇撴瀯錛屽湪鎻忚堪榪欎釜涓嶅悓涔嬪涔嬪墠錛屽厛鏉ョ畝鍗曞湴鐪嬩竴涓嬪疄璺墊柟闈㈢殑鑰冭檻銆?/p>

鍥?2. 鍒濇鐨勶紙涓嶅畬鏁寸殑錛夋劅鐭ュ櫒瀛︿範(fàn)妯″瀷
鎰熺煡鍣ㄥ涔?fàn)妯″? name=

鑰冭檻鍒版帓闄ゅ彇寰?N 涓瓧絎︿唬鐮佹墍闇鐨勮綆楁椂闂達(dá)紝緇熻浠?ASCII 鐮佺殑 32 鍒?127 鐨勮寖鍥村唴鍙 ASCII 鐮佸瓧絎﹀嚭鐜扮殑棰戠巼錛屽茍鍦ㄨ繖涓粺璁′互鍙?qiáng)鍏充簬浠g爜璇a鐨勭洰鏍囦俊鎭殑鍩虹涓婂煿璁緇忕綉緇溿傛垜浠殑鏂規(guī)硶鏄皢瀛楃緇熻闄愬埗鍒? C銆丆++銆丣ava 鍜?Python 浠g爜瀛楃搴撲腑鏈甯哥敤鐨?20 涓潪瀛楁瘝鏁板瓧瀛楃銆傜敱浜庡叧娉ㄦ誕鐐硅繍綆楃殑鎵ц錛屾垜浠墦綆楃敤涓縐嶈鏍煎寲鍥犵礌灝嗚繖 20 瀛楃緇熻鍒嗗紑鏉ワ紝騫朵互姝ゅ煿璁垜浠殑緗戠粶銆傛樉鐒訛紝涓涓粨鏋勪笂鐨勪笉鍚屾槸鎴戜滑鐨勭綉緇滄湁 20 涓緭鍏ヨ妭鐐癸紝浣嗚繖鏄緢姝e父鐨勶紝鍥犱負(fù)鎴戜滑鐨勬弿榪板凡緇忔殫紺轟簡榪欑鍙兘鎬с備竴涓洿鏈夋剰鎬濈殑鍖哄埆鏄嚭鐜頒簡涓瀵逛腑闂磋妭鐐癸紝N1 鍜?N2錛屼互鍙?qiáng)杈撳國檴傜傄?guī)暟閲忎粠涓や釜鍙樻垚浜嗗洓涓紙O1 鍒?O4錛夈?/p>

鎴戜滑灝嗗煿璁?N1錛岃繖鏍峰綋瀹冧竴鐪嬪埌 C 鎴?C++錛岃緗?y1=1錛岀湅鍒?Java 鎴? Python錛屽畠?yōu)畣璁揪|?y1=0銆傚悓鐞嗗煿璁?N2錛屽綋瀹冧竴鐪嬪埌 C 鎴?Java錛岃緗? y2=1錛岀湅鍒?C++ 鎴?Python錛岃緗?y2=0銆傛澶栵紝N1 鍜?N2 灝嗚緭鍑?1 鎴?0 緇?Oi銆傜幇鍦ㄥ鏋?N1 鐪嬪埌 C 鎴?C++錛岃屼笖 N2 鐪嬪埌 C 鎴栬? Java錛岄偅涔堥毦棰樹腑鐨勪唬鐮佹槸 C銆傝屽鏋?N1 鐪嬪埌 C 鎴?C++錛孨2 鐪嬪埌 C++ 鎴? Python錛岄偅涔堜唬鐮佸氨鏄?C++銆傝繖涓ā寮忓緢鏄捐屾槗瑙併傛墍浠ュ亣璁?Oi 宸茶鍩硅騫舵牴鎹笅闈㈣〃鏍肩殑鎯呭喌杈撳嚭 1 鎴?0銆?/p>

鏄犲皠鍒拌緭鍑猴紙浣滀負(fù)甯冨皵鍑芥暟錛夌殑涓棿鑺傜偣

N1 N2 O1 (C) O2 (C++) O3 (Java) O4 (Python)
0 0 0 0 0 1
0 1 0 0 1 0
1 0 0 1 0 0
1 1 1 0 0 0

濡傛灉榪欐牱鍙鐨勮瘽錛屾垜浠殑緗戠粶灝卞彲浠ヤ粠浠g爜紺轟緥涓瘑鍒嚭璇█浜嗐傝繖涓兂娉曞緢濂姐備絾鏄湪瀹炶返涓婂嵈鏈変簺闅句互緗俊銆備笉榪囪繖縐嶈В鍐蟲柟妗堥紺轟簡 C/C++ 鍜?Java/Python 杈撳叆琚竴涓秴騫抽潰鍒囧壊浜嗭紝鍚屾牱 C/Java 鍜? C++/Python 杈撳叆琚彟涓涓垏鍓層傝繖鏄竴涓綉緇滃煿璁殑瑙e喅鏂規(guī)錛岃總鍥炲湴瑙e喅浜嗚繖涓緭鍏ョ┖闂寸殑璁炬兂銆?/p>

Bill娉細(xì)鐪嬭搗鏉ュ緢寮哄ぇ

鍏充簬 delta 瑙勫垯

鍙︿竴縐嶅煿璁殑瑙勫垯鍙仛 delta 瑙勫垯銆傛劅鐭ュ櫒鍩硅瑙勫垯鏄熀浜庤繖鏍蜂竴縐嶆濊礬 鈥?鏉冪郴鏁扮殑璋冩暣鏄敱鐩爣鍜岃緭鍑虹殑宸垎鏂圭▼琛ㄨ揪寮忓喅瀹氥傝? delta 瑙勫垯鏄熀浜庢搴﹂檷钀借繖鏍蜂竴縐嶆濊礬銆傝繖涓鏉傜殑鏁板姒傚康鍙互涓句釜綆鍗曠殑渚嬪瓙鏉ヨ〃紺恒備粠緇欏畾鐨勫嚑鐐規(guī)潵鐪嬶紝鍚戝崡鐨勯偅鏉¤礬寰勬瘮鍚戜笢閭f潯鏇撮櫋浜涖傚悜涓滃氨鍍忎粠鎮(zhèn)礀涓婃帀 涓嬫潵錛屼絾鏄悜鍗楀氨鏄部鐫涓涓暐寰炬枩鐨勬枩鍧′笅鏉ワ紝鍚戣タ鍍忕櫥涓搴ч櫋宄殑灞憋紝鑰屽寳杈瑰垯鍒頒簡騫沖湴錛屽彧瑕佹參鎱㈢殑闂查涘氨鍙互浜嗐傛墍浠ユ?zhèn)ㄨ瀵绘墑勬槸鍒拌緫帚^鍦扮殑鎵鏈夎礬寰? 涓皢闄″抄鐨勬誨拰鍑忓皯鍒版渶灝忕殑璺緞銆傚湪鏉冪郴鏁扮殑璋冩暣涓紝紲炵粡緗戠粶灝嗕細(xì)鎵懼埌涓縐嶅皢璇樊鍑忓皯鍒版渶灝忕殑鏉冪郴鏁扮殑鍒嗛厤鏂瑰紡銆?

灝嗘垜浠殑緗戠粶闄愬埗涓烘病鏈夐殣钘忚妭鐐癸紝浣嗘槸鍙兘浼?xì)鏈変笉姝竴涓殑杈撳嚭鑺傜偣錛岃 p 鏄竴緇勫煿璁腑鐨勪竴涓厓绱狅紝t(p,n) 鏄浉搴旂殑杈撳嚭鑺傜偣 n 鐨勭洰鏍囥備絾鏄紝璁?y(p,n) 鐢變互涓婃彁鍒扮殑 squash 鍑芥暟 s 鍐沖畾錛岃繖閲? a(p,n) 鏄笌 p 鐩稿叧鐨?n 鐨勬縺媧誨嚱鏁幫紝鎴栬呯敤 (p,n) = s( a(p,n) ) 琛ㄧず涓轟笌 p 鐩稿叧鐨勮妭鐐?n 鐨?squash 榪囩殑嬋媧誨嚱鏁般備負(fù)緗戠粶璁懼畾鏉冪郴鏁幫紙姣忎釜 Wi錛夛紝涔熶負(fù)姣忎釜 p 鍜?n 寤虹珛 t(p,n) 涓?y(p,n) 鐨勫樊鍒嗭紝榪欏氨鎰忓懗鐫涓烘瘡涓?p 璁懼畾浜嗙綉緇滃叏閮ㄧ殑璇樊銆傚洜姝ゅ浜庢瘡緇勬潈緋繪暟鏉ヨ鏈変竴涓鉤鍧囪宸備絾鏄? delta 瑙勫垯鍙栧喅浜庢眰騫沖潎鍊兼柟娉曠殑綺劇‘搴︿互鍙?qiáng)璇樊銆傛垜浠厛涓嶈璁虹粏鑺傞棶棰橈紝鍙槸璇翠竴浜涗笌鏌愪簺 p 鍜?n 鐩稿叧鐨勮宸細(xì)?* square( t(p,n) - y(p,n) )銆傜幇鍦紝瀵逛簬姣忎釜 Wi錛屽鉤鍧囪宸畾涔夊涓嬶細(xì)


娓呭崟 2. 鏌ユ壘騫沖潎璇樊
sum = 0
FOR p = 1 TO M: # M is number of training vectors
FOR n = 1 TO N: # N is number of output nodes
sum = sum + (1/2 * (t(p,n)-y(p,n))^2)
average = 1/M * sum

delta 瑙勫垯灝辨槸渚濇嵁榪欎釜璇樊鐨勫畾涔夋潵瀹氫箟鐨勩傚洜涓鴻宸槸渚濇嵁閭d簺鍩硅鍚戦噺鏉ヨ鏄庣殑錛宒elta 瑙勫垯鏄竴縐嶈幏鍙栦竴涓壒孌婄殑鏉冪郴鏁伴泦浠ュ強(qiáng)涓涓壒孌婄殑鍚戦噺鐨勭畻娉曘傝屾敼鍙樻潈緋繪暟灝嗕細(xì)浣跨緇忕綉緇滅殑璇樊鏈灝忓寲銆傛垜浠笉闇瑕佽璁烘敮鎸佽繖涓畻娉曠殑寰Н鍒嗗錛屽彧瑕佽涓轟換浣? Wi 鍙戠敓鐨勫彉鍖栭兘鏄涓嬫墍紺哄氨澶熶簡錛?/p>
alpha * s'(a(p,n)) * (t(p,n) - y(p,n)) * X(p,i,n).

X(p,i,n) 鏄緭鍏ュ埌鑺傜偣 n 鐨?p 涓殑絎?i 涓厓绱狅紝alpha 鏄凡鐭ョ殑瀛︿範(fàn)鐜囥傛渶鍚?s'( a(p,n) ) 鏄笌 p 鐩稿叧鐨勭 n 涓妭鐐規(guī)縺媧葷殑 squashing 鍑芥暟鐨勫彉鍖栵紙媧劇敓錛夌巼錛岃繖灝辨槸 delta 瑙勫垯錛屽茍涓?Widrow 鍜? Stearns 鍚戞垜浠睍紺轟簡褰? alpha 闈炲父灝忕殑鏃跺欙紝鏉冪郴鏁板悜閲忔帴榪戞煇涓皢璇樊鏈灝忓寲鐨勫悜閲忋傜敤浜庢潈緋繪暟璋冭妭鐨勫熀浜? delta 瑙勫垯鐨勭畻娉曞氨鏄姝ゃ?


姊害闄嶈惤錛堢洿鍒拌宸皬鍒伴傚綋鐨勭▼搴︿負(fù)姝級
step 1: for each training vector, p, find a(p)
step 2: for each i, change Wi by:
alpha * s'(a(p,n)) * (t(p,n)-y(p,n)) * X(p,i,n)

榪欓噷鏈変竴浜涗笌鎰熺煡鍣ㄧ畻娉曠浉鍖哄埆鐨勯噸瑕佷笉鍚岀偣銆傛樉鐒訛紝鍦ㄦ潈緋繪暟璋冩暣鐨勫叕寮忎笅鏈夌潃瀹屽叏涓嶅悓鐨勫垎鏋愩俤elta 瑙勫垯綆楁硶鎬繪槸鍦ㄦ潈緋繪暟涓婅皟鏁達(dá)紝鑰屼笖榪欐槸寤虹珛鍦ㄧ浉瀵硅緭鍑虹殑嬋媧繪柟寮忎笂銆傛渶鍚庯紝榪欎笉涓瀹氶傜敤浜庡瓨鍦ㄩ殣钘忚妭鐐圭殑緗戠粶銆?/p>

鍙嶅悜浼犳挱榪欎竴綆楁硶鎶婃敮鎸?delta 瑙勫垯鐨勫垎鏋愭墿灞曞埌浜嗗甫鏈夐殣钘忚妭鐐圭殑紲炵粡緗戠粶銆備負(fù)浜嗙悊瑙h繖涓棶棰橈紝璁炬兂 Bob 緇?Alice 璁蹭簡涓涓晠浜嬶紝鐒跺悗 Alice 鍙堣緇欎簡 Ted錛孴ed 媯鏌ヤ簡榪欎釜浜嬪疄鐪熺浉錛屽彂鐜拌繖涓晠浜嬫槸閿欒鐨勩傜幇鍦?Ted 闇瑕佹壘鍑哄摢浜涢敊璇槸 Bob 閫犳垚鐨勮屽摢浜涘張褰掑拵浜? Alice銆傚綋杈撳嚭鑺傜偣浠庨殣钘忚妭鐐硅幏寰楄緭鍏ワ紝緗戠粶鍙戠幇鍑虹幇浜嗚宸紝鏉冪郴鏁扮殑璋冩暣闇瑕佷竴涓畻娉曟潵鎵懼嚭鏁翠釜璇樊鏄敱澶氬皯涓嶅悓鐨勮妭鐐歸犳垚鐨勶紝緗戠粶闇瑕侀棶錛?#8220;鏄皝璁╂垜璇叆姝ч旓紵鍒版庢牱鐨勭▼搴︼紵濡備綍寮ヨˉ錛?#8221;榪欐椂錛岀綉緇滆鎬庝箞鍋氬憿錛?


鍥?3錛?#8220;浠g爜璇嗗埆”鍙嶅悜浼犳挱鐨勭緇忕綉緇?

鍙嶅悜浼犳挱綆楁硶鍚屾牱鏉ユ簮浜庢搴﹂檷钀藉師鐞嗭紝鍦ㄦ潈緋繪暟璋冩暣鍒嗘瀽涓殑鍞竴涓嶅悓鏄秹鍙?qiáng)鍒? t(p,n) 涓?y(p,n) 鐨勫樊鍒嗐傞氬父鏉ヨ W i鐨勬敼鍙樺湪浜庯細(xì)

alpha * s'(a(p,n)) * d(n) * X(p,i,n)

鍏朵腑 d(n) 鏄殣钘忚妭鐐?n 鐨勫嚱鏁幫紝璁╂垜浠潵鐪嬶紙1錛塶 瀵逛換浣曠粰鍑虹殑杈撳嚭鑺傜偣鏈夊澶у獎鍝嶏紱錛?錛夎緭鍑鴻妭鐐規(guī)湰韜緗戠粶鏁翠綋鐨勮宸湁澶氬皯褰卞搷銆備竴鏂歸潰錛宯 褰卞搷涓涓緭鍑鴻妭鐐硅秺澶氾紝n 閫犳垚緗戠粶鏁翠綋鐨勮宸篃瓚婂銆傚彟涓鏂歸潰錛屽鏋滆緭鍑鴻妭鐐瑰獎鍝嶇綉緇滄暣浣撶殑璇樊瓚婂皯錛宯 瀵硅緭鍑鴻妭鐐圭殑褰卞搷涔熺浉搴斿噺灝戙傝繖閲?d(j) 鏄緗戠粶鐨勬暣浣撹宸殑鍩哄鹼紝W(xué)(n,j) 鏄?n 瀵?j 閫犳垚鐨勫獎鍝嶏紝d(j) * W(n,j) 鏄繖涓ょ褰卞搷鐨勬誨拰銆備絾鏄?n 鍑犱箮鎬繪槸褰卞搷澶氫釜杈撳嚭鑺傜偣錛屼篃璁鎬細(xì)褰卞搷姣忎竴涓緭鍑虹粨鐐癸紝榪欐牱錛宒(n) 鍙互琛ㄧず涓猴細(xì)

SUM(d(j)*W(n,j))

榪欓噷 j 鏄竴涓粠 n 鑾峰緱杈撳叆鐨勮緭鍑鴻妭鐐癸紝鑱旂郴璧鋒潵錛屾垜浠氨寰楀埌浜嗕竴涓煿璁鍒欙紝絎?1 閮ㄥ垎錛氬湪闅愯棌鑺傜偣 n 鍜岃緭鍑鴻妭鐐?j 涔嬮棿鏉冪郴鏁版敼鍙橈紝濡備笅鎵紺猴細(xì)

alpha * s'(a(p,n))*(t(p,n) - y(p,n)) * X(p,n,j)

絎?2 閮ㄥ垎錛氬湪杈撳叆鑺傜偣 i 鍜岃緭鍑鴻妭鐐?n 涔嬮棿鏉冪郴鏁版敼鍙橈紝濡備笅鎵紺猴細(xì)

alpha * s'(a(p,n)) * sum(d(j) * W(n,j)) * X(p,i,n)

榪欓噷姣忎釜浠?n 鎺ユ敹杈撳叆鐨勮緭鍑鴻妭鐐?j 閮戒笉鍚屻傚叧浜庡弽鍚戜紶鎾畻娉曠殑鍩烘湰鎯呭喌澶ц嚧濡傛銆?/p>

灝?Wi 鍒濆鍖栦負(fù)灝忕殑闅忔満鍊箋?/p>

浣胯宸皬鍒伴傚綋鐨勭▼搴﹁閬靛驚鐨勬楠?/span>

絎?1 姝ワ細(xì)杈撳叆鍩硅鍚戦噺銆?
絎?2 姝ワ細(xì)闅愯棌鑺傜偣璁$畻瀹冧滑鐨勮緭鍑?
絎?3 姝ワ細(xì)杈撳嚭鑺傜偣鍦ㄧ 2 姝ョ殑鍩虹涓婅綆楀畠浠殑杈撳嚭銆?
絎?4 姝ワ細(xì)璁$畻絎?3 姝ユ墍寰楃殑緇撴灉鍜屾湡鏈涘間箣闂寸殑宸?
絎?5 姝ワ細(xì)鎶婄 4 姝ョ殑緇撴灉濉叆鍩硅瑙勫垯鐨勭 1 閮ㄥ垎銆?
絎?6 姝ワ細(xì)瀵逛簬姣忎釜闅愯棌鑺傜偣 n錛岃綆?d(n)銆?
絎?7 姝ワ細(xì)鎶婄 6 姝ョ殑緇撴灉濉叆鍩硅瑙勫垯鐨勭 2 閮ㄥ垎銆?

閫氬父鎶婄 1 姝ュ埌絎?3 姝ョО涓? 姝e悜浼犳挱錛屾妸絎?4 姝ュ埌絎?7 姝ョО涓? 鍙嶅悜浼犳挱銆傚弽鍚戜紶鎾殑鍚嶅瓧鐢辨鑰屾潵銆?

鍦ㄦ帉鎻′簡鍙嶅悜浼犳挱綆楁硶鍚庯紝鍙互鏉ョ湅鎴戜滑鐨勮瘑鍒簮浠g爜鏍鋒湰璇█鐨勯毦棰樸備負(fù)浜嗚В鍐寵繖涓棶棰橈紝鎴戜滑鎻愪緵浜? Neil Schemenauer 鐨?Python 妯″瀷 bpnn銆傜敤瀹冪殑妯″瀷瑙e喅闂鐪熸槸闅句互緗俊鐨勭畝鍗曪紝鍦ㄦ垜浠殑綾? NN2 閲屽畾鍒朵簡涓涓被 NN 錛屼笉榪囨垜浠殑鏀瑰彉鍙槸璋冩暣浜嗚〃杈炬柟寮忓拰鏁翠釜榪囩▼鐨勮緭鍑猴紝騫舵病鏈夋秹鍙?qiáng)鍒敖帡娉曘傚熀鏈殑浠g爜濡備笅鎵紺猴細(xì)


娓呭崟 3錛氱敤 bpnn.py 寤虹珛涓涓緇忕綉緇?/strong>
                # Create the network (number of input, hidden, and training nodes)
net = NN2(INPUTS, HIDDEN, OUTPUTS)
# create the training and testing data
trainpat = []
testpat = []
for n in xrange(TRAINSIZE+TESTSIZE):

#... add vectors to each set
# train it with some patterns
net.train(trainpat, iterations=ITERATIONS, N=LEARNRATE, M=MOMENTUM)
# test it
net.test(testpat)
# report trained weights
net.weights()


褰撶劧鎴戜滑闇瑕佽緭鍏ユ暟鎹紝瀹炵敤紼嬪簭 code2data.py 鎻愪緵浜嗚繖涓姛鑳姐傚畠鐨勭晫闈㈠緢鐩磋錛氬彧瑕佸皢涓鍫嗘墿灞曞悕鍚勪笉鐩稿悓鐨勬枃浠舵斁鍒頒竴涓瓙鐩綍 ./code 涓紝鐒跺悗榪愯榪欎釜瀹炵敤紼嬪簭錛屽茍鍒椾婦閭d簺鎵╁睍鍚嶄綔涓哄懡浠ら夐」銆備緥濡傦細(xì)

python code2data.py py c java

鎮(zhèn)ㄥ緱鍒扮殑鏄竴鍫?STDOUT 涓婄殑鍚戦噺錛屽彲浠ユ妸榪欎簺鍚戦噺杈撳叆鍒板彟涓涓繘紼嬫垨鑰呴噸瀹氬悜鍒頒竴涓枃浠訛紝瀹冪殑杈撳嚭濡備笅鎵紺猴細(xì)


娓呭崟 4錛欳ode2Data 鐨勮緭鍑哄悜閲?/strong>
0.15 0.01 0.01 0.04 0.07 0.00 0.00 0.03 0.01 0.00 0.00 0.00 0.05 0.00 > 1 0 0
0.14 0.00 0.00 0.05 0.13 0.00 0.00 0.00 0.02 0.00 0.00 0.00 0.13 0.00 > 1 0 0
[...]

璁╂垜浠洖蹇嗕竴涓嬭緭鍏ュ奸兘鏄笉鍚岀壒孌婂瓧絎﹀嚭鐜扮殑瑙勬牸鍖栨暟鐩紝鐩爣鍊鹼紙鍦ㄥぇ浜庡彿浠ュ悗錛夋槸 YES/NO錛屽畠浠h〃鍖呭惈榪欎簺瀛楃鐨勬簮浠g爜鏂囦歡鐨勭被鍨嬶紝涓嶈繃瀵逛簬浠涔堟槸浠涔堟潵璇達(dá)紝騫舵病鏈夐潪甯告槑鏄劇殑涓滆タ銆傛暟瀛楀彲浠ユ槸杈撳叆鎴栨湡鏈涚殑 浠繪剰鍊?/em>錛岃繖鎵嶆槸鏈閲嶈鐨勩?

涓嬩竴姝ユ槸榪愯瀹為檯鐨?code_recognizer.py 紼嬪簭銆傝繖闇瑕侊紙鍦? STDIN 涓級鍍忎笂闈竴鏍風(fēng)殑鍚戦噺闆嗐傝繖涓▼搴忔湁涓涓寘錛屽畠鑳藉鏍規(guī)嵁瀹為檯鏂囦歡鎺ㄦ柇鍑洪渶瑕佸灝戣緭鍏ヨ妭鐐癸紙璁$畻鍦ㄥ唴鐨勫拰鏈熸湜鐨勶級錛岄夋嫨闅愯棌鑺傜偣鐨勬暟鐩槸涓涓瘈紿嶃傚浜庢簮浠g爜鐨勮瘑鍒紝6 鍒?8 涓殣钘忚妭鐐逛技涔庡伐浣滃緱寰堝ソ銆傚鏋滄墦綆楄瘯楠岀綉緇滀粠鑰屽彂鐜板浜庤繖浜涗笉鍚岀殑閫夐」瀹冩槸濡備綍鍋氱殑錛屾?zhèn)ㄥ彲浠ヨ鐩栧懡渥o(hù)琛屼腑鐨勬墍鏈夊弬鏁幫紝浣嗘瘡涓嬈¤繍琛岃繕鏄細(xì)鑰楄垂涓浜涙椂闂淬傚煎緱娉ㄦ剰鐨勬槸錛? code_recognizer.py 灝嗗畠鐨勶紙澶х殑錛夋祴璇曠粨鏋滄枃浠跺彂閫佸埌 STDOUT錛岃屽皢涓浜涘弸濂界殑娑堟伅鏀懼湪 STDERR 閲屻傝繖鏍峰湪澶ч儴鍒嗘椂闂撮噷錛屼負(fù)浜嗗畨鍏ㄤ繚綆★紝鎮(zhèn)ㄥ皢浼?xì)鎶?STDOUT 瀹氬悜鍒頒竴涓枃浠訛紝騫剁洃瑙嗛拡瀵硅繘紼嬪拰緇撴灉姒傝鐨?STDERR銆?/p>
娓呭崟 5錛氳繍琛? code_recognizer.py
> code2data.py py c java | code_recognizer.py > test_results.txt 
Total bytes of py-source: 457729
Total bytes of c-source: 245197
Total bytes of java-source: 709858
Input set: ) ( _ . = ; " , ' * / { } : - 0 + 1 [ ]
HIDDEN = 8
LEARNRATE = 0.5
ITERATIONS = 1000
TRAINSIZE = 500
OUTPUTS = 3
MOMENTUM = 0.1
ERROR_CUTOFF = 0.01
TESTSIZE = 500
INPUTS = 20
error -> 95.519... 23.696... 19.727... 14.012... 11.058... 9.652...
8.858... 8.236... 7.637... 7.065... 6.398... 5.413... 4.508...
3.860... 3.523... 3.258... 3.026... 2.818... 2.631... 2.463...
2.313... 2.180... 2.065... 1.965... 1.877... 1.798... 1.725...
[...]
0.113... 0.110... 0.108... 0.106... 0.104... 0.102... 0.100...
0.098... 0.096... 0.094... 0.093... 0.091... 0.089... 0.088...
0.086... 0.085... 0.084...
Success rate against test data: 92.60%

涓嶆柇鍑忓皯璇樊鏄釜寰堝ソ鐨勫厗澶達(dá)紝榪欒嚦灝戝湪涓孌甸暱鏃墮棿閲屾墍鑾峰緱鐨勪竴縐嶈繘姝ワ紝涓旀渶鍚庣殑緇撴灉蹇呯劧鏄繁鍏ヤ漢蹇冪殑銆傚氨鎴戜滑鐨勮鐐硅岃█錛岀綉緇滃畬鎴愪簡涓欏瑰煎緱灝婃暚鐨勫伐浣滐紝鏉ヨ瘑鍒唬鐮? 鈥?鎴戜滑灝嗕細(xì)涔愭剰鍊懼惉錛屽浜庢?zhèn)ㄧ殑鏁板瓧鍚戦噺瀹冩槸濡備綍鍋氱殑銆?



鍙傝冭祫鏂?





Bill Hsu 2008-08-30 20:08 鍙戣〃璇勮
]]>
寮濮嬪啓鑴氭湰寮曟搸浜?/title><link>http://m.shnenglu.com/billhsu/archive/2008/07/28/57340.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Mon, 28 Jul 2008 04:36:00 GMT</pubDate><guid>http://m.shnenglu.com/billhsu/archive/2008/07/28/57340.html</guid><wfw:comment>http://m.shnenglu.com/billhsu/comments/57340.html</wfw:comment><comments>http://m.shnenglu.com/billhsu/archive/2008/07/28/57340.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://m.shnenglu.com/billhsu/comments/commentRss/57340.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/billhsu/services/trackbacks/57340.html</trackback:ping><description><![CDATA[<font color="#000000">棰樿錛?br> Python鏄嵎鍏頒漢鍐欑殑錛孯uby鏄棩鏈漢鍐欑殑錛孡ua鏄反瑗夸漢鍐欑殑錛屾垜榪欎釜涓浗浜哄彧鑳藉湪榪欓噷鑴哥孩銆?br> 鈥斺擟SDN涓葷紪 瀛熷博<br> 涓嶆墦綆楄嚜璁ㄦ病瓚e湴鍐欎釜瑕佽秴榪嘝ython,Ruby,Lua鐨勮剼鏈紩鎿庯紝浠ラ敾鐐艱兘鍔涗負(fù)涓匯?br> 浼拌瀹屾垚浠ュ悗鍜孡ua鏈夌偣鍍忥紝瀹楁棬鏄細(xì)<span style="color: red;">浠ユ瘮Lua鏇寸煭涓鴻崳錛屼互姣擯ython鏇撮暱涓鴻?/span> :-)<br> 鈹忊攣鈹撱銆銆鈹忊攣鈹佲敁銆銆銆鈹忊敁銆銆銆銆銆<br> 鈹冣攦鈹b攣鈹斥攣鈹攣鈹佲晪鈹佲敵鈹斥晪鈺嬧攣鈹斥攣鈹佲敁<br> 鈹冦鈹攣鈹冣攦鈹b攣鈹佲攦鈹b敨鈹忊敨鈹冣攦鈹b敁鈹忊敍<br> 鈹椻敾鈹燴敾鈹攺鈹燴攣鈹佲敾鈹佲敾鈹涒敆鈹攺鈹涒敆鈹涖<br>              鈹椻敍銆銆銆銆銆銆銆銆鈹椻敍銆銆銆銆<br> 寮曟搸灝卞彨RapScript濂戒簡(<strong><font color="#ff0000">R</font></strong>uby,Lu<strong><font color="#ff0000">a</font></strong>,<strong><font color="#ff0000">P</font></strong>ython 鍔犱竴璧?<br><img alt="" src="http://m.shnenglu.com/images/cppblog_com/billhsu/7643/o_Rap.JPG"><br> </font> <img src ="http://m.shnenglu.com/billhsu/aggbug/57340.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2008-07-28 12:36 <a href="http://m.shnenglu.com/billhsu/archive/2008/07/28/57340.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <a href="http://m.shnenglu.com/">青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品</a> <div style="position:fixed;left:-9000px;top:-9000px;"><font id="pjuwb"></font><button id="pjuwb"><pre id="pjuwb"></pre></button><sub id="pjuwb"></sub><tbody id="pjuwb"><var id="pjuwb"><address id="pjuwb"></address></var></tbody><listing id="pjuwb"><label id="pjuwb"><strong id="pjuwb"></strong></label></listing><wbr id="pjuwb"><small id="pjuwb"><tbody id="pjuwb"></tbody></small></wbr><ins id="pjuwb"><xmp id="pjuwb"></xmp></ins><style id="pjuwb"></style><label id="pjuwb"><em id="pjuwb"><li id="pjuwb"></li></em></label><samp id="pjuwb"></samp><menu id="pjuwb"><input id="pjuwb"></input></menu><pre id="pjuwb"><tbody id="pjuwb"><tfoot id="pjuwb"><button id="pjuwb"></button></tfoot></tbody></pre><form id="pjuwb"></form><i id="pjuwb"><style id="pjuwb"><label id="pjuwb"><sup id="pjuwb"></sup></label></style></i><li id="pjuwb"><table id="pjuwb"><abbr id="pjuwb"></abbr></table></li><video id="pjuwb"></video><dfn id="pjuwb"></dfn><progress id="pjuwb"></progress><strong id="pjuwb"></strong><mark id="pjuwb"></mark><em id="pjuwb"></em><tbody id="pjuwb"><p id="pjuwb"><strike id="pjuwb"><acronym id="pjuwb"></acronym></strike></p></tbody><option id="pjuwb"></option><strike id="pjuwb"></strike><u id="pjuwb"></u><td id="pjuwb"><center id="pjuwb"><tr id="pjuwb"></tr></center></td><em id="pjuwb"><mark id="pjuwb"><em id="pjuwb"><tt id="pjuwb"></tt></em></mark></em><strong id="pjuwb"></strong><wbr id="pjuwb"></wbr><s id="pjuwb"></s><strong id="pjuwb"></strong><legend id="pjuwb"></legend><nav id="pjuwb"></nav><dl id="pjuwb"><th id="pjuwb"><dl id="pjuwb"></dl></th></dl><noframes id="pjuwb"><ins id="pjuwb"></ins></noframes><font id="pjuwb"></font><strike id="pjuwb"><i id="pjuwb"><style id="pjuwb"><label id="pjuwb"></label></style></i></strike><output id="pjuwb"></output><thead id="pjuwb"><pre id="pjuwb"></pre></thead><source id="pjuwb"></source><menuitem id="pjuwb"><wbr id="pjuwb"></wbr></menuitem><pre id="pjuwb"><span id="pjuwb"><pre id="pjuwb"><big id="pjuwb"></big></pre></span></pre><cite id="pjuwb"><fieldset id="pjuwb"><s id="pjuwb"><rt id="pjuwb"></rt></s></fieldset></cite><big id="pjuwb"><progress id="pjuwb"><big id="pjuwb"></big></progress></big><samp id="pjuwb"><delect id="pjuwb"></delect></samp><dl id="pjuwb"></dl><strike id="pjuwb"><nav id="pjuwb"><dl id="pjuwb"><strong id="pjuwb"></strong></dl></nav></strike><tbody id="pjuwb"><b id="pjuwb"><optgroup id="pjuwb"><rp id="pjuwb"></rp></optgroup></b></tbody><em id="pjuwb"></em><xmp id="pjuwb"><blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote></xmp> <i id="pjuwb"><abbr id="pjuwb"><i id="pjuwb"><abbr id="pjuwb"></abbr></i></abbr></i><center id="pjuwb"><acronym id="pjuwb"><center id="pjuwb"></center></acronym></center><pre id="pjuwb"></pre><ul id="pjuwb"><thead id="pjuwb"></thead></ul><blockquote id="pjuwb"><pre id="pjuwb"><sup id="pjuwb"></sup></pre></blockquote><acronym id="pjuwb"></acronym><big id="pjuwb"><s id="pjuwb"></s></big><th id="pjuwb"></th><th id="pjuwb"></th><tbody id="pjuwb"></tbody><thead id="pjuwb"><strike id="pjuwb"></strike></thead><th id="pjuwb"><dl id="pjuwb"><wbr id="pjuwb"></wbr></dl></th><dl id="pjuwb"><strong id="pjuwb"></strong></dl><abbr id="pjuwb"><noframes id="pjuwb"><noscript id="pjuwb"></noscript></noframes></abbr><td id="pjuwb"><ol id="pjuwb"></ol></td><li id="pjuwb"><noscript id="pjuwb"><abbr id="pjuwb"></abbr></noscript></li><small id="pjuwb"><bdo id="pjuwb"><nav id="pjuwb"></nav></bdo></small><style id="pjuwb"></style><optgroup id="pjuwb"><table id="pjuwb"></table></optgroup><center id="pjuwb"><tr id="pjuwb"><dfn id="pjuwb"></dfn></tr></center><th id="pjuwb"></th><u id="pjuwb"></u><tfoot id="pjuwb"><legend id="pjuwb"><i id="pjuwb"></i></legend></tfoot><mark id="pjuwb"></mark><meter id="pjuwb"></meter><nav id="pjuwb"></nav><acronym id="pjuwb"><pre id="pjuwb"><acronym id="pjuwb"><ul id="pjuwb"></ul></acronym></pre></acronym><acronym id="pjuwb"><pre id="pjuwb"><acronym id="pjuwb"><ul id="pjuwb"></ul></acronym></pre></acronym><nobr id="pjuwb"></nobr><sub id="pjuwb"><th id="pjuwb"><menuitem id="pjuwb"><wbr id="pjuwb"></wbr></menuitem></th></sub><thead id="pjuwb"><sub id="pjuwb"></sub></thead><ul id="pjuwb"><address id="pjuwb"><menuitem id="pjuwb"><meter id="pjuwb"></meter></menuitem></address></ul><dfn id="pjuwb"></dfn><pre id="pjuwb"></pre><input id="pjuwb"><cite id="pjuwb"><fieldset id="pjuwb"></fieldset></cite></input><u id="pjuwb"><form id="pjuwb"><u id="pjuwb"></u></form></u><kbd id="pjuwb"><em id="pjuwb"><mark id="pjuwb"></mark></em></kbd><tr id="pjuwb"></tr><del id="pjuwb"><form id="pjuwb"><address id="pjuwb"></address></form></del><tfoot id="pjuwb"><legend id="pjuwb"><ol id="pjuwb"><dl id="pjuwb"></dl></ol></legend></tfoot><menu id="pjuwb"><nobr id="pjuwb"><th id="pjuwb"><nobr id="pjuwb"></nobr></th></nobr></menu><fieldset id="pjuwb"></fieldset><pre id="pjuwb"><blockquote id="pjuwb"><samp id="pjuwb"></samp></blockquote></pre><xmp id="pjuwb"><sup id="pjuwb"><pre id="pjuwb"></pre></sup></xmp><span id="pjuwb"><progress id="pjuwb"></progress></span><font id="pjuwb"></font><var id="pjuwb"><abbr id="pjuwb"></abbr></var><strong id="pjuwb"><label id="pjuwb"><i id="pjuwb"><legend id="pjuwb"></legend></i></label></strong><tr id="pjuwb"><em id="pjuwb"><em id="pjuwb"><output id="pjuwb"></output></em></em></tr><thead id="pjuwb"><strike id="pjuwb"></strike></thead> <acronym id="pjuwb"></acronym><i id="pjuwb"></i><tt id="pjuwb"></tt><rt id="pjuwb"><source id="pjuwb"><rt id="pjuwb"></rt></source></rt><strike id="pjuwb"><acronym id="pjuwb"></acronym></strike><del id="pjuwb"></del><font id="pjuwb"><output id="pjuwb"><ins id="pjuwb"><output id="pjuwb"></output></ins></output></font><kbd id="pjuwb"><tr id="pjuwb"><kbd id="pjuwb"></kbd></tr></kbd><pre id="pjuwb"><sup id="pjuwb"><delect id="pjuwb"><samp id="pjuwb"></samp></delect></sup></pre><samp id="pjuwb"></samp><track id="pjuwb"></track><tr id="pjuwb"></tr><center id="pjuwb"></center><fieldset id="pjuwb"></fieldset><i id="pjuwb"></i><td id="pjuwb"></td><rt id="pjuwb"></rt><object id="pjuwb"></object><pre id="pjuwb"><progress id="pjuwb"><sub id="pjuwb"><thead id="pjuwb"></thead></sub></progress></pre><kbd id="pjuwb"><tr id="pjuwb"><option id="pjuwb"></option></tr></kbd><output id="pjuwb"><ins id="pjuwb"></ins></output><ol id="pjuwb"></ol><source id="pjuwb"></source><strong id="pjuwb"></strong><ruby id="pjuwb"></ruby><sub id="pjuwb"><meter id="pjuwb"><menuitem id="pjuwb"><meter id="pjuwb"></meter></menuitem></meter></sub><pre id="pjuwb"></pre><center id="pjuwb"></center><tr id="pjuwb"><tbody id="pjuwb"><xmp id="pjuwb"><dd id="pjuwb"></dd></xmp></tbody></tr><video id="pjuwb"></video><pre id="pjuwb"></pre><form id="pjuwb"><optgroup id="pjuwb"></optgroup></form><samp id="pjuwb"></samp><kbd id="pjuwb"></kbd><strong id="pjuwb"><option id="pjuwb"></option></strong><object id="pjuwb"></object><abbr id="pjuwb"><noframes id="pjuwb"><abbr id="pjuwb"></abbr></noframes></abbr><ul id="pjuwb"><del id="pjuwb"><button id="pjuwb"><pre id="pjuwb"></pre></button></del></ul><abbr id="pjuwb"></abbr><strong id="pjuwb"><code id="pjuwb"><strong id="pjuwb"></strong></code></strong><option id="pjuwb"></option><optgroup id="pjuwb"><bdo id="pjuwb"><code id="pjuwb"></code></bdo></optgroup><mark id="pjuwb"><em id="pjuwb"><font id="pjuwb"></font></em></mark><acronym id="pjuwb"><code id="pjuwb"></code></acronym><dl id="pjuwb"></dl><em id="pjuwb"></em><object id="pjuwb"><input id="pjuwb"><object id="pjuwb"></object></input></object><output id="pjuwb"><dd id="pjuwb"></dd></output><option id="pjuwb"><button id="pjuwb"><option id="pjuwb"></option></button></option><small id="pjuwb"></small></div> <a href="http://sz-jyqj.com" target="_blank">国产九九精品视频</a>| <a href="http://bizssr.com" target="_blank">午夜一区二区三视频在线观看</a>| <a href="http://rainbowbpm.com" target="_blank">一区二区三区精品视频</a>| <a href="http://www033459.com" target="_blank">欧美成人免费va影院高清</a>| <a href="http://clgtzz.com" target="_blank">欧美在线观看网址综合</a>| <a href="http://wce-expo.com" target="_blank">亚洲一区二区三区四区中文</a>| <a href="http://6868681.com" target="_blank">在线视频精品一</a>| <a href="http://yytaotu.com" target="_blank">亚洲国产欧美另类丝袜</a>| <a href="http://liuyangzi.com" target="_blank">亚洲欧美日韩国产精品</a>| <a href="http://wwwavtb1122.com" target="_blank">亚洲一区在线观看视频 </a>| <a href="http://wwwbaoyu66.com" target="_blank">欧美日一区二区在线观看 </a>| <a href="http://qscxx3.com" target="_blank">欧美视频在线观看免费</a>| <a href="http://7a6a.com" target="_blank">国产精品一二三</a>| <a href="http://yp77741.com" target="_blank">国内精品美女在线观看</a>| <a href="http://5553303.com" target="_blank">在线观看成人av电影</a>| <a href="http://64pppp.com " target="_blank">亚洲久久在线</a>| <a href="http://c7lc.com" target="_blank">新67194成人永久网站</a>| <a href="http://by4425.com" target="_blank">美女视频网站黄色亚洲</a>| <a href="http://jiejiesao8.com" target="_blank">亚洲日本中文字幕免费在线不卡</a>| <a href="http://www-13978.com" target="_blank">中文一区字幕</a>| <a href="http://whaylan.com" target="_blank">欧美在线观看天堂一区二区三区</a>| <a href="http://15013010203.com" target="_blank">美日韩精品免费观看视频</a>| <a href="http://55555549.com" target="_blank">欧美日韩中文字幕精品</a>| <a href="http://vipaiqiyi.com" target="_blank">国产欧美亚洲视频</a>| <a href="http://lyminghang.com" target="_blank">亚洲国产一区二区a毛片</a>| <a href="http://xp1025.com" target="_blank">亚洲主播在线播放</a>| <a href="http://cmtqd.com" target="_blank">免费观看成人鲁鲁鲁鲁鲁视频</a>| <a href="http://www18818.com" target="_blank">亚洲精品一区二区网址 </a>| <a href="http://www456456.com" target="_blank">亚洲美女淫视频</a>| <a href="http://489633.com" target="_blank">久久成人18免费观看</a>| <a href="http://75yyyy.com" target="_blank">欧美日韩国产一区二区三区</a>| <a href="http://bnb-gndc.com" target="_blank">国产日韩欧美精品一区</a>| <a href="http://haole081.com" target="_blank">99re热精品</a>| <a href="http://ooonefteprompellets.com" target="_blank">久久久久成人精品免费播放动漫</a>| <a href="http://4466o.com" target="_blank">亚洲精品欧美日韩</a>| <a href="http://iotbzw.com" target="_blank">久久综合伊人77777蜜臀</a>| <a href="http://www36633.com" target="_blank">国产精品三级视频</a>| <a href="http://wwwzmcc1.com" target="_blank">亚洲精品乱码久久久久久蜜桃麻豆</a>| <a href="http://toomicsvip.com" target="_blank">欧美一区二区日韩</a>| <a href="http://77017w.com" target="_blank">亚洲精品一线二线三线无人区</a>| <a href="http://44cgcg.com" target="_blank">久久久精品一品道一区</a>| <a href="http://92ye.com" target="_blank">国产精品电影在线观看</a>| <a href="http://caoliu2022.com" target="_blank">亚洲伦理一区</a>| <a href="http://868482.com" target="_blank">欧美国产日本高清在线</a>| <a href="http://096577.com" target="_blank">久久国产精品色婷婷</a>| <a href="http://687673.com" target="_blank">国产日韩在线亚洲字幕中文</a>| <a href="http://www-787788.com" target="_blank">亚洲一级片在线看</a>| <a href="http://4379d.com" target="_blank">亚洲精品中文字幕在线</a>| <a href="http://www24699.com" target="_blank">欧美成人午夜77777</a>| <a href="http://tianxiantxtv.com" target="_blank">在线观看一区二区精品视频</a>| <a href="http://expolucy.com" target="_blank">久久精品一区</a>| <a href="http://www-5888c.com" target="_blank">午夜国产欧美理论在线播放</a>| <a href="http://kedou09.com" target="_blank">欧美午夜无遮挡</a>| <a href="http://nxhjzddata.com" target="_blank">在线视频一区观看</a>| <a href="http://www1982t.com" target="_blank">亚洲经典自拍</a>| <a href="http://laodaohang.com" target="_blank">欧美大胆成人</a>| <a href="http://jav69me.com" target="_blank">亚洲欧洲日产国产综合网</a>| <a href="http://1588vip.com" target="_blank">久久综合久久88</a>| <a href="http://199372.com" target="_blank">久久精品女人天堂</a>| <a href="http://929889.com" target="_blank">亚洲一区黄色</a>| <a href="http://124909.com" target="_blank">在线视频精品</a>| <a href="http://niceboybao.com" target="_blank">亚洲精品国产欧美</a>| <a href="http://1188188.com" target="_blank">免费观看一区</a>| <a href="http://www22336.com" target="_blank">亚洲精品在线观看视频</a>| <a href="http://605799.com" target="_blank">亚洲高清自拍</a>| <a href="http://05511253.com" target="_blank">欧美成人国产一区二区</a>| <a href="http://korean-edu.com" target="_blank">亚洲福利一区</a>| <a href="http://www-369111.com" target="_blank">亚洲国产精品热久久</a>| <a href="http://88848885.com" target="_blank">欧美成人资源</a>| <a href="http://678255.com" target="_blank">亚洲一区在线看</a>| <a href="http://91mase.com" target="_blank">亚洲欧美日韩系列</a>| <a href="http://caogb.com" target="_blank">国产主播一区二区三区四区</a>| <a href="http://aqd1t.com" target="_blank">久久久久久尹人网香蕉</a>| <a href="http://sz-jyqj.com" target="_blank">久久精品免费电影</a>| <a href="http://9a9u.com" target="_blank">亚洲精品看片</a>| <a href="http://quoviajes.com" target="_blank">亚洲视频一区二区在线观看</a>| <a href="http://hmm47.com" target="_blank">国产精品毛片va一区二区三区 </a>| <a href="http://44368com.com" target="_blank">国产一本一道久久香蕉</a>| <a href="http://mmmm37.com" target="_blank">久久久综合网站</a>| <a href="http://www-14333.com" target="_blank">久久视频在线视频</a>| <a href="http://1zz8903.com" target="_blank">亚洲日本无吗高清不卡</a>| <a href="http://hdsywang.com" target="_blank">日韩亚洲欧美在线观看</a>| <a href="http://jiujiuri8.com" target="_blank">国产日韩精品一区二区</a>| <a href="http://ebmsci.com" target="_blank">免费亚洲电影在线观看</a>| <a href="http://2996611.com" target="_blank">欧美精品偷拍</a>| <a href="http://895658.com" target="_blank">久久狠狠婷婷</a>| <a href="http://xjhzgy.com" target="_blank">欧美成人午夜视频</a>| <a href="http://338pv.com" target="_blank">亚洲欧美日韩成人</a>| <a href="http://220fuke.com" target="_blank">久久久久久久999精品视频</a>| <a href="http://www-45553.com" target="_blank">亚洲人精品午夜在线观看</a>| <a href="http://www962aa.com" target="_blank">亚洲深夜激情</a>| <a href="http://actinview.com" target="_blank">亚洲国产精品久久久</a>| <a href="http://707377c.com" target="_blank">99re亚洲国产精品</a>| <a href="http://wwzz3.com" target="_blank">狠狠色综合色区</a>| <a href="http://junhuatesu.com" target="_blank">亚洲精选成人</a>| <a href="http://yiqiluntan.com" target="_blank">国产亚洲午夜</a>| <a href="http://8484vivo.com" target="_blank">亚洲精品一区二区三区福利</a>| <a href="http://4466777.com" target="_blank">国产曰批免费观看久久久</a>| <a href="http://666777v3.com" target="_blank">亚洲激情小视频</a>| <a href="http://vipaiqiyi.com" target="_blank">国产亚洲一二三区</a>| <a href="http://84172199.com" target="_blank">亚洲欧洲一区二区在线观看</a>| <a href="http://www11111111.com" target="_blank">国产欧美日韩一区二区三区在线</a>| <a href="http://wwwavtb1122.com" target="_blank">亚洲电影免费观看高清</a>| <a href="http://2225101.com" target="_blank">国产婷婷精品</a>| <a href="http://hczztj.com" target="_blank">一区二区三区视频在线播放</a>| <a href="http://shalxee.com" target="_blank">亚洲电影成人</a>| <a href="http://977dy.com" target="_blank">欧美一区=区</a>| <a href="http://qkspvip.com" target="_blank">亚洲午夜精品网</a>| <a href="http://969093.com" target="_blank">欧美大片网址</a>| <a href="http://1323666.com" target="_blank">美女在线一区二区</a>| <a href="http://www-q28.com" target="_blank">国产综合久久久久久鬼色</a>| <a href="http://lysyfls.com" target="_blank">日韩图片一区</a>| <a href="http://354eee.com" target="_blank">亚洲精品一区二区三区不</a>| <a href="http://405151.com" target="_blank">久久九九国产精品</a>| <a href="http://jrtkpx.com" target="_blank">欧美在线观看视频在线</a>| <a href="http://www-45553.com" target="_blank">欧美了一区在线观看</a>| <a href="http://678255.com" target="_blank">免费在线看一区</a>| <a href="http://hbzbjxzz.com" target="_blank">国产一区二区高清不卡</a>| <a href="http://5gn4y.com" target="_blank">亚洲一区二区三区三</a>| <a href="http://778kb.com" target="_blank">国产精品99久久久久久白浆小说</a>| <a href="http://666777v3.com" target="_blank">美日韩精品视频</a>| <a href="http://yw1396.com" target="_blank">欧美国产日韩a欧美在线观看</a>| <a href="http://www068hs.com" target="_blank">性一交一乱一区二区洋洋av</a>| <a href="http://hs045.com" target="_blank">欧美全黄视频</a>| <a href="http://www369cf.com" target="_blank">欧美激情影音先锋</a>| <a href="http://xcao10.com" target="_blank">精品不卡一区</a>| <a href="http://hlyjh.com" target="_blank">久久不射中文字幕</a>| <a href="http://621767.com" target="_blank">久久精品夜色噜噜亚洲a∨</a>| <a href="http://gbandal.com" target="_blank">国产精品另类一区</a>| <a href="http://ooo789.com" target="_blank">一区二区日韩精品</a>| <a href="http://kanzhelu31.com" target="_blank">99国产精品久久久久久久久久</a>| <a href="http://hjk56.com" target="_blank">久久青草福利网站</a>| <a href="http://spyfaw.com" target="_blank">美女国产一区</a>| <a href="http://kissgz.com" target="_blank">在线国产精品一区</a>| <a href="http://360cabin.com" target="_blank">久久综合给合</a>| <a href="http://18loutv.com" target="_blank">欧美大片免费</a>| <a href="http://3dxxoo.com" target="_blank">亚洲美女av在线播放</a>| <a href="http://xzvaz.com" target="_blank">欧美成人激情视频</a>| <a href="http://taominze.com" target="_blank">亚洲国产精品欧美一二99</a>| <a href="http://www068hs.com" target="_blank">最新高清无码专区</a>| <a href="http://ndr666.com" target="_blank">美女图片一区二区</a>| <a href="http://17cao8.com" target="_blank">欧美福利网址</a>| <a href="http://yw6632.com" target="_blank">亚洲韩日在线</a>| <a href="http://5555547.com" target="_blank">欧美激情视频在线播放</a>| <a href="http://194123.com" target="_blank">最新69国产成人精品视频免费</a>| <a href="http://sfrecq.com" target="_blank">亚洲高清视频在线</a>| <a href="http://74va.com" target="_blank">免费观看欧美在线视频的网站</a>| <a href="http://5254f.com" target="_blank">欧美国产第二页</a>| <a href="http://339505.com" target="_blank">亚洲美女黄网</a>| <a href="http://zb557.com" target="_blank">国产精品一区二区三区四区五区 </a>| <a href="http://liuyangzi.com" target="_blank">欧美久久视频</a>| <a href="http://xhamster0.com" target="_blank">亚洲三级免费观看</a>| <a href="http://vvv3939.com" target="_blank">亚洲尤物在线视频观看</a>| <a href="http://862924.com" target="_blank">国产精品免费一区二区三区观看</a>| <a href="http://llamkos.com" target="_blank">亚洲一二三区精品</a>| <a href="http://73cao.com" target="_blank">久久亚洲私人国产精品va</a>| <a href="http://www559955.com" target="_blank">亚洲国产精品一区二区第一页</a>| <a href="http://taoseav8.com" target="_blank">欧美激情一区二区</a>| <a href="http://zqx186.com" target="_blank">亚洲一区二区精品在线观看</a>| <a href="http://45z6.com" target="_blank">久久久久一区</a>| <a href="http://www-55655.com" target="_blank">亚洲精品一区二</a>| <a href="http://exsecular.com" target="_blank">国产精品电影网站</a>| <a href="http://hankanzhan.com" target="_blank">久久裸体艺术</a>| <a href="http://yw1998.com" target="_blank">日韩一级在线</a>| <a href="http://8004006.com" target="_blank">看欧美日韩国产</a>| <a href="http://gg5gg.com" target="_blank">一个色综合av</a>| <a href="http://123-sj.com" target="_blank">韩国av一区</a>| <a href="http://aijiashe.com" target="_blank">欧美精品久久99</a>| <a href="http://www48929.com" target="_blank">亚洲一区二区三区777</a>| <a href="http://56lw.com" target="_blank">蜜桃av噜噜一区二区三区</a>| <a href="http://yzstbjt.com" target="_blank">亚洲黄色免费网站</a>| <a href="http://521mu.com" target="_blank">国产精品最新自拍</a>| <a href="http://www24822.com" target="_blank">老司机免费视频一区二区三区</a>| <a href="http://216667.com" target="_blank">亚洲毛片av</a>| <a href="http://quanfadq.com" target="_blank">久久一二三区</a>| <a href="http://timonna.com" target="_blank">亚洲天堂成人在线视频</a>| <a href="http://000695.com" target="_blank">黄色在线成人</a>| <a href="http://4923cc.com" target="_blank">欧美视频福利</a>| <a href="http://9lunli.com" target="_blank">久久综合999</a>| <a href="http://caogb.com" target="_blank">亚洲永久精品国产</a>| <a href="http://www24699.com" target="_blank">亚洲国产成人一区</a>| <a href="http://by66336.com" target="_blank">欧美在线观看一区</a>| <a href="http://www-85489.com" target="_blank">亚洲另类视频</a>| <a href="http://wzxjzx.com" target="_blank">狠狠久久综合婷婷不卡</a>| <a href="http://wwwmm131.com" target="_blank">欧美日本中文字幕</a>| <a href="http://expolucy.com" target="_blank">久久女同精品一区二区</a>| <a href="http://bkf23.com" target="_blank">亚洲综合色丁香婷婷六月图片</a>| <a href="http://l5076.com" target="_blank">欧美激情国产日韩精品一区18</a>| <a href="http://1x118.com" target="_blank">欧美亚洲色图校园春色</a>| <a href="http://mathck.com" target="_blank">日韩小视频在线观看</a>| <a href="http://244223.com" target="_blank">欧美综合77777色婷婷</a>| <a href="http://pp88qq.com" target="_blank">国产精品久久久久久户外露出</a>| <a href="http://7770790.com" target="_blank">久久久久久久久蜜桃</a>| <a href="http://119663.com" target="_blank">亚洲一区三区在线观看</a>| <a href="http://www218999.com" target="_blank">亚洲精品123区</a>| <a href="http://playav999.com" target="_blank">麻豆91精品91久久久的内涵</a>| <a href="http://799858.com" target="_blank">亚洲欧美日韩区</a>| <a href="http://japanjavbibi.com" target="_blank">一本大道久久a久久精二百</a>| <a href="http://chuangke168.com" target="_blank">精品盗摄一区二区三区</a>| <a href="http://bizssr.com" target="_blank">国产网站欧美日韩免费精品在线观看 </a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>