我正在尝试以编程方式在正方形周围绘制坐标,它很难编码以显示我所追求的。
// amount of chairs
var aoc = 4;
// table width
var tw = 200;
// table height
var th = 200;
// chair width height
var cwh = 60 / 2;
var space = tw * 4 / aoc;
var left = [-30,100,-30,-160];
var top = [-160,-30,100,-30];
// straing point
var sp = 12;
for(var i=0; i<aoc; i++){
var x = cwh + space * i / aoc;
console.log(x);
//var y = space / 2 - cwh * i;
$("#center").append("<div class='chair' style='left:"+left[i]+"px;top:"+top[i]+"px;'>"+i+"</div>");
}
数学绝对不是我的强项,只是想我会在这里发帖,看看是否有人可以帮助我指出正确的方向,如果我得到它,我会继续前进并更新???
我需要这种方式来代表站在大广场周围的小圆圈,但会有随机数量的人,他们都需要等距。
我昨天发布了关于圆形物体的同一篇文章,现在我在正方形上,我无法理解数学,任何帮助。
Sore that this has been voted down just thought i would update with a post putting all these together http://devsforrest.com/116/plot-positions-around-shapes-with-javascript Hope it helps someone else