摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1115题意: 给你多边形(N)的N个顶点 , 求这N个顶点构造出了N边形的重心。坑爹: 不能直接以三角形的推算出 x = (x1 + x2 + ... + xn)/n , y = (y1 + y2 + ... + yn) / n 。解法: 切分成N-2个三角形,然后分别算出每个三角形的重心和面积,面积通过叉积算出,N边形的重心坐标是x = ( Σ (Ai * pi.x))/ S .......Σ的i是从1到N-2 S是多边形面积 pi.x是第i块三角形的重心,同理可得yView Code 1 #inc... 阅读全文
posted @ 2012-12-15 17:56
pc....
阅读(195)
评论(0)
推荐(0)
摘要:
View Code 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <math.h> 4 #include <conio.h> 5 #define N 20 6 #define inf 1e-6 // 10的6次方 7 8 typedef struct 9 { 10 int x; 11 int y; 12 }point; 13 point points[N]; //点集 14 point chs[N]; //栈 15 int sp; //栈顶指针 16 17 //计算两点之间距离 18 阅读全文
posted @ 2012-12-15 16:52
pc....
阅读(107)
评论(0)
推荐(0)
摘要:
http://dev.gameres.com/Program/Abstract/Geometry.htm 阅读全文
posted @ 2012-12-15 11:34
pc....
阅读(68)
评论(0)
推荐(0)
浙公网安备 33010602011771号