wiki:Projects/SpringyGraph

Assignment 2 - A graph editor

Project Overview

This project started out as an attempt to make a particle system affected by interesting-looking physics which "balanced" a graph automatically. I settled on a compromise where it is more of a graph editor with mathematical relationships which help slightly balance the graph but don't actually model any real physics.

Nodes that are near each other are pushed apart. Nodes that are far apart and connected by an edge are pulled together.

Interaction

  • Keyboard: (primarily "extra" in terms of using the program)
    • Escape - exits
    • 1 - sets the edge length to the default
    • 2 and 3 - changes the edge length
    • 0 - sets the "force" strength to the default
    • - and + - changes the "force" strength
  • Mouse:
    • Right click to get a pop-up menu
    • Left click on the menu to do the following:
      • The yellow rectangle switches to the "node" tool. When it is selected, clicking in the drawing area creates a new node.
      • The green line switches to the edge tool. Press down near one node and release near another to draw an edge. A temporary line is drawn to show you where it will be placed.
      • The red X removes all of the edges and nodes.
      • The play button pauses and unpauses the animation.
    • Drag nodes with the middle mouse button to move them
    • The node nearest the cursor is the "selected" node. It is blue.

Files

  • assignment2.cpp - The one and only source file
  • globj - The executable
  • globj.png - A screenshot of a person
  • Makefile - A very simple, strict, yet sadly not very portable makefile
  • README - This
  • graph.txt - An example graph which can be loaded with the right mouse button's menu

Compilation Instructions

Compiled in Linux with:

  • gcc-3.3.1
  • glut-3.7.1
Last modified 12 years ago Last modified on Aug 7, 2005, 6:48:34 PM

Attachments (6)

Download all attachments as: .zip