#include <iostream>
using namespace std;

struct POINT	{
	int x;
	int y;
};

//マウスカーソルが時計回り（正）か反時計回り（負）かの判定
int mouseConvexity(POINT* mousePoints, POINT pt, int threshold, int& s_count, int& s_prev)
{
	if ( ++s_count % 4 )	//点の採取・判断は毎回やると不安定になる　"4" は要調整
		return 0;
	int d = (mousePoints[1].x - mousePoints[0].x) * (pt.y - mousePoints[1].y) -
			(mousePoints[1].y - mousePoints[0].y) * (pt.x - mousePoints[1].x);
	mousePoints[0] = mousePoints[1];
	mousePoints[1] = pt;
	if ( std::abs(d) < std::abs(threshold) )    //はっきりしないカーブは前回値を返す
		return s_prev;
	return s_prev = d;
}

int main() {
	//.............
	static POINT s_mousePoints[2] = {{0,0},{0,0}};
	static int s_count = 0;
	static int s_prev = 0;
	//case WM_MOUSEMOVE:      // マウスカーソルが移動したとき
	    POINT mouseEnd;
	    //.............
	    int d = mouseConvexity(s_mousePoints, mouseEnd, 10, s_count, s_prev);	//"10" は要調整
	    //0 < d なら時計回り、d < 0 なら反時計回り
	    //.............
	    //break;
	    //.............
	return 0;
}
