Uniform Distribution on a Sphere Example 3D

Uniform Distribution on a Sphere Example 3D preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 3D 4.1pre7 • Viewed 858 times • Downloaded 36 times • Run 0 times
Download the 'Uniform Distribution on a Sphere Example 3D' modelDownload this modelEmbed this model

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:

http://mathworld.wolfram.com/SpherePointPicking.html

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.

Uploaded by When Description Download
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky almost 14 years ago Uniform Distribution on a Sphere Example 3D Download this version

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' about 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.