小编Bar*_*ong的帖子

如何计算C中多边形的质心

我试图围绕质心旋转多边形,但我对公式的编码感到困惑.

float x[32];
float y[32];
float cx=0;
float cy=0;
int j,n;
printf("How many angles :")
scanf("%d" ,&n);
//get (x[j],y[j]);
for (j=0; j<n; j++){
printf("x%d : ",j+1);
scanf("%f" ,&x[j]);
printf("y%d : ",j+1);
scanf(input, "%f" ,&y[j]);
}
//find a
//find cx
//find cy
printf("The centroid of the polygon is (%f,%f)",cx,cy);
Run Code Online (Sandbox Code Playgroud)

多边形公式的质心
http://i.stack.imgur.com/qjezn.png

c graphics 2d centroid

3
推荐指数
1
解决办法
3795
查看次数

恒定时间是什么意思?

我正在研究算法,但我没有得到恒定时间算法.

这意味着什么以及与线性时间算法有何不同.

谢谢,

algorithm time-complexity

1
推荐指数
1
解决办法
481
查看次数

标签 统计

2d ×1

algorithm ×1

c ×1

centroid ×1

graphics ×1

time-complexity ×1