
大家好。我數學不太好,所以我需要幫助用 Python 撰寫函式。有一個拱形,我需要知道拱形上每個像素的x和y。我所有的資料,我都寫在圖片里了。如果有什么需要進一步澄清,請告訴我。
uj5u.com熱心網友回復:
有了弧長和半徑,我們可以找到弧度的弧角
fi = L/R= 366.5/350 (60 degrees, BTW)
半角
hf = fi/2 = 366.5/700 (30 degrees)
圓心坐標
cx = R * sin(hf) = 350*1/2 = 175
cy = R * cos(hf) = 350*0.866 = 303.1
現在我們可以回圈獲取具有起始角度的給定解析度的像素坐標-Pi/2-Pi/6(在一般情況下-Pi/2-hf)
for i in range(2220):
an = -math.pi*2/3 i * 366.5/350 / 2220
x = cx R * math.cos(an)
y = cy R * math.sin(an)
要更正您的代碼:
cx = radius * math.sin(hf)
cy = -radius * math.cos(hf)
xl.append(cx radius * math.cos(an))
yl.append(cy - radius * math.sin(an))
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/324831.html
