1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! # Geometry Module
//!
//! This module provides geometric primitives and spatial calculations for traffic simulation,
//! supporting both Euclidean and geographic coordinate systems.
//!
//! ## Key Components
//!
//! ### Point System
//! - [`point::Point`] - Core trait defining point operations
//! - [`point::PointType`] - Enum supporting multiple coordinate systems
//! - [`point::EuclideanPoint`] - Points in Euclidean space (for grid-based simulations)
//! - [`point::WGS84Point`] - Geographic points using WGS84 coordinate system
//! - [`point::SRID`] - Spatial Reference System Identifiers
//!
//! ### Spatial Functions
//! - [`spatial::get_bearing`] - Calculate bearing between two geographic points
//! - [`spatial::gc_distance`] / [`gc_distance_pt`] - Great-circle distance calculations
//! - [`spatial::convert_epsg4326_to_3857`] / [`convert_epsg3857_to_4326`] - Coordinate system conversions
//!
//! ## Coordinate Systems
//!
//! The module supports two primary coordinate systems:
//!
//! - **Euclidean** (`SRID::Euclidean`): For abstract grid-based simulations
//! - **WGS84** (`SRID::WGS84`): For real-world geographic simulations
//!
//! ## Usage Examples
//!
//! ### Creating Points
//!
//! ```rust
//! use micro_traffic_sim_core::geom::{new_point, SRID, Point};
//!
//! // Euclidean point (default)
//! let grid_point = new_point(10.0, 20.0, None);
//!
//! // Geographic point (WGS84)
//! let moscow = new_point(37.6176, 55.7558, Some(SRID::WGS84));
//! let spb = new_point(30.3141, 59.9386, Some(SRID::WGS84));
//!
//! // Calculate distance
//! let distance = moscow.distance_to(&spb); // Great-circle distance in meters
//! ```
//!
//! ### Spatial Calculations
//!
//! ```rust
//! use micro_traffic_sim_core::geom::{new_point, SRID, get_bearing, gc_distance};
//!
//! let pt1 = new_point(37.6176, 55.7558, Some(SRID::WGS84)); // Moscow
//! let pt2 = new_point(30.3141, 59.9386, Some(SRID::WGS84)); // St. Petersburg
//!
//! // Get bearing from Moscow to St. Petersburg
//! let bearing = get_bearing(&pt1, &pt2); // Degrees from North
//!
//! // Calculate great-circle distance
//! let distance = gc_distance(37.6176, 55.7558, 30.3141, 59.9386); // Meters
//! ```
//!
//! ### Coordinate Conversions
//!
//! ```rust
//! use micro_traffic_sim_core::geom::{convert_epsg4326_to_3857, convert_epsg3857_to_4326};
//!
//! // Convert from WGS84 to Web Mercator (for web mapping)
//! let (x_mercator, y_mercator) = convert_epsg4326_to_3857(37.6176, 55.7558);
//!
//! // Convert back to WGS84
//! let (lon, lat) = convert_epsg3857_to_4326(x_mercator, y_mercator);
//! ```
//!
//! ## Applications
//!
//! - **Grid-based simulations**: Use Euclidean points for cellular automata
//! - **Real-world simulations**: Use WGS84 points with real geographic data
//! - **Web mapping integration**: Convert between coordinate systems for visualization
//! - **Navigation**: Calculate bearings and distances for route planning
pub use ;