netlogo - 乌龟的径向方向
netlogo - radial direction of the turtle
我是椭圆形。 (创建有垂直方向)
我想在圆形轮廓上放置几个这样的形状
它们之间的距离应该相同
;x,y - circle center coordinates
;r - radius
to draw-ellipses [x y r elNum ]
if elNum > 0 [
let theta 0
let delta 360 / elNum
loop[
if elNum = 0 [ stop ]
crt 1 [
setxy (x + r * cos theta) (y + r * sin theta)
set shape "ellipse"
set heading 90 + theta
set size 7
]
set theta (theta + delta)
set elNum (elNum - 1)
]
]
end
椭圆形状放置正确,但方向错误。我希望椭圆具有径向方向。即作为放置形状的点的半径的延续。但方向不好。
只有0度和180度的方向是可以的。
一些建议我错过了什么?
我的理解是否正确,您希望您的海龟背对半径?如果是这样,请尝试将您的标题行替换为:
set heading atan xcor ycor
以与您的角度数学一致的方式进行。或者,您可以使用 facexy
,并将标题行替换为类似以下内容:
facexy x y
rt 180
我是椭圆形。 (创建有垂直方向) 我想在圆形轮廓上放置几个这样的形状 它们之间的距离应该相同
;x,y - circle center coordinates
;r - radius
to draw-ellipses [x y r elNum ]
if elNum > 0 [
let theta 0
let delta 360 / elNum
loop[
if elNum = 0 [ stop ]
crt 1 [
setxy (x + r * cos theta) (y + r * sin theta)
set shape "ellipse"
set heading 90 + theta
set size 7
]
set theta (theta + delta)
set elNum (elNum - 1)
]
]
end
椭圆形状放置正确,但方向错误。我希望椭圆具有径向方向。即作为放置形状的点的半径的延续。但方向不好。 只有0度和180度的方向是可以的。
一些建议我错过了什么?
我的理解是否正确,您希望您的海龟背对半径?如果是这样,请尝试将您的标题行替换为:
set heading atan xcor ycor
以与您的角度数学一致的方式进行。或者,您可以使用 facexy
,并将标题行替换为类似以下内容:
facexy x y
rt 180