Skip to main content

Crate condor_navmesh

Crate condor_navmesh 

Source
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

SurfaceWhen to useEntry points
Static meshOne-shot or caller-owned immutable geometryNavmesh, NavmeshPathfinder (ChannelSearch, TAStar, optional Polyanya)
PreparedBuild once, many neighbor/portal lookups or TRA* queriesPreparedNavmeshBuilderPreparedNavmesh / TRA* prepared maps
Dynamic availabilityEnable/disable cells or portals without carving geometryDynamicNavmeshStatematerialize → 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 adjacency
  • algorithms — channel search, TA* (static), TRA* prepared builders and waypoint-DB policies
  • [polyanya] (feature = "polyanya") — external Polyanya-backed NavmeshPathfinder

§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 navmesh::DynamicNavmeshError;
pub use navmesh::DynamicNavmeshPortalKey;
pub use navmesh::DynamicNavmeshState;
pub use navmesh::DynamicNavmeshUpdate;
pub use navmesh::DynamicPreparedNavmeshQuery;
pub use navmesh::DynamicPreparedNavmeshQueryMetadata;
pub use navmesh::DynamicPreparedNavmeshQueryResult;
pub use navmesh::DynamicPreparedNavmeshRebuildStatus;
pub use navmesh::Navmesh;
pub use navmesh::NavmeshCell;
pub use navmesh::NavmeshPath;
pub use navmesh::NavmeshPathfinder;
pub use navmesh::NavmeshPortal;
pub use navmesh::NavmeshQuery;
pub use navmesh::NavmeshQueryResult;
pub use navmesh::NavmeshSearchError;
pub use navmesh::NavmeshSearchResult;
pub use navmesh::NavmeshSearchStats;
pub use navmesh::NavmeshValidationError;
pub use navmesh::PreparedNavmesh;
pub use navmesh::PreparedNavmeshBuildError;
pub use navmesh::PreparedNavmeshBuilder;
pub use navmesh::StaticPreparedNavmesh;
pub use navmesh::StaticPreparedNavmeshBuilder;
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.
PolygonPath
Non-empty free-space polyline in scene coordinates with Euclidean cost.
PolygonScene
Bounded free space with polygon obstacles and walkability predicates.
PolygonSearchRequest
Start/goal pair for online polygonal search.
PolygonSearchStats
Work counters for polygonal search (typically expanded graph vertices).
WorldBounds
Axis-aligned rectangular world extent that bounds a PolygonScene.

Enums§

PolygonEndpoint
Endpoint role carried by PolygonValidationError::EndpointNotTraversable.
PolygonPathBuildError
Polygon path construction failed (empty polyline or invariant violation).
PolygonSearchError
Request rejected before search, or budget hard stop mid-search.
PolygonValidationError
Static geometry or endpoint validation failure for polygonal scenes.
SearchOutcome
Successful search computation, separate from request validation failures.

Traits§

PolygonPathfinder
Online exact pathfinder over a static polygonal obstacle scene.
SearchPathCost
Path value that exposes the cost reported by its search domain.
SearchVisitStats
Search statistics that expose an algorithm-defined node-visit count.

Type Aliases§

PolygonSearchResult
Polygonal search return type: validation / budget Err, or found/no-path with stats.