Uniform Distribution on a Sphere Example 3D
Model was written in NetLogo 3D 4.1pre7
•
Viewed 909 times
•
Downloaded 44 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This code example demonstrates the correct way to uniformly distribute turtles on the surface of a sphere. Note that simply setting the heading and pitch to random numbers between 0 and 360 results in a non-uniform distribution with clustering at the poles in the z direction. The solution in SETUP-UNIFORM is based on information found here:
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
to setup-uniform ca crt number [ ;; remember that turtles automatically have a random heading when created tilt-up asin (1.0 - random-float 2.0) jump max-pxcor roll-right random-float 360 ] do-plot end to setup-not-uniform ca crt number [ ;; remember that turtles automatically have a random heading when created tilt-up random-float 360 jump max-pxcor roll-right random-float 360 ] do-plot end to do-plot set-current-plot "xcor" set-current-plot-pen "xcor" histogram [ xcor ] of turtles set-current-plot "ycor" set-current-plot-pen "ycor" histogram [ ycor ] of turtles set-current-plot "zcor" set-current-plot-pen "zcor" histogram [ zcor ] of turtles end ; Copyright 2007 Uri Wilensky. This code may be freely copied, distributed, ; altered, or otherwise used by anyone for any legal purpose.
There are 3 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Uniform Distribution on a Sphere Example 3D.png | preview | Preview for 'Uniform Distribution on a Sphere Example 3D' | over 11 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.