我不確定這是否可能,但我想繪製一個半徑爲r的座標爲[x,y]的座標爲[ ]的地圖上的所有變量都是已知的。它的字面意思是在我不確定的地圖上繪製/顯示一個圓的函數/過程。 理想情況下,我不希望一隻烏龜畫它,而不是通過染色設置的修補程序。 任何想法都將有所幫助。謝謝。在固定半徑的地圖上畫圓圈
回答
正如我在評論中提到的,我不知道如何在沒有烏龜的情況下繪製圖層(或GIS擴展,這會更加複雜)。所以,如果你最終決定使用烏龜,你可以查看模型庫中的Turtles Circling模型以獲取細節。您還可以查看下面的代碼,瞭解一個烏龜的簡單示例,根據您選擇的色塊座標和圓半徑繪製一個圓。
to circle
let cx 0 ;; x coordinate of patch you want to circle
let cy 0 ;; y coordinate of patch you want to circle
let r 10 ;; radius of the circle you want
let p2r (2 * pi * r) ;; get circumference of the circle
let step p2r/360 ;; make step lengths 1/360th of the circumference
crt 1 [ ;; create a single drawing turtle
setxy cx + r cy ;; move it to the highlight patch + the radius
pd ;; put the pen down
set heading 0 ;; make it face along the tangent
while [ p2r > 0 ] [ ;; make the turtle continue to move until the circle is drawn
lt 1
fd step
set p2r p2r - step
]
die ;; remove the turtle
]
end
再次感謝,非常感謝。我使用了最初的補丁概念,並更新了它以顯示紅色陰影,實際上是我最初詢問的圓圈的大小。這很有效,並且不像你所說的那樣值得使用GIS。非常感謝:) – pokeairguy
好想法!快樂的編碼。 –
我會建議你:
- 作出新的龜
- 設置其形狀爲圓形
- 位置時,你希望它並適當設置其大小
stamp
die
Presto,您現在在繪圖層中有一個圓。
簡單,快速,而且確實需要什麼。太好了! –
您是否想要在繪圖層繪製一個光滑的圓?如果是這樣的話,我*認爲*你需要有一隻烏龜畫它。不過,據我所知,繪圖層對於海龜來說是不可訪問的,所以它只是爲了視覺效果。如果您需要將圓圈用於其他用途,請問問題補丁0 0 [請求半徑8中的補丁[設置pcolor紅色]]'訣竅?但是,違背了你的「着色組補丁」約束。 –
光滑的圓圈會很好。不需要其他任何東西,僅僅爲了視覺效果並突出顯示用戶的某些區域。再次感謝 – pokeairguy