UNPKG

expo-osm-sdk

Version:

OpenStreetMap component for React Native with Expo

64 lines 2.35 kB
/** * Geofencing Utility Functions * * Core algorithms for geofence detection: * - Distance calculations (Haversine formula) * - Point-in-polygon detection (Ray casting algorithm) * - Circle boundary checks */ import type { Coordinate, Geofence, CircleGeofence, PolygonGeofence } from '../types'; /** * Calculate distance between two coordinates using Haversine formula * @param point1 First coordinate * @param point2 Second coordinate * @returns Distance in meters */ export declare function calculateDistance(point1: Coordinate, point2: Coordinate): number; /** * Check if a point is inside a circle geofence * @param point Point to check * @param geofence Circle geofence * @returns true if point is inside the circle */ export declare function isPointInCircle(point: Coordinate, geofence: CircleGeofence): boolean; /** * Check if a point is inside a polygon geofence using ray casting algorithm * @param point Point to check * @param geofence Polygon geofence * @returns true if point is inside the polygon */ export declare function isPointInPolygon(point: Coordinate, geofence: PolygonGeofence): boolean; /** * Check if a point is inside any geofence * @param point Point to check * @param geofence Geofence (circle or polygon) * @returns true if point is inside the geofence */ export declare function isPointInGeofence(point: Coordinate, geofence: Geofence): boolean; /** * Calculate distance from point to geofence boundary * @param point Point to check * @param geofence Geofence * @returns Distance in meters (positive if outside, negative if inside) */ export declare function distanceToGeofence(point: Coordinate, geofence: Geofence): number; /** * Validate geofence configuration * @param geofence Geofence to validate * @returns true if valid, false otherwise */ export declare function validateGeofence(geofence: Geofence): boolean; /** * Get center point of a geofence * @param geofence Geofence * @returns Center coordinate */ export declare function getGeofenceCenter(geofence: Geofence): Coordinate; /** * Check if two geofences overlap * @param geofence1 First geofence * @param geofence2 Second geofence * @returns true if geofences overlap */ export declare function doGeofencesOverlap(geofence1: Geofence, geofence2: Geofence): boolean; //# sourceMappingURL=geofencing.d.ts.map