[ 01 敘利亞大馬士革清真寺-幾何圖樣-程式說明 ]

相看問幾何
Join to follow...
Follow/Unfollow Writer: 相看問幾何
By following, you’ll receive notifications when this author publishes new articles.
Don't wait! Sign up to follow this writer.
WriterShelf is a privacy-oriented writing platform. Unleash the power of your voice. It's free!
Sign up. Join WriterShelf now! Already a member. Login to WriterShelf.
461   0  
·
2019/10/04
·
2 mins read


請先觀看網頁動畫
[ SVG animation for SYR0130 IGP ]
  
duration : 40 seconds
http://syr0130-great-mosque-damascus--p3artschool.repl.co/  

任意一個以 (0, 0) 為圓心, r0 為半徑之圓形, 其內接正六邊形的單邊長等於 r0, 
如以 r1 = r0/6 為小正六邊形的單邊長, 我們可以推導得到上面的圖形,
並求出各個小正六邊形的中心點坐標。
#
紅色正六邊形可編序為
RU -- 右上
LU -- 左上
L    -- 左
LD -- 左下
LR -- 右下
R   -- 右

# 紅色正六邊形之中心點坐標
RU_center = Point( 2*r1, 4*r2)
LU_center = Point(-2*r1, 4*r2)
L_center  = Point(-4*r1,    0)
LD_center = Point(-2*r1,-4*r2)
RD_center = Point( 2*r1,-4*r2)
R_center  = Point( 4*r1,    0)
theta000 = 0*np.pi/3 
theta060 = 1*np.pi/3
theta120 = 2*np.pi/3
theta180 = 3*np.pi/3
theta240 = 4*np.pi/3
theta300 = 5*np.pi/3
Hex = (theta000, theta060, theta120, theta180, theta240, theta300)
#  so Hex[0] is theta000, Hex[1] is theta060, . . . .

函數 getHexCornerXY(p1, r1, cornor) 可求得以p1為中心點, 單邊長為 r1 的正六邊形任一角點的坐標值, cornor 值為 0,1,2,3,4,5 分別表示 Hex[0],  Hex[1],  Hex[2],  Hex[3],  Hex[4],  Hex[5]
所以可推導得到新中心點

hexP1 = getHexCornerXY(RU_center, r1, 0)
hexP2 = getHexCornerXY(LU_center, r1, 1)
hexP3 = getHexCornerXY(L_center,  r1, 2)
hexP4 = getHexCornerXY(LD_center, r1, 3)
hexP5 = getHexCornerXY(RD_center, r1, 4)
hexP6 = getHexCornerXY(R_center,  r1, 5)

函數 drawHex_by_width(p1, r1, 線顏色, 線寬) 可繪製以p1為中心點, 單邊長為 r1 的正六邊形

drawHex_by_width(hexP1, r1, 'green', 3)
drawHex_by_width(hexP2, r1, 'green', 3)
drawHex_by_width(hexP3, r1, 'green', 3)
drawHex_by_width(hexP4, r1, 'green', 3)
drawHex_by_width(hexP5, r1, 'green', 3)
drawHex_by_width(hexP6, r1, 'green', 3)

千辛萬苦, 先求紅色正六邊形的中心點, 再求相對角點的坐標值, 
以此相對角點的坐標值為新中心點, 繪出綠色正六邊形。
(待續 . . . )


WriterShelf™ is a unique multiple pen name blogging and forum platform. Protect relationships and your privacy. Take your writing in new directions. ** Join WriterShelf**
WriterShelf™ is an open writing platform. The views, information and opinions in this article are those of the author.


Article info

This article is part of:
Categories:
Tags:
Date:
Published: 2019/10/04 - Updated: 2021/01/25
Total: 405 words


Share this article:
About the Author

幾何觀世界,中心定元圓




Join the discussion now!
Don't wait! Sign up to join the discussion.
WriterShelf is a privacy-oriented writing platform. Unleash the power of your voice. It's free!
Sign up. Join WriterShelf now! Already a member. Login to WriterShelf.