3D Surface

3D Surface 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 5.0.4 • Viewed 749 times • Downloaded 90 times • Run 0 times
Download the '3D Surface' 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 model maps turtles between Cartesian and spherical 3-dimensional coordinates. To create the appearance of a curved 3D surface, the program generates turtles with random x- and z-coordinates, then computes each turtle's y-coordinate based on x and z, and time. The cosine function is used in the formula to produce a curved surface. Varying the y coordinate based on time produces motion.

HOW IT WORKS

To render the surface in the NetLogo view, it maps from 3D to 2D coordinates as follows:

view x = turtle x + (turtle z) / 2 view y = turtle y + (turtle z) / 2

In other words, increasing z causes the turtle's apparent position to move both up and to the right.

HOW TO USE IT

Click the SETUP button to generate the turtles and place them on the surface. Click the GO (forever) button to run the model, which continuously varies the turtles' y-coordinates to generate a wavelike motion.

The NUM-TURTLES slider determines the number of turtles that make up the surface.

THINGS TO NOTICE

Notice that as the turtles move down (y-coordinate decreases) they become darker in color, and when they move up (y-coordinate increases) they become lighter.

THINGS TO TRY

Experiment with the NUM-TURTLES slider. How many turtles are needed to produce a realistic effect? Why doesn't it keep getting better-looking indefinitely as you add more turtles?

In the move procedure, try other numbers besides 5 in front of and inside the cosine function. Explain the new behavior!

EXTENDING THE MODEL

Try changing the formula used to compute the y-coordinate to produce differently shaped surfaces.

See if you can draw not just a surface, but a three dimensional shape such as a cone or a sphere.

NETLOGO FEATURES

Notice the use of scale-color to change a turtle's color based on its y-coordinate. Also see the model "Wave Machine" for a version that uses patches rather than turtles to make a 3-D membrane.

RELATED MODELS

3D Solids
Wave Machine

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Wilensky, U. (1998). NetLogo 3D Surface model. http://ccl.northwestern.edu/netlogo/models/3DSurface. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 1998 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2001.

Comments and Questions

2.5 D (Question)

Hey Uri, How about a simple 2.5 thing where you can map the base level of a 2D view onto a 3D surface, then lose the 3D surface? There are so many applications for 2.5D given the need/desire to use GIS data. Doing it this way would cut out the need for all those wasted patches above and below the surface. I'm sure you are busy but since you have all the tools already, it seemed like an easy(ish!) fix to the 2D model. Cheers for a great program.

Posted over 12 years ago

Click to Run Model

turtles-own [x3 y3 z3]

to setup
  clear-all
  set-default-shape turtles "circle"
  crt number [
    ;; randomly distribute the turtles over the xy plane
    set x3 random-float 100 - 50
    set y3 0
    set z3 random-float 100 - 50
    move 0
    render
  ]
  reset-ticks
end 

to go
  ask turtles [
    move ticks
    render
  ]
  tick
end 

to move [time]  ;; turtle procedure
  set y3 (5 * cos (5 * (time + x3))) +
         (5 * cos (5 * (time + z3)))
end 

to render ; turtle procedure
  ; convert 3D-space coordinates to NetLogo coordinates
  setxy (x3 + (z3 / 2))
        (y3 + (z3 / 2))
  ; make lightness/darkness proportional to height, for added 3D effect
  set color scale-color blue y3 -12 10
end 


; Copyright 1998 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky almost 12 years ago Updated version tag Download this version
Uri Wilensky almost 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky over 12 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago 3D Surface Download this version

Attached files

File Type Description Last updated
3D Surface.png preview Preview for '3D Surface' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.