请教个数学问题,编程相关。

2015-03-20 14:55:19 +08:00
 babyname
一个画布上,有6个点(每个10px),这6个点,围绕画布的中心,组成一个圆,每个点距离围绕画布的中心位置 50px,如何计算6个点的每个点x, y位置?谢谢。

6个点需要平均分布

4534 次点击
所在节点    程序员
34 条回复
rale
2015-03-21 17:28:07 +08:00
@b821025551b 你这个图是用啥画的呀
lololol233
2015-03-22 05:41:09 +08:00
@yingluck
1. 不明白为什么是pi/3
2. 我认为可以近似成弧的长度, 如果你知道如何计算二者的误差, 欢迎指教
lololol233
2015-03-22 05:50:59 +08:00
@lololol233 @yingluck
我傻逼, 就是pi/3
b821025551b
2015-03-22 13:54:51 +08:00
@rale Photoshop
yingluck
2015-03-23 15:08:07 +08:00
大概想了一下,可能还不全面,欢迎讨论

其实我觉得楼主说的每个点 10 像素是不太恰当的。
因为在画布上 9个像素 或者 16 个像素 能够拼成正方形。

围绕画布的中心,那我们假设画布的中心是笛卡尔坐标系的原点。那么六个点每个点到画布中心的距离都是50像素。

再假设每个像素宽高相同。六个点的每一个点都由 9 个像素组成。

那么,以原点为圆心,半径为 50 ,画出的圆经过的每一个像素点,都是六边形的六个端点可能的位置。

在第一象限,用脚本跑了一下,当横坐标是整数的时候,纵坐标的情况是这样的:

当纵坐标为整数时,可能的中心点有 4 个, 在第一象限有 6 个纵坐标为整数的点
当纵坐标为非整数时,可能的中心点有 2 个, 在第一象限有 45 个这样的点

所有不重复的结果有 87 个。

全部有 348 个可能的点。
yingluck
2015-03-23 15:09:12 +08:00
the X is 50, the Y is 0.0
cross (50, 0.0), (49, 0.0)
the X is 49, the Y is 9.94987437107
cross (49, 9), (48, 9)
the X is 48, the Y is 14.0
cross (48, 14.0), (47, 14.0), (48, 13.0), (47, 13.0)
the X is 47, the Y is 17.0587221092
cross (47, 17), (46, 17)
the X is 46, the Y is 19.5959179423
cross (46, 19), (45, 19)
the X is 45, the Y is 21.7944947177
cross (45, 21), (44, 21)
the X is 44, the Y is 23.7486841741
cross (44, 23), (43, 23)
the X is 43, the Y is 25.5147016443
cross (43, 25), (42, 25)
the X is 42, the Y is 27.1293199325
cross (42, 27), (41, 27)
the X is 41, the Y is 28.6181760425
cross (41, 28), (40, 28)
the X is 40, the Y is 30.0
cross (40, 30.0), (39, 30.0), (40, 29.0), (39, 29.0)
the X is 39, the Y is 31.2889756943
cross (39, 31), (38, 31)
the X is 38, the Y is 32.4961536185
cross (38, 32), (37, 32)
the X is 37, the Y is 33.6303434416
cross (37, 33), (36, 33)
the X is 36, the Y is 34.6987031458
cross (36, 34), (35, 34)
the X is 35, the Y is 35.7071421427
cross (35, 35), (34, 35)
the X is 34, the Y is 36.6606055596
cross (34, 36), (33, 36)
the X is 33, the Y is 37.563279942
cross (33, 37), (32, 37)
the X is 32, the Y is 38.4187454246
cross (32, 38), (31, 38)
the X is 31, the Y is 39.2300904919
cross (31, 39), (30, 39)
the X is 30, the Y is 40.0
cross (30, 40.0), (29, 40.0), (30, 39.0), (29, 39.0)
the X is 29, the Y is 40.7308237088
cross (29, 40), (28, 40)
the X is 28, the Y is 41.4246303544
cross (28, 41), (27, 41)
the X is 27, the Y is 42.083250825
cross (27, 42), (26, 42)
the X is 26, the Y is 42.7083130081
cross (26, 42), (25, 42)
the X is 25, the Y is 43.3012701892
cross (25, 43), (24, 43)
the X is 24, the Y is 43.8634243989
cross (24, 43), (23, 43)
the X is 23, the Y is 44.3959457608
cross (23, 44), (22, 44)
the X is 22, the Y is 44.8998886413
cross (22, 44), (21, 44)
the X is 21, the Y is 45.3762052182
cross (21, 45), (20, 45)
the X is 20, the Y is 45.8257569496
cross (20, 45), (19, 45)
the X is 19, the Y is 46.2493243194
cross (19, 46), (18, 46)
the X is 18, the Y is 46.6476151588
cross (18, 46), (17, 46)
the X is 17, the Y is 47.021271782
cross (17, 47), (16, 47)
the X is 16, the Y is 47.3708771293
cross (16, 47), (15, 47)
the X is 15, the Y is 47.6969600708
cross (15, 47), (14, 47)
the X is 14, the Y is 48.0
cross (14, 48.0), (13, 48.0), (14, 47.0), (13, 47.0)
the X is 13, the Y is 48.2804308183
cross (13, 48), (12, 48)
the X is 12, the Y is 48.538644398
cross (12, 48), (11, 48)
the X is 11, the Y is 48.774993593
cross (11, 48), (10, 48)
the X is 10, the Y is 48.9897948557
cross (10, 48), (9, 48)
the X is 9, the Y is 49.1833305094
cross (9, 49), (8, 49)
the X is 8, the Y is 49.355850717
cross (8, 49), (7, 49)
the X is 7, the Y is 49.5075751779
cross (7, 49), (6, 49)
the X is 6, the Y is 49.638694584
cross (6, 49), (5, 49)
the X is 5, the Y is 49.7493718553
cross (5, 49), (4, 49)
the X is 4, the Y is 49.8397431775
cross (4, 49), (3, 49)
the X is 3, the Y is 49.9099188539
cross (3, 49), (2, 49)
the X is 2, the Y is 49.9599839872
cross (2, 49), (1, 49)
the X is 1, the Y is 49.9899989998
cross (1, 49), (0, 49)
the X is 0, the Y is 50.0
cross (0, 50.0), (0, 49.0)

the length of PIXLE is 87
yingluck
2015-03-23 15:09:39 +08:00
@lololol233 看上面
babyname
2015-03-23 15:44:55 +08:00
@yingluck 可否分享下代码呀,谢谢
yingluck
2015-03-23 15:54:00 +08:00
babyname
2015-03-23 16:04:40 +08:00
babyname
2015-03-23 16:11:06 +08:00
@mengzhuo 不太懂 python 如果能有其他语言版本就好啦 😄
Todd_Leo
2015-03-23 16:34:31 +08:00
为什么你的问题跟你的头像这么雷同 XD
babyname
2015-03-23 17:00:24 +08:00
@Todd_Leo 没错,我要画个头像 :)
wind3110991
2015-03-24 00:33:28 +08:00
这个题时要求什么,是反求输入六个点的坐标的话,那么这题答案不止一个哦
记得三个点确定一个圆,起码除了中心点的话要知道其他两个点的坐标,这题如果要求解,那么应该是输入中心点,加上其他两个点的坐标,求出剩下4个点的坐标

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/178250

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX