Code Monkey home page Code Monkey logo

navigine / indoor-routing-library Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 15.06 MB

Welcome to Navigine Indoor Routing Library, a special portal that involves a set of navigation algorithms for working with the routing graph that are useful for creating location-powered solutions of Indoor Navigation and Wayfinding for various spaces and environments..

CMake 0.95% Makefile 0.10% C++ 98.96%
indoor indoor-navigation indoor-positioning-algorithms navigation-algorithms routing-algorithm routing-graphs indoor-wayfinding

indoor-routing-library's Introduction

The Indoor Routing Library contains a set of algorithms for working with the routing graph.

The main features are:

  • build a graph by specifying the vertices in Cartesian coordinates
  • check if the graph is strongly connected (Kosaraju's algorithm)
  • find the shortest route from the starting point to one or more destination points (Dijkstra's algorithm)

The key features of this library in comparison with similar ones are:
  • the ability to set start and destination points outside the graph (in other words, it is possible to project these points onto the original graph and add corresponding edges to it)
  • multilevel graph supported
  • the resulting route contains events - hints in which direction to move to reach the destination

Build

To build a library and unit tests that check the validity of a given graph and find the optimal route, you need to run a number of commands:

1. cmake -S . -B build -DJSON_CI=On
2. cmake --build build

Example

Create and fill in the graph:

    mRouteGrapgh = RouteGraph();
    mRouteGrapgh.addLevel(22129);
    const auto vid1 = mRouteGrapgh.addVertex(RouteGraph::Vertex{.levelPoint=LevelPoint{.level=22129, .x=18.32, .y=21.33}, .id=125441});
    const auto vid2 = mRouteGrapgh.addVertex(RouteGraph::Vertex{.levelPoint=LevelPoint{.level=22129, .x=18.24, .y=8.85}, .id=125442});
    const auto vid3 = mRouteGrapgh.addVertex(RouteGraph::Vertex{.levelPoint=LevelPoint{.level=22129, .x=19.02, .y=8.82}, .id=125449});
    const auto vid4 = mRouteGrapgh.addVertex(RouteGraph::Vertex{.levelPoint=LevelPoint{.level=22129, .x=18.87, .y=4.15}, .id=125450});
    const auto vid5 = mRouteGrapgh.addVertex(RouteGraph::Vertex{.levelPoint=LevelPoint{.level=22129, .x=19.73, .y=8.79}, .id=125451});


    const auto eid1 = mRouteGrapgh.addEdge(RouteGraph::Edge{.level=22129, .id=1, .src=vid1, .dst=vid2, .weight=1.0});
    const auto eid2 = mRouteGrapgh.addEdge(RouteGraph::Edge{.level=22129, .id=2, .src=vid2, .dst=vid1, .weight=1.0});
    const auto eid3 = mRouteGrapgh.addEdge(RouteGraph::Edge{.level=22129, .id=3, .src=vid3, .dst=vid4, .weight=1.0});
    const auto eid4 = mRouteGrapgh.addEdge(RouteGraph::Edge{.level=22129, .id=4, .src=vid4, .dst=vid3, .weight=1.0});
    const auto eid5 = mRouteGrapgh.addEdge(RouteGraph::Edge{.level=22129, .id=5, .src=vid3, .dst=vid5, .weight=1.0});
    const auto eid6 = mRouteGrapgh.addEdge(RouteGraph::Edge{.level=22129, .id=6, .src=vid5, .dst=vid3, .weight=1.0});
    const auto eid7 = mRouteGrapgh.addEdge(RouteGraph::Edge{.level=22129, .id=7, .src=vid2, .dst=vid3, .weight=1.0});
    const auto eid8 = mRouteGrapgh.addEdge(RouteGraph::Edge{.level=22129, .id=8, .src=vid3, .dst=vid2, .weight=1.0});

Check if the constructed graph is valid: This operation includes:

  1. snapping close edges of the graph
  2. splitting graph edges
  3. checking the intersecting edges of the graph
  4. level connectivity check
  5. checking the connectivity of transitions between levels
int errNum = mRouteGrapgh.checkFull(&errors);
if (!(errNum > 0))
    std::cout << "Graph is valid." << std::endl;

Set start and destination points:

  LevelPoint P{.level=22129, .x=17.14, .y=18.27};
  LevelPoint Q{.level=22129, .x=19.71, .y=6.78};

Build a route:

This method returns a structure RoutePath that contains:

  1. the length of the route
  2. a set of bypass vertices
  3. a set of events
RoutePath path = mRouteGrapgh.getPath(P, Q);

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.