标签:style http color io os ar strong 数据 div
现在给你不共线的三个点A,B,C的坐标,它们一定能组成一个三角形,现在让你判断A,B,C是顺时针给出的还是逆时针给出的?
如:
图1:顺时针给出
图2:逆时针给出


<图1> <图2>
0 0 1 1 1 3 0 1 1 0 0 0 0 0 0 0 0 0
0 1
代码:
#include<stdio.h>
int main()
{
	int x1,x2,x3,y1,y2,y3,t;
	while(scanf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3),x1||x2||x3||y1||y2||y3)
	{
		t=(x2-x1)*(y3-y1)-(y2-y1)*(x3-x1);
		if(t>0)
		printf("0\n");
		else
		printf("1\n");
	}
	return 0;
}利用叉积的方向(右手定则)
标签:style http color io os ar strong 数据 div
原文地址:http://blog.csdn.net/qq_18062811/article/details/39432343