我目前試圖做的是在屏幕上遠離中心點展開一組點。我目前使用此代碼(注意我已經修改這個代碼更容易理解):從中心點移動座標
#d_x - the x coordinate of the dot at its default position
#d_y - the y coordinate of the dot at its default position
#dis_x - the distance along the x grid the point is away from the centre point
#dis_y - the distance along the y grid the point is away from the centre point
#zoom_level - the zoom level increased or decreased depending on the mouse wheel
z_x = (d_x + (dis_x * (1 + (zoom_level * 0.01))))
z_y = (d_y + (dis_y * (1 + (zoom_level * 0.01))))
drawText("*",z_x,z_y,)
此代碼幾乎工作,唯一的問題是,當zoom_level爲0的點是在正確的位置,但是當我增加了縮放級別,使點沿着錯誤的方向擴展,而不是從中心點向外擴展,而是以相反的方式向中心點移動。
有關如何解決此問題的任何意見將不勝感激。
[編輯] - 我沒有說這個,但是每個點都是圍繞中心點隨機點展開的。
適用於我的機器。見[這裏](http://pastebin.com/YvZV6Cxw)。執行100,000次試驗時,當增加縮放級別時,點總會從中心點走得更遠。 – Kevin
你是如何計算'dis_x'和'dis_y'的? – Kevin
魔法8球:當點向錯誤方向移動時,您的「縮放級別」具有錯誤的+/-符號。 – chux