tess 0.4.0
Performance-first tile and path simulation substrate
Loading...
Searching...
No Matches
tess::DistanceFieldScratch Class Reference

#include <tess/path/path.h>

Public Member Functions

void reserve_nodes (std::size_t node_count)
auto capacity_nodes () const noexcept -> std::size_t

Friends

template<typename WorldType, typename Tag>
auto build_distance_field (const WorldType &world, Coord3 goal, DistanceFieldScratch &scratch, MissingChunkPolicy policy=MissingChunkPolicy::TreatAsBlocked) -> DistanceFieldResult
 Builds an unweighted goal-rooted field into caller-owned scratch.
template<typename World, typename Tag>
auto distance_field_path (const World &world, Coord3 start, Coord3 goal, DistanceFieldScratch &scratch) -> PathResult
template<typename WorldType, typename Class>
auto build_weighted_distance_field (const WorldType &world, Coord3 goal, DistanceFieldScratch &scratch, MissingChunkPolicy policy=MissingChunkPolicy::TreatAsBlocked) -> DistanceFieldResult
 Builds a movement-class weighted field into reusable caller scratch.
template<typename World, typename Class>
auto build_weighted_distance_field_in_box (const World &world, Coord3 goal, Box3 domain, DistanceFieldScratch &scratch, MissingChunkPolicy policy=MissingChunkPolicy::TreatAsBlocked) -> DistanceFieldResult
 Builds a weighted field restricted to the intersection with domain.
template<typename World, typename Class, std::uint32_t MaxCost>
auto detail::build_bounded_weighted_distance_field_core (const World &world, Coord3 goal, DistanceFieldScratch &scratch, MissingChunkPolicy policy, std::span< const std::uint64_t > settle_targets) -> DistanceFieldResult
template<typename World, typename Class>
auto detail::weighted_distance_field_path_core (const World &world, Coord3 start, Coord3 goal, DistanceFieldScratch &scratch, bool verify_residency) -> PathResult
template<typename World, typename Class, std::uint32_t MaxCost>
auto weighted_path_batch (const World &world, std::span< const PathRequest > requests, WeightedPathBatchScratch &scratch) -> std::span< const PathResult >
template<typename World, typename Tag>
auto build_distance_field_product (const World &world, const GoalSet &goals, DistanceFieldScratch &scratch, DistanceFieldProduct &product) -> DistanceFieldResult
 Builds a dense multi-goal field into caller-owned reusable storage.
template<typename World, typename Tag>
auto distance_field_product_path (const World &world, Coord3 start, const DistanceFieldProduct &product, DistanceFieldScratch &scratch) -> PathResult
 Reconstructs a borrowed path from a valid multi-goal product.
template<typename World, typename Tag>
auto nearest_target (const World &world, Coord3 start, const DistanceFieldProduct &product, DistanceFieldScratch &scratch) -> NearestTargetResult
 Finds the nearest reachable goal represented by a valid product.

Detailed Description

Owns reusable frontier, distance, dependency, and path storage for fields.

Returned paths borrow this object. Instances require external synchronization; reserve node capacity for allocation-free warm queries.

◆ build_distance_field

template<typename WorldType, typename Tag>
auto build_distance_field ( const WorldType & world,
Coord3 goal,
DistanceFieldScratch & scratch,
MissingChunkPolicy policy = MissingChunkPolicy::TreatAsBlocked ) -> DistanceFieldResult
friend

Builds an unweighted goal-rooted field into caller-owned scratch.

Builds an unweighted field rooted at goal into reusable scratch storage.

The build may allocate unless scratch was reserved. Sparse residency boundaries follow policy and are reported conservatively.

◆ build_distance_field_product

template<typename World, typename Tag>
auto build_distance_field_product ( const World & world,
const GoalSet & goals,
DistanceFieldScratch & scratch,
DistanceFieldProduct & product ) -> DistanceFieldResult
friend

Builds a dense multi-goal field into caller-owned reusable storage.

Builds a dense-world multi-goal field into caller-owned product.

Invalid goals return InvalidGoal. Reusing reserved product and scratch capacity avoids steady-state allocation.

◆ build_weighted_distance_field

template<typename WorldType, typename Class>
auto build_weighted_distance_field ( const WorldType & world,
Coord3 goal,
DistanceFieldScratch & scratch,
MissingChunkPolicy policy = MissingChunkPolicy::TreatAsBlocked ) -> DistanceFieldResult
friend

Builds a movement-class weighted field into reusable caller scratch.

Builds a movement-class weighted field rooted at goal.

The build may allocate unless scratch was reserved. Sparse boundaries follow policy and zero entry cost is impassable.

◆ build_weighted_distance_field_in_box

template<typename World, typename Class>
auto build_weighted_distance_field_in_box ( const World & world,
Coord3 goal,
Box3 domain,
DistanceFieldScratch & scratch,
MissingChunkPolicy policy = MissingChunkPolicy::TreatAsBlocked ) -> DistanceFieldResult
friend

Builds a weighted field restricted to the intersection with domain.

Builds a weighted distance field constrained to domain.

Returns InvalidGoal when the goal is outside the world, domain, or movement class. The caller owns scratch; reuse it to avoid allocations.

◆ distance_field_path

template<typename World, typename Tag>
auto distance_field_path ( const World & world,
Coord3 start,
Coord3 goal,
DistanceFieldScratch & scratch ) -> PathResult
friend

Reconstructs a path by descending the last matching distance-field build.

The returned path borrows scratch; stale sparse residency returns NoPath so callers rebuild instead of reading mismatched node slots.

◆ distance_field_product_path

template<typename World, typename Tag>
auto distance_field_product_path ( const World & world,
Coord3 start,
const DistanceFieldProduct & product,
DistanceFieldScratch & scratch ) -> PathResult
friend

Reconstructs a borrowed path from a valid multi-goal product.

Reconstructs a path from start through a valid dense-world product.

The returned path borrows scratch storage until its next mutation.

◆ nearest_target

template<typename World, typename Tag>
auto nearest_target ( const World & world,
Coord3 start,
const DistanceFieldProduct & product,
DistanceFieldScratch & scratch ) -> NearestTargetResult
friend

Finds the nearest reachable goal represented by a valid product.

Finds the closest reachable goal represented by a valid dense product.

The returned path borrows scratch storage until its next mutation.


The documentation for this class was generated from the following file: