← Back

ofxAStar

github.com/paulobarcelos/ofxAStar · @paulobarcelos
OF 0.12 Releases Utilities

openFrameworks addon wrapping a classic STL A* implementation with bitmap-based 2D pathfinding helpers.

5 3 Last commit 4mo ago Created 14y ago

README

ofxAStar



openFrameworks addon wrapping Justin Heyes-Jones' STL A* implementation with a small 2D bitmap-map helper.

The useful bit for most sketches is ofxAStar::Map2D plus ofxAStar::Pathfinder2D: load a black/white image, choose a start and end coordinate, and get back a path that avoids blocked pixels.

Usage



ofImage image;
image.load("map.png");

ofxAStar::Map2D map;
map.setup(image);

ofxAStar::Pathfinder2D pathfinder;
pathfinder.setup(&map);

ofVec2f start(10, 20);
ofVec2f end(300, 220);
std::vector<ofVec2f> path = pathfinder.findPathVector(start, end);


White/non-zero pixels are treated as blocked; black pixels are treated as open space.

The original pointer-returning findPath() function is still available for older projects, but new code should use findPathVector() so ownership is clear and nothing leaks.

Compatibility



Tested with openFrameworks 0.12.1 on macOS.

The example includes the standard openFrameworks Makefile flow:

cd example
make Debug
make RunDebug

Get this addon

HTTPS
SSH

Latest release

0.2.0 ofxAStar 0.2.0 published 4mo ago
Maintenance release for current openFrameworks projects.

  • Adds findPathVector() as a value-returning path API while keeping the old pointer-returning wrapper.
  • Fixes rectangular map indexing (y * width + x) so non-square maps work correctly.
  • Updates map storage and node construction to avoid old ownership and initialization hazards.
  • Modernizes the example and adds Makefile-based building for openFrameworks 0.12.1.
  • Refreshes the README with a clearer usage path.
Verified with make Debug using openFrameworks 0.12.1 on macOS.