Code Monkey home page Code Monkey logo

phobosy's Introduction

Phobosy

An implementation of the A* search algorithm taking data directly from NASA's satellite images of Mars. The generated path has been designed to return to favor the ‘smoothest’ ride possible, meaning it punishes rapid changes in altitude.

Read my articles breaking down how Phobosy was built:

Motivation

I've wanted to explore pathfinding for some time and really grasp the 'magic' behind these algorithms. This was a great opportunity to take some brand new cartographic information while also indulging my inner astronomist.

Build status

Deployed - v1.0.1

Screenshots

alt text

Tech Stack

  • React
  • Redux
  • Node.js
  • Express.js
  • P5.js

Code Example

The heart of Phobosy is how it calculates a traversable graph from an image. The way this happens is that the image is converted to greyscale, then the heuristic function for A* is then updated to read the absolute difference in contrast between two points in the graph.

if (this.grayscaleWeights) {
  if (fromNeighbor && fromNeighbor.x != this.x && fromNeighbor.y != this.y) {
    return Math.abs(this.weight - fromNeighbor.weight) * 1.41421
  } else {
    return Math.abs(this.weight - fromNeighbor.weight)
  }
}

Thus, favoring level ground and avoiding areas of high contrast. The darker the pixel value, the lower it assumes the terrain is - the brighter the higher: alt text

Installation

Simply clone this repo down to your machine. Then:

npm i

Once completed:

npm run start-dev

How to use?

Simply click between two points on the map and watch the path load! You can clear the paths by clicking 'Clear coordinates' in the top-right corner.

License

MIT © Sam Peach

phobosy's People

Contributors

tmkelly28 avatar glebec avatar sam-peach avatar geoffbass avatar collin avatar fterdal avatar avillr avatar sethfork avatar b17z avatar khumphrey avatar queerviolet avatar dakotablair avatar omriackley avatar connieelee avatar dadewoyin avatar knxyzkn avatar short-matthew-f avatar rinaldo avatar

Stargazers

Ellemieke Van Kints avatar Maurice Shalam avatar

Watchers

James Cloos avatar

Forkers

marvinody

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.