import type { Vector3, Quaternion } from '@holoscript/core'; export type { Vector3, Quaternion } from '@holoscript/core'; export type Vector2 = readonly [number, number]; /** * Axis-aligned bounding box */ export interface BoundingBox { min: Vector3; max: Vector3; } /** * Oriented bounding box with rotation */ export interface OrientedBoundingBox { center: Vector3; halfExtents: Vector3; rotation: Quaternion; } /** * Sphere bounds */ export interface BoundingSphere { center: Vector3; radius: number; } /** * Entity that exists in spatial space */ export interface SpatialEntity { id: string; type: string; position: Vector3; rotation?: Quaternion; bounds?: BoundingBox | BoundingSphere; velocity?: Vector3; metadata?: Record; } /** * Defined region in space */ export interface Region { id: string; name: string; type: 'box' | 'sphere' | 'polygon' | 'custom'; bounds: BoundingBox | BoundingSphere; properties?: Record; } /** * Line of sight between two points */ export interface SightLine { from: Vector3; to: Vector3; blocked: boolean; blockingEntity?: string; distance: number; } /** * Complete spatial context for an agent */ export interface SpatialContext { /** Agent's current position */ agentPosition: Vector3; /** Agent's orientation */ agentRotation?: Quaternion; /** Agent's bounding volume */ agentBounds?: BoundingBox; /** Current velocity */ agentVelocity?: Vector3; /** Entities within perception radius */ nearbyEntities: SpatialEntity[]; /** Regions the agent is currently in */ currentRegions: Region[]; /** All defined regions in the scene */ allRegions: Region[]; /** Computed sight lines to relevant entities */ sightLines: SightLine[]; /** Timestamp of context snapshot */ timestamp: number; /** Update rate in Hz */ updateRate: number; } /** * Event when entity enters perception radius */ export interface EntityEnteredEvent { type: 'entity_entered'; entity: SpatialEntity; distance: number; timestamp: number; } /** * Event when entity exits perception radius */ export interface EntityExitedEvent { type: 'entity_exited'; entity: SpatialEntity; timestamp: number; } /** * Event when agent enters a region */ export interface RegionEnteredEvent { type: 'region_entered'; region: Region; previousRegion?: Region; timestamp: number; } /** * Event when agent exits a region */ export interface RegionExitedEvent { type: 'region_exited'; region: Region; timestamp: number; } /** * Event when sight line to entity changes */ export interface VisibilityChangedEvent { type: 'visibility_changed'; entityId: string; visible: boolean; sightLine: SightLine; timestamp: number; } /** * Union of all spatial events */ export type SpatialEvent = EntityEnteredEvent | EntityExitedEvent | RegionEnteredEvent | RegionExitedEvent | VisibilityChangedEvent; /** * Configuration for spatial awareness */ export interface SpatialAwarenessConfig { /** How often to update spatial context (Hz) */ updateRate: number; /** Maximum distance for entity perception (meters) */ perceptionRadius: number; /** Maximum distance for visibility checks (meters) */ visibilityRadius: number; /** Enable region tracking */ trackRegions: boolean; /** Enable sight line computation */ computeSightLines: boolean; /** Entity types to track (empty = all) */ entityTypeFilter: string[]; /** Minimum movement to trigger update (meters) */ movementThreshold: number; } /** * Default spatial awareness configuration */ export declare const DEFAULT_SPATIAL_CONFIG: SpatialAwarenessConfig; /** * Calculate distance between two points */ export declare function distance(a: Vector3, b: Vector3): number; /** * Calculate squared distance (faster when comparing) */ export declare function distanceSquared(a: Vector3, b: Vector3): number; /** * Check if point is inside bounding box */ export declare function isPointInBox(point: Vector3, box: BoundingBox): boolean; /** * Check if point is inside sphere */ export declare function isPointInSphere(point: Vector3, sphere: BoundingSphere): boolean; /** * Get center of bounding box */ export declare function getBoxCenter(box: BoundingBox): Vector3; /** * Check if two bounding boxes overlap */ export declare function boxesOverlap(a: BoundingBox, b: BoundingBox): boolean; /** * Normalize a vector */ export declare function normalize(v: Vector3): Vector3; /** * Subtract two vectors */ export declare function subtract(a: Vector3, b: Vector3): Vector3; /** * Add two vectors */ export declare function add(a: Vector3, b: Vector3): Vector3; /** * Scale a vector */ export declare function scale(v: Vector3, s: number): Vector3; /** * Dot product of two vectors */ export declare function dot(a: Vector3, b: Vector3): number; /** * Cross product of two vectors */ export declare function cross(a: Vector3, b: Vector3): Vector3; /** * Linear interpolation between two vectors */ export declare function lerp(a: Vector3, b: Vector3, t: number): Vector3; //# sourceMappingURL=SpatialTypes.d.ts.map