import type { Static } from '@sinclair/typebox'; import { Position, Polygon } from './types/feature.js'; import { SensorAttributes } from './types/types.js'; import { sector } from '@turf/sector'; export default class Sensor { center: Static; sensor: Static; constructor( center: Static, sensor: Static ) { this.center = center; this.sensor = sensor; } to_geojson(): Static | null { if (!this.sensor.range) return null; if (!this.sensor.azimuth) return null; if (!this.sensor.fov) return null; return sector( this.center, this.sensor.range / 1000, this.sensor.azimuth, this.sensor.azimuth + this.sensor.fov, ).geometry; } }