Sector Area and Arc Length
Model was written in NetLogo 6.1.0
•
Viewed 101 times
•
Downloaded 6 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
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' | almost 3 years ago, by Mighty Chen | Download |
This model does not have any ancestors.
This model does not have any descendants.