找回密码
 注册
Simdroid-非首页
查看: 2449|回复: 85

[演示项目] Mathematica 模拟时钟界面 - A Broken Sword

[复制链接]
发表于 2007-7-15 20:34:31 | 显示全部楼层 |阅读模式 来自 江苏无锡
Mathematica 模拟时钟界面 - Broken Sword

An Analog Clock - Broken Sword

Question :

在一天的24小时之中,时钟的时针、分针和秒针完全重合在一起的时候有几次?
都分别是什么时间?你怎样算出来的?


Reference

1. 微软面试题 --- 时钟三针重合问题
http://www.simwe.com/forum/thread-780882-1-2.html

2. A dynamic of Analog Clock
http://blog.wolfram.com/2007/07/always_the _right _time.html
http://blog.wolfram.com/carlson/codecomparison.nb

[ 本帖最后由 FreddyMusic 于 2007-9-19 12:48 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×

评分

1

查看全部评分

 楼主| 发表于 2007-7-16 11:17:07 | 显示全部楼层 来自 江苏无锡
Simdroid开发平台
I will make a show time later.

游客,本帖隐藏的内容需要积分高于 90 才可浏览,您当前积分为 0
回复 不支持

使用道具 举报

发表于 2007-7-25 14:07:04 | 显示全部楼层 来自 陕西西安
楼主总是出人意外啊
回复 不支持

使用道具 举报

 楼主| 发表于 2007-7-25 19:50:50 | 显示全部楼层 来自 江苏无锡
这个小钟现在还没有全部搞好,不过我已经阴谋了一个更好的主意。
回复 不支持

使用道具 举报

发表于 2007-7-27 00:03:21 | 显示全部楼层 来自 陕西安康
回复 不支持

使用道具 举报

 楼主| 发表于 2007-7-27 09:06:36 | 显示全部楼层 来自 江苏无锡
原帖由 changqing 于 2007/7/27 00:03 发表
可以参考:
http://blog.wolfram.com/2007/07/always_the_right_time.html
代码:
http://blog.wolfram.com/carlson/codecomparison.nb



Good information ! Thanks.
回复 不支持

使用道具 举报

发表于 2007-7-27 23:35:43 | 显示全部楼层 来自 北京
看看!xueci
回复 不支持

使用道具 举报

发表于 2007-7-28 11:16:23 | 显示全部楼层 来自 江苏南京
不错,只是看不到时钟gif的动作
回复 不支持

使用道具 举报

 楼主| 发表于 2007-7-28 11:33:46 | 显示全部楼层 来自 江苏无锡
It's not finished so far.
When it's finished, it would have a gif.

I save some picture on forum for later information.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复 不支持

使用道具 举报

发表于 2007-7-28 15:17:01 | 显示全部楼层 来自 河北石家庄
好呀,真厉害:)
回复 不支持

使用道具 举报

 楼主| 发表于 2007-7-28 22:24:34 | 显示全部楼层 来自 江苏无锡
I add one line to show digital clock on top.

  1. makeHand[fl_, bl_, fw_, bw_] :=
  2.     Polygon[{{-bw, -bl}, {bw, -bl}, {fw, fl}, {0, fl + 8 fw}, {-fw,
  3.       fl}}/9];

  4. hourHand = makeHand[5, 5/3, .1, .3];
  5. minuteHand = makeHand[7, 7/3, .1, .3];
  6. secondHand = {Red, EdgeForm[Black], makeHand[7, 7/3, .1/2, .3/2]};

  7. Graphics[{
  8.    (* Construction *)
  9.     {Thickness[.03], Circle[]},(* Rim *)
  10.     {Thickness[.003],
  11.    Table[Line[{.9 {Cos[a], Sin[a]}, .95 {Cos[a], Sin[a]}}], {a, 0,
  12.      2 \[Pi], 2 \[Pi]/60}]}, (* Thin ticks *)
  13.     {Thickness[.01],
  14.    Table[Line[{.9 {Cos[a], Sin[a]}, .95 {Cos[a], Sin[a]}}], {a, 0,
  15.      2 \[Pi], 2 \[Pi]/12}]}, (* Thick ticks *)
  16.     Style[
  17.    Table[Text[
  18.      i, .77 {Cos[-i \[Pi]/6 + \[Pi]/2],
  19.        Sin[-i \[Pi]/6 + \[Pi]/2]}], {i, 1, 12}],
  20.    FontFamily -> "Helvetica", FontSize -> 36], (* Numbers *)
  21.   
  22.    (* Digital Time *)
  23.    Style[Text[
  24.     Dynamic[Refresh[DateString[], UpdateInterval -> 1/20]],  {0,
  25.      1.15}], Blue, FontFamily -> "Helvetica", FontSize -> 20],
  26.   
  27.    (* Define three hands *)
  28.     Rotate[hourHand,
  29.    Dynamic[Refresh[-30 Mod[AbsoluteTime[]/3600, 60] °,
  30.      UpdateInterval -> 60]], {0, 0}],
  31.     Rotate[minuteHand,
  32.    Dynamic[Refresh[-6 Mod[AbsoluteTime[]/60, 60] °,
  33.      UpdateInterval -> 1]], {0, 0}],
  34.     Rotate[secondHand,
  35.    Dynamic[Refresh[-6 Mod[AbsoluteTime[], 60] °,
  36.      UpdateInterval -> 1/20]], {0, 0}]
  37.     }]
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复 不支持

使用道具 举报

 楼主| 发表于 2007-7-28 22:32:12 | 显示全部楼层 来自 江苏无锡
The interesting thing is .....
If we export it as gif of a 12 hours clock and set it as a head picture.
Then I can see a correct clock. haha....
回复 不支持

使用道具 举报

发表于 2007-7-28 22:38:46 | 显示全部楼层 来自 广东东莞

好西利

我都在學習中........
回复 不支持

使用道具 举报

发表于 2007-7-29 00:14:20 | 显示全部楼层 来自 黑龙江齐齐哈尔
看下··米见过
回复 不支持

使用道具 举报

发表于 2007-7-29 00:14:52 | 显示全部楼层 来自 黑龙江齐齐哈尔

回复 #1 FreddyMusic 的帖子

恢复 ··刚才回错了··
回复 不支持

使用道具 举报

发表于 2007-7-30 17:06:08 | 显示全部楼层 来自 甘肃兰州
我顶持续顶!
回复 不支持

使用道具 举报

发表于 2007-8-3 12:32:44 | 显示全部楼层 来自 江苏苏州
:) ,偶也想看一下,3Q
回复 不支持

使用道具 举报

发表于 2007-8-7 16:58:16 | 显示全部楼层 来自 广东东莞

hi

不能看嗎?
回复 不支持

使用道具 举报

发表于 2007-8-14 21:02:41 | 显示全部楼层 来自 江西南昌
学习一下!
回复 不支持

使用道具 举报

发表于 2007-8-26 22:00:19 | 显示全部楼层 来自 北京
好好看看!
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-3-29 21:48 , Processed in 0.063124 second(s), 18 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表