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
83
84
85
//! Geometric utility functions for convex hull computations
//!
//! This module provides geometric calculations needed for convex hull algorithms,
//! organized by dimensionality for optimal performance and clarity.
//!
//! # Module Organization
//!
//! - [`calculations_2d`] - 2D geometric calculations (cross products, areas, perimeters)
//! - [`calculations_3d`] - 3D geometric calculations (volumes, surface areas, vector operations)
//! - [`high_dimensional`] - High-dimensional calculations and approximations
//!
//! # Examples
//!
//! ## 2D Calculations
//! ```rust
//! use scirs2_spatial::convex_hull::geometry::calculations_2d::{cross_product_2d, compute_polygon_area};
//! use scirs2_core::ndarray::array;
//!
//! // Check orientation of three points
//! let p1 = [0.0, 0.0];
//! let p2 = [1.0, 0.0];
//! let p3 = [0.0, 1.0];
//! let cross = cross_product_2d(p1, p2, p3);
//! assert!(cross > 0.0); // Counterclockwise orientation
//!
//! // Compute polygon area
//! let points = array![[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]];
//! let vertices = vec![0, 1, 2, 3];
//! let area = compute_polygon_area(&points.view(), &vertices).unwrap();
//! assert!((area - 1.0).abs() < 1e-10);
//! ```
//!
//! ## 3D Calculations
//! ```rust
//! use scirs2_spatial::convex_hull::geometry::calculations_3d::{tetrahedron_volume, triangle_area_3d};
//!
//! // Compute tetrahedron volume
//! let p0 = [0.0, 0.0, 0.0];
//! let p1 = [1.0, 0.0, 0.0];
//! let p2 = [0.0, 1.0, 0.0];
//! let p3 = [0.0, 0.0, 1.0];
//! let volume = tetrahedron_volume(p0, p1, p2, p3);
//! assert!((volume.abs() - 1.0/6.0).abs() < 1e-10);
//!
//! // Compute triangle area in 3D
//! let area = triangle_area_3d(p0, p1, p2);
//! assert!((area - 0.5).abs() < 1e-10);
//! ```
//!
//! ## High-Dimensional Calculations
//! ```rust
//! use scirs2_spatial::convex_hull::geometry::high_dimensional::{compute_centroid, compute_bounding_box};
//! use scirs2_core::ndarray::array;
//!
//! let points = array![
//! [0.0, 0.0, 0.0, 0.0],
//! [1.0, 0.0, 0.0, 0.0],
//! [0.0, 1.0, 0.0, 0.0],
//! [0.0, 0.0, 1.0, 0.0]
//! ];
//! let vertices = vec![0, 1, 2, 3];
//!
//! let centroid = compute_centroid(&points.view(), &vertices);
//! let (min_coords, max_coords) = compute_bounding_box(&points.view(), &vertices);
//! ```
// Re-export commonly used functions for convenience
pub use ;
pub use ;
pub use ;