![](/img/trans.png)
[英]I have a list of user-inputted coordinates, how do i calculate the point that is as close as possible to all the coordinates?
[英]How do calculate coordinates
听起来 Ken YN 的评论正是您要寻找的。
fucntion printPoints(latitude, longitude, radius, vertices){
for (var i = 0; i < vertices; i ++){
console.log([latitude + (radius*Math.cos(Math.PI*2/vertices * i)), longitude + (radius*Math.sin(Math.PI*2/vertices * i))]);
}
}
printPoints(0, 0, 10, 6); //prints [10, 0] [5, 8.7] [-5, 8.7] [-10, 0] [-5, -8.7] [5, -8.7]
此函数仅打印坐标,但您可以根据需要对其进行修改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.