Skip to main content
gamedev.net
🔒 Locked

Simple geometry algorithms

Started by ToohrVyk Mar 15, 2007 at 1:40 PM 0 replies 1.5k views
Original Post
ToohrVyk
ToohrVyk
I'm teaching Caml Light programming to a CS 101 class. Next week, I'll be covering 2D graphics, and the students get their hands on the computers so I would like to give out some exercises which are both interesting and non-trivial. I expect that it won't take more than 15 minutes for them to tackle the "draw a circle, draw a line, draw a polygon, draw a pixel, draw a bezier curve" part of the subject using the provided library functions. The graphics library is the default Caml Light one. It can handle animations pretty well, but that takes some time to teach unless I restrict myself to low framerates. It handles pixel-putting, 24-bit colors, lines, polygons (filled or unfilled), ellipses, rectangles and text. So, here are a few other ideas I've had, and I'd be glad if you guys had any other suggestions.
  • (Last year) Sierpinsky triangle.
  • (Last year) color gradients.
  • (Last year) naive convex hull algorithm.
  • (Last year) naive triangulation algorithm.
  • (Last year) destructible worms-style terrain.
  • (Last year) 2D waves.
  • Wolfram's rule 30
  • Game of life
  • Tetris
  • Billiards simulation
  • Maze generator
  • Function graph plotter
  • Tiling the plane
Large subjects, such as triangulating meshes or casting rays, require too much work before any decent result is visible, so I'd rather avoid them.
Lode
Lode
Not to push forward my work or anything, but I've written some tutorials on 2D graphical effects, maybe you can get some inspiration from that page:

http://student.kuleuven.be/~m0216922/CG/index.html

The topics from there are:

Color and Image Arithmetic    * Light and Color: How humans see color, Color Model Conversions, and editing colors of images    * Image Arithmetic: Adding, Subtracting, ...	2D Drawing    * Painting: Painting with brushes of various colors, opacities and sizes    * Flood Fill: Filling areas with a new color    * Cohen Sutherland Clipping: Clipping 2D Lines	Fractals    * Recursion Trees: Make trees with fractals    * Sierpinski Fractals: Sierpinski Triangle and Sierpinski Carpet    * Julia and Mandelbrot Set: Those pretty fractals	Oldskool Effects    * Plasma: The plasma effect    * Fire Effect: The classic    * Tunnel Effect: It looks like a 3D tunnel	Raycasting    * Raycasting: Untextured and textured walls    * Raycasting II: Floor and Ceiling    * Raycasting III: Sprites	3D Graphics    * 3D Basics: How 3D graphics work, building a Camera Class    * Points, Sprites and Moving: Project 3D points and sprites on screen, control the camera    * 3D Lines: Drawing and clipping 3D linesFiltering and FT    * Image Filtering: Blur, Find Edges, Emboss, ...    * Fourier Transform: Introduction to FT and frequency spectrum of signals an images, and using it on RGB color images	Texture Generation    * The XOR Texture: Not artistic, but handy    * Perlin Noise: Turbulence, Clouds, Marble, Wood, ...	Mathematics    * Vectors: Needed for 3D graphics    * Matrices and Transformations: For transformations in 3D graphics    * Complex Numbers: What's the square root of -1?	Image File Types    * PNG Loader: A .png image loader for C++. No library dependencies.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.