Sector Area and Arc Length
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
globals [end?] turtles-own [ out-counter around-counter outer-ring-counter around-angle-counter home-counter going-out? going-around? going-home? current-radius current-degrees fill-area? ] to setup clear-all ask patches [ set pcolor white ] reset-ticks create-turtles 1 [ set color red facexy 1 0 pen-down set pen-size 2 set size 1.5 set out-counter 0 set around-angle-counter 0 set around-counter 0 set home-counter 0 set going-out? true set going-around? false set going-home? false set fill-area? false set current-radius radius set current-degrees 0 set end? false ] end to go if end? [ stop ] ;; handle the state of which way i should be going ask turtles [ ;; determine the state if going-out? and out-counter >= current-radius [ set going-out? false set out-counter 0 set going-around? true set pen-size 5 set color blue left 90 ] if going-around? and around-angle-counter > central-angle [ set going-around? false set around-angle-counter 0 set going-home? true set pen-size 2 set color red left 90 ] if going-home? and home-counter >= current-radius [ set going-home? false set home-counter 0 set fill-area? true set color green set pen-size 1 setxy 0 0 ; for floating point errors i think left 180 - central-angle ] ;; based on the state, move accordingly if going-out? [ forward 0.1 set out-counter out-counter + 0.1 ] if going-around? [ forward 2 * pi * current-radius / 360 left 1 set outer-ring-counter outer-ring-counter + (2 * pi * current-radius / 360) ; set around-counter around-counter + (2 * pi * current-radius / 360) * 1 set around-angle-counter around-angle-counter + 1 ] if going-home? [ forward 0.1 set home-counter home-counter + 0.1 ] if fill-area? [ if current-degrees >= central-angle [ set color red set end? true ] forward radius rt 180 forward radius rt 180 set around-counter around-counter + (1 / 360) * pi * radius * radius ; one step is around 15 pixels? print radius / 15 lt 1 set current-degrees current-degrees + 1 ] ] tick end to-report calc-sa report central-angle / 360 * pi * radius * radius end to-report calc-al report central-angle / 360 * 2 * pi * radius end to-report outer-ring-walked let dist 0 ask turtle 0 [ set dist outer-ring-counter ] report dist end to-report circle-walked let dist 0 ask turtle 0 [ set dist around-counter ] report dist end
There are 18 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Sector Area and Arc Length.png | preview | Preview for 'Sector Area and Arc Length' | over 5 years ago, by Mighty Chen | Download |
This model does not have any ancestors.
This model does not have any descendants.