2013-10-14 4 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 지점, 이동 한 첫 손가락의 A 지점.

두 번째 손가락의 B 지점, 이동 후 두 번째 손가락의 B '지점.

정확하게 이해한다면 ABx와 A'B'x의 각도 차이가있을 것입니다. 여기서 x -는 x 축입니다. atan2 (dy, dx) 함수에서 쉽게 수행 할 수 있습니다. 여기서 dx = Ax-Bx, dy = Ay-By입니다.

+0

감사합니다. 내 문제는 공동 탄젠트 대신에 아크 탄젠트 방법을 적용하는 것이 었습니다 ... 감사합니다. LOL thanks – CodeDoctorJL