import type { Vector3 } from '@holoscript/core'; /** * Spatial Query System * Sprint 4 Priority 4 - Spatial Context Awareness * * Provides efficient spatial queries for finding entities based on * distance, visibility, reachability, and region containment. */ import { SpatialEntity, Region, SightLine } from './SpatialTypes'; /** * Types of spatial queries */ export type SpatialQueryType = 'nearest' | 'within' | 'visible' | 'reachable' | 'in_region' | 'by_type' | 'raycast'; /** * Base query interface */ export interface SpatialQueryBase { type: SpatialQueryType; from: Vector3; entityTypeFilter?: string[]; maxResults?: number; } /** * Find nearest entities */ export interface NearestQuery extends SpatialQueryBase { type: 'nearest'; count?: number; } /** * Find entities within radius */ export interface WithinQuery extends SpatialQueryBase { type: 'within'; radius: number; includePartial?: boolean; } /** * Find visible entities */ export interface VisibleQuery extends SpatialQueryBase { type: 'visible'; direction?: Vector3; fov?: number; maxDistance?: number; } /** * Find reachable entities (pathfinding) */ export interface ReachableQuery extends SpatialQueryBase { type: 'reachable'; maxDistance?: number; obstacles?: SpatialEntity[]; } /** * Find entities in a region */ export interface InRegionQuery extends SpatialQueryBase { type: 'in_region'; region: Region; } /** * Find entities by type */ export interface ByTypeQuery extends SpatialQueryBase { type: 'by_type'; entityTypes: string[]; radius?: number; } /** * Raycast query */ export interface RaycastQuery extends SpatialQueryBase { type: 'raycast'; direction: Vector3; maxDistance: number; hitFirst?: boolean; } /** * Union of all query types */ export type SpatialQuery = NearestQuery | WithinQuery | VisibleQuery | ReachableQuery | InRegionQuery | ByTypeQuery | RaycastQuery; /** * Single query result with distance */ export interface QueryResult { entity: SpatialEntity; distance: number; direction?: Vector3; sightLine?: SightLine; } /** * Raycast hit result */ export interface RaycastHit { entity: SpatialEntity; point: Vector3; distance: number; normal?: Vector3; } /** * Executes spatial queries against a set of entities */ export declare class SpatialQueryExecutor { private entities; private regions; private spatialIndex; constructor(); /** * Update the entity set */ updateEntities(entities: SpatialEntity[]): void; /** * Update regions */ updateRegions(regions: Region[]): void; /** * Execute a spatial query */ execute(query: SpatialQuery): QueryResult[]; /** * Find nearest entities */ private executeNearest; /** * Find entities within radius */ private executeWithin; /** * Find visible entities */ private executeVisible; /** * Find reachable entities (simplified - no full pathfinding) */ private executeReachable; /** * Find entities in a region */ private executeInRegion; /** * Find entities by type */ private executeByType; /** * Execute raycast */ private executeRaycast; /** * Check line of sight between two points */ private checkSightLine; /** * Raycast against a single entity */ private raycastEntity; /** * Get approximate radius of an entity */ private getEntityRadius; /** * Check if point is in region */ private isInRegion; } //# sourceMappingURL=SpatialQuery.d.ts.map