Git Product home page Git Product logo

graham-scan's Introduction

Graham Scan

Code written by tado-mi for CSC 284: advanced algorithms class at the University of Rochester. It is made public to demonstrate a code sample by the author, and for learning. We trust it will not be used to violate academic honesty policies.

The included code implements the Graham Scan to solve the Convex Hull problem. It outputs the steps of the algorithm on the input in a text format, and will soon have an implementation of step-by-step execution of the algorithm on a GUI.

Is a work in progress.

Files:

Point.java

Simple class representing a point in R^2. Of interest are the comparator methods, angleComparator in particular, which allows to sort points for the Graham Scan.

GrahamScan.java

The most involved class both implementing the algorithm (computeHull method), maintaining the execution steps (through log method), and dealing with graphics.

  • finish log method
  • decide whether GrahamScan should be involved with graphics

GUI.java

Snipped from a code originally written by Michael Scott (see here for details, if interested). Included here as a source of inspiration.

  • improve graphics: scaling & translating the points
  • highlight the 'focal' points and lines
  • enhance interactivity on the GUI: allow the user to { insert the filename / choose to see a random example } in the GUI; { set pace } in the GUI
  • display text explanation as steps are being executed

Demo.java

Where the main resides.

Compiling:

There is an included makefile for convenience. To run the code on a random input set, hit on the terminal:

make
make random

or, to run the code on the provided test/small.txt test case, hit:

make test

or, to run the code on a custom test case, run:

java main path/to/file

to free your computer from the bytes occupied by the .class:

make clean

graham-scan's People

Contributors

tado-mi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.