Reputation: 9806
Here is code I found in the Turtles Circling example in the models library:
to create-circle
create-turtles 1
[ move-to patch-goal
set color gray - 3
set size 4.5
set shape "circle"
stamp
die ]
end
This can't be used to create a semicircle unless you change the shape of turtle, which seems naive. How can one create a semicircle centered around a patch? Considering turtle's perspective at center the semicircle varies from 90 to 270. Also, is simplifying creating an outline possible.
Upvotes: 2
Views: 560
Reputation: 3806
If you want the circles to move in a semi-circle, You can do the following:
Essentially, you check if the turtle is on the horizontal axis and if it is you need to see if it's on the left side or the right side of the semi-circle. If it's on the left side, the turtle should face up, otherwise the turtle should face left. You'll need to do distancexy since the turtle may or may not have an integer value due to rounding (due to rotation and speed).
to move-along-circle [r]
fd (pi * r / 180) * (speed / 50)
ifelse distancexy xcor 0 < (speed / 50)
[
ifelse distancexy (-1 * r) ycor < (speed / 50)
[set heading 0]
[set heading -90]
]
[rt speed / 50]
end
If you want the shape of the big turtle in the middle to be a circle, you'll have set the shape of the turtle. You could go into the turtle shapes editor to create a semi-circle shape since I don't see one.
Upvotes: 1