pub struct SpatialQuality {
pub evr: f64,
pub cap_areas: Vec<f64>,
pub exclusivities: Vec<f64>,
pub voronoi_cells: Vec<VoronoiCell>,
pub pairwise_intersections: HashMap<(usize, usize), f64>,
pub coverage: CoverageReport,
pub bridge_threshold: f64,
pub bridge_quality_matrix: Vec<Vec<f64>>,
}Expand description
Pre-computed spatial properties of the category layout on S².
Every field here is derived from the category centroids and angular
spreads — no embedding-space information, pure sphere geometry.
This struct is computed once during CategoryLayer::build() and
informs bridge detection, edge weights, and confidence scoring.
Fields§
§evr: f64Global explained variance ratio of the projection.
cap_areas: Vec<f64>Solid angle of each category’s cap (2π(1 − cos α)).
exclusivities: Vec<f64>Per-category exclusivity: fraction of cap not overlapped by any other. 1.0 = isolated, 0.0 = completely overlapped.
voronoi_cells: Vec<VoronoiCell>Voronoi cell for each category (area + neighbor indices).
pairwise_intersections: HashMap<(usize, usize), f64>Pairwise cap intersection areas in steradians, keyed by
(min(i, j), max(i, j)). Only pairs with measurable overlap
(> 1e-15 sr) are stored, keeping the map sparse.
coverage: CoverageReportCoverage report: what fraction of S² is claimed by any category.
bridge_threshold: f64EVR-adaptive bridge threshold. Higher EVR → looser threshold. Formula: 0.5 + (1 − EVR)² × 0.4
bridge_quality_matrix: Vec<Vec<f64>>C×C matrix of spatially-adjusted bridge quality between category pairs.
matrix[i][j] = max_bridge_strength(i,j) × territorial_factor(i,j).
Empty until Self::set_bridge_quality_matrix is called with a
built CategoryGraph (done during CategoryLayer::build).
Implementations§
Source§impl SpatialQuality
impl SpatialQuality
Sourcepub fn compute(
centroids: &[SphericalPoint],
half_angles: &[f64],
evr: f64,
) -> Self
👎Deprecated: use compute_with_config; this uses PipelineConfig::default() sample counts
pub fn compute( centroids: &[SphericalPoint], half_angles: &[f64], evr: f64, ) -> Self
use compute_with_config; this uses PipelineConfig::default() sample counts
Compute spatial quality from category centroids and angular spreads, using the legacy default Monte Carlo sample counts.
Sourcepub fn compute_with_config(
centroids: &[SphericalPoint],
half_angles: &[f64],
evr: f64,
config: &PipelineConfig,
) -> Self
pub fn compute_with_config( centroids: &[SphericalPoint], half_angles: &[f64], evr: f64, config: &PipelineConfig, ) -> Self
Compute spatial quality using configurable sample counts and bridge threshold parameters.
Cost at default sample counts: ~100-200ms for 31 categories. This is a one-time build cost, not per-query.
Sourcepub fn set_bridge_quality_matrix(&mut self, graph: &CategoryGraph)
pub fn set_bridge_quality_matrix(&mut self, graph: &CategoryGraph)
Populate the C×C bridge_quality_matrix from a freshly built graph.
Each cell is edge.max_bridge_strength × territorial_factor(i, j),
left at 0.0 where no edge exists (including the diagonal).
Sourcepub fn territorial_factor(&self, cat_a: usize, cat_b: usize) -> f64
pub fn territorial_factor(&self, cat_a: usize, cat_b: usize) -> f64
Exclusivity-based territorial factor for a category pair.
Bridges between categories that heavily overlap (low exclusivity) are discounted — they’re shared territory, not genuine connectors. Returns a value in (0, 1].
Sourcepub fn are_voronoi_neighbors(&self, cat_a: usize, cat_b: usize) -> bool
pub fn are_voronoi_neighbors(&self, cat_a: usize, cat_b: usize) -> bool
Whether two categories are Voronoi neighbors (geometrically adjacent on S²).
Sourcepub fn voronoi_area(&self, cat: usize) -> f64
pub fn voronoi_area(&self, cat: usize) -> f64
Voronoi cell area for a category.
Sourcepub fn territorial_efficiency(&self, cat: usize, item_count: usize) -> f64
pub fn territorial_efficiency(&self, cat: usize, item_count: usize) -> f64
Territorial efficiency: items per steradian of Voronoi cell.
Sourcepub fn intersection_area(&self, cat_a: usize, cat_b: usize) -> f64
pub fn intersection_area(&self, cat_a: usize, cat_b: usize) -> f64
Cap intersection area between two categories.
Trait Implementations§
Source§impl Clone for SpatialQuality
impl Clone for SpatialQuality
Source§fn clone(&self) -> SpatialQuality
fn clone(&self) -> SpatialQuality
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SpatialQuality
impl RefUnwindSafe for SpatialQuality
impl Send for SpatialQuality
impl Sync for SpatialQuality
impl Unpin for SpatialQuality
impl UnsafeUnpin for SpatialQuality
impl UnwindSafe for SpatialQuality
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more