2013-10-14 58 views
0

我正在使用C++,我使用visual studio作爲IDE,並且我正在使用Leap Motion SDK如何找到有兩個幀,每個有兩個點的德爾塔θ?

所以,我目前正在研究一個旋轉圓的程序。 用於操縱旋轉的方法通過使用兩個手指來應用,該手指在應用程序上顯示爲 個點。

此應用程序還使用幀來顯示隨着時間的事件。

我想知道如何使用兩個框架和兩個點來計算在兩個框架上使用 兩點移動的旋轉變化。

const Frame frame = controller->frame();  //current frame 
const Frame previous = controller->frame(1); //previous frame 

const FingerList fingers = frame.fingers(); //fingers inside that frame 
POINT aFingerPoint = fingers[0].position() //point of a finger from a finger array  
POINT anotherFingerPoint = fingers[1].position() //point of a finger from a finger array 

const FingerList prevFingers = previous.fingers(); //fingers inside that frame 
POINT aPrevFingerPoint = fingers[0].position() //point of a finger from a finger array  
POINT anotherPrevFingerPoint = fingers[1].position() //point of a finger from a finger array 

// coordinate example 
float x = aFingerPoint.x; 
float y = aFingerPoint.y; 

float deltaRotation = [THIS PART I DONT KNOW]; //I got the translation already, just need rotation 
circle.manipulation(deltaRotation); //Rotates the circle in degrees 

回答

2

A - 第一個手指的點,A' - 移動後的第一個手指的點。

B - 第二根手指的點,B' - 移動後的第二根手指的點。

如果我正確理解你,你的答案將是角度ABx和A'B'x之間的差異,其中x - 是x軸。它可以用atan2(dy,dx)函數輕鬆完成,其中dx = Ax-Bx,dy = Ay-By。

+0

謝謝!我的問題是我正在應用一個切線而非反正切的方法......大聲笑謝謝 – CodeDoctorJL

相關問題