Skip to main content

Module visibility_graph

Module visibility_graph 

Source
Expand description

Exact visibility-graph continuous polygonal pathfinder (sparse-scene baseline). Exact polygonal pathfinder using a visibility graph over scene vertices.

§Surface

Online crate::continuous::PolygonPathfinder baseline for continuous free space: no prepared surface—the graph is rebuilt every query. Each search:

  1. rejects non-walkable endpoints with typed errors;
  2. builds nodes = {start, goal} ∪ obstacle vertices;
  3. inserts undirected edges for every pair that passes PolygonScene::segment_is_walkable with Euclidean edge cost;
  4. runs Dijkstra from start to goal.

§Cost and behavior

Optimal under Condor’s f64 / epsilon walkability predicates (same cost contract as TFS). Prefer TFS on sparse pillar forests; denser vertex sets pay more here for all-pairs visibility tests. For many goals from one fixed source, use crate::shortest_path_map instead of re-running this online.

§Examples

use condor_geometry::{
    continuous::PolygonPathfinder,
    polygonal::{Point2, PolygonScene, PolygonSearchRequest, WorldBounds},
    visibility_graph::VisibilityGraph,
};

let scene = PolygonScene {
    world_bounds: WorldBounds::new(Point2::new(0.0, 0.0), Point2::new(3.0, 3.0)),
    obstacles: Vec::new(),
};
let request = PolygonSearchRequest::new(Point2::new(0.5, 0.5), Point2::new(2.5, 2.5));
let result = VisibilityGraph.search(&scene, request).expect("request is valid");
assert!(result.is_found());

Structs§

VisibilityGraph
Online exact continuous pathfinder: visibility graph + Dijkstra.