2013年10月27日 星期日

ODE教學<四>矩陣資料

The Matrix Details



The ODE library uses a 3x3 matrix in mathematical notation, i.e. row first, column second. However, internally ODE stores
its matrices as a 4x4 ordered matrix, padded with 0's. The good news is that the dBodyGetRotation function we used to 
retrieve the rotation matrix in DrawGeom above returns a 4x3 rotation matrix. So the ODEtoOGL function transposes the
elements over to the OpenGL order (column first, row second) and plugs in the position vector into the 12th, 13th and
14th elements. 

ODE教學<三>幾何繪圖

Drawing The Geoms

At the end of the SimLoop function, after advancing the simulation one step and then deleting the contact joints, we called a function called DrawGeom. This function serves as a generic rendering routine for all types of geoms, using a different rendering function for each class of geom. In keeping with the examples that came with the ODE library, the DrawGeom function takes four parameters. The first is the geom's ID, then its position vector, rotation matrix and lastly a flag used to toggle the rendering of the geoms axis aligned bounding box. 

ODE教學<二>模擬迴圈simLoop

The simulation loop

要更新每個模擬畫面的函數我們叫做SimLoop,簡單來說,他負責計算幾何物件的碰撞然後重新顯示目前的幾何形狀 

void SimLoop()
{
    // dSpaceCollide負責計算空間中兩個幾何物件的可能的碰撞,
    // 我們必須提供callback函數的位置讓他來計算這些資料。
    // callback函數負責在加入碰撞節點前,評估可能的交互作用,碰撞節點的群組叫做contactgroup
    // 這讓我們在把碰撞節點加入到群組前,可以設定其可能行為
    // 第二個參數則是個指標指向任何我們想傳入callback函數的資料。
    // 下個章節我們會講到nearCallback。
    dSpaceCollide(Space, 0, &nearCallback);

    // 現在我們使用dWorldQuickStep來進行進階的模擬,這是dWorldStep的快速版本,但精確度會稍低。
    // 除了World物件ID之外,我們也將step size傳入,每個 step 會根據一個固定的數字的最小step或迭代來
    //更新模擬。
    // 預設次數為 20 但妳可以用dWorldSetQuickStepNumIterations來改變數值
    dWorldQuickStep(World, 0.05);

    //移除所有world中已發生過的暫時性的碰撞節點
    dJointGroupEmpty(contactgroup);

    // 當我們呼掉 DrawGeom 時,會根據物件的幾何形狀來繪出畫面
    DrawGeom(Object.Geom[0], 0, 0, 0);
}

Callback函數

ODE教學<一>初始化ODE



目前正在翻譯這篇,要轉載或幫忙翻譯請跟我說....
原文http://www.alsprogrammingresource.com/basic_ode.html


ODE是個物理的函數庫可以在虛擬世界模擬真實的物理現象,ODE的全名是Open Dynamics Engine而作者是Russell Smith,
是個開放程式碼的計畫,在此的ODE範例將會用免費的Dev-cpp來編譯。


這是個簡單的一個物件-一個盒子掉在一個平坦的表面,我們晚點再來講關節的部份,先來講ode include的部份。
#inlcude <ode/ode.h>

2013年10月21日 星期一

ubuntu 13.10 安裝 VMware tools

若安裝出現 Searching for a valid kernel header path...The path "" is not valid. Would you like to change it?
 的錯誤訊息沒法再繼續,依以下步驟就可解決

  1. Download linux headers using the command
    sudo apt-get update && sudo apt-get install build-essential linux-headers-$(uname -r)
  2. Create a symbolic link to version.h file
    sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h






2013年10月20日 星期日

注音、漢語拼音、通用拼音對應表


注音
漢語拼音
通用拼音
注音
漢語拼音
通用拼音
單獨出現
與其它音合併
單獨出現
與其它音合併
單獨出現
與其它音合併
單獨出現
與其它音合併
 
b
 
b
a
a
a
a
 
p
 
p
o
o
o
o
 
m
 
m
e
e
e
e
 
f
 
f
ê
 e
ê
 e
 
d
 
d
ai
ai
ai
ai
 
t
 
t
ei
ei
ei
ei
 
n
 
n
ao
ao
ao
ao
 
l
 
l
ou
ou
ou
ou
 
g
 
g
an
an
an
an
 
k
 
k
en
en
en
en
 
h
 
h
ang
ang
ang
ang
 
j
 
ji
eng
eng
eng
eng
 
q
 
ci
er
er
er
er
 
x
 
si
yi
i
yi
i
zhi
zh
jhih
jh
ㄧㄚ
ya
ia
ya
ia
chi
ch
chih
ch
ㄧㄛ
yo
yo
  -
shi
sh
shih
sh
ㄧㄝ
ye
ie
ye
ie
ri
r
rih
r
ㄧㄞ
yai
yai
-
zi
z
zih
z
ㄧㄠ
yao
iao
yao
iao
ci
c
cih
c
ㄧㄡ
you
iu
you
iou
si
s
sih
s
ㄧㄢ
yan
ian
yan
ian
         
ㄧㄣ
yin
in
yin
in
         
ㄧㄤ
yang
iang
yang
iang
         
ㄧㄥ
ying
ing
ying
ing
         
wu
u
wu
u
         
ㄨㄚ
wa
ua
wa
ua
         
ㄨㄛ
wo
uo
wo
uo
         
ㄨㄞ
wai
uai
wai
uai
         
ㄨㄟ
wei
ui
wei
uei
         
ㄨㄢ
wan
uan
wan
uan
         
ㄨㄣ
wen
un
wun
un
         
ㄨㄤ
wang
uang
wang
uang
         
ㄨㄥ
weng
ong
wong
ong
         
yu
ü
yu
yu
         
ㄩㄝ
yue
ue
yue
yue
         
ㄩㄢ
yuan
uan
yuan
yuan
         
ㄩㄣ
yun
un
yun
yun
         
ㄩㄥ
yong
iong
yong
yong
轉貼自 http://www.iq-t.com/SYSCOM/pinyin3.asp

2013年10月13日 星期日

CxxlMan 程式庫注意事項--不要在建構函數中將 this 放入 Smart_Ptr

如下:
A::A()
{
  Smart_Ptr(this);
}
這樣從建構函數返回後,A 的物件也會被銷毀,最常發生的情況應如下:
void F(const Smart_Ptr<A> &A_Arg); // 假設沒有用 Smart_Ptr 保存 A
A::A()
{
  F(this);
}
常不自覺就犯下那樣的錯誤。