Expand description
Owner crate for Condor’s navmesh domain: convex-cell substrate, prepared snapshots, dynamic availability, and online routing solvers.
§Ownership vs facade
This package (condor-pathfinding-navmesh, lib name condor_navmesh) is the
implementation owner. Runtime algorithms, mesh validation, walkability,
corridor/funnel geometry helpers, TRA* prepared builders, and the optional
Polyanya adapter all live here.
The root facade crate (condor / package condor-for-games) only
re-exports these types under navmesh / algorithm modules for consumer
compatibility. Prefer importing from this crate in domain work; consumers of
the published product surface use the facade alias. Do not treat the facade
as a second implementation home.
The implementation layer depends on core and geometry, never on grid or the public facade. Corpus conformance and capture evidence remain in private developer packages.
Continuous polygonal scene primitives (PolygonScene, PolygonPath, …)
are owned by the geometry crate and re-exported here so navmesh pathfinders
share one continuous polyline / substrate vocabulary without a second path
type.
§Surfaces
| Surface | When to use | Entry points |
|---|---|---|
| Static mesh | One-shot or caller-owned immutable geometry | Navmesh, NavmeshPathfinder (ChannelSearch, TAStar, optional Polyanya) |
| Prepared | Build once, many neighbor/portal lookups or TRA* queries | PreparedNavmeshBuilder → PreparedNavmesh / TRA* prepared maps |
| Dynamic availability | Enable/disable cells or portals without carving geometry | DynamicNavmeshState → materialize → rebuild prepared (e.g. DynamicPreparedNavmeshQuery) |
Prepared maps are immutable snapshots. Availability updates never patch a prepared map in place: materialize a new static mesh and re-run preprocess.
§Module map
navmesh— cells, portals, walkability, pathfinder trait, dynamic overlay, prepared adjacencyalgorithms— channel search, TA* (static), TRA* prepared builders and waypoint-DB policies- [
polyanya] (feature = "polyanya") — external Polyanya-backedNavmeshPathfinder
§Outcomes
Connectivity uses NavmeshQueryResult. Geometric routes return
NavmeshSearchResult = Result<SearchOutcome<…>, NavmeshSearchError>:
validation / adapter failures are Err; found vs no-path are both Ok with
stats. Mesh construction failures use NavmeshValidationError; dynamic
overlay failures use DynamicNavmeshError.
§Example: prepare once
A prepared map is the right starting point when many queries share one validated mesh. It is an immutable snapshot: rebuild it after changing mesh geometry or dynamic availability.
use condor_navmesh::{
Navmesh, NavmeshCell, Point2, PreparedNavmesh, PreparedNavmeshBuilder, TRAStarBuilder,
};
let navmesh = Navmesh::new(
vec![NavmeshCell::new(
"cell-0",
vec![
Point2::new(0.0, 0.0),
Point2::new(2.0, 0.0),
Point2::new(0.0, 2.0),
],
)],
vec![],
);
let prepared = TRAStarBuilder
.preprocess(&navmesh)
.expect("the single convex cell is valid");
assert_eq!(prepared.name(), "tra-star");Re-exports§
pub use algorithms::channel_search::ChannelSearch;pub use algorithms::ta_star::TAStar;pub use algorithms::tra_star::*;
Modules§
- algorithms
- Online and prepared navmesh solvers (channel search, TA*, TRA* builders). Online and prepared navmesh solvers owned by this crate.
- navmesh
- Convex-cell mesh substrate, walkability, prepared adjacency, dynamic availability. Deterministic convex-cell navmesh substrate: geometry, walkability, and availability.
- polygonal
- Compatibility re-export of geometry polygonal primitives (
PolygonScene, …).
Structs§
- Point2
- Continuous 2D point in world / scene coordinates (not grid cells).
- Polygon
- Simple polygon obstacle: closed ordered vertex ring, not necessarily convex.
- Polygon
Path - Non-empty free-space polyline in scene coordinates with Euclidean cost.
- Polygon
Scene - Bounded free space with polygon obstacles and walkability predicates.
- Polygon
Search Request - Start/goal pair for online polygonal search.
- Polygon
Search Stats - Work counters for polygonal search (typically expanded graph vertices).
- World
Bounds - Axis-aligned rectangular world extent that bounds a
PolygonScene.
Enums§
- Polygon
Endpoint - Endpoint role carried by
PolygonValidationError::EndpointNotTraversable. - Polygon
Path Build Error - Polygon path construction failed (empty polyline or invariant violation).
- Polygon
Search Error - Request rejected before search, or budget hard stop mid-search.
- Polygon
Validation Error - Static geometry or endpoint validation failure for polygonal scenes.
- Search
Outcome - Successful search computation, separate from request validation failures.
Traits§
- Polygon
Pathfinder - Online exact pathfinder over a static polygonal obstacle scene.
- Search
Path Cost - Path value that exposes the cost reported by its search domain.
- Search
Visit Stats - Search statistics that expose an algorithm-defined node-visit count.
Type Aliases§
- Polygon
Search Result - Polygonal search return type: validation / budget
Err, or found/no-path with stats.