ferrum_cloud/
lib.rs

1//! # ferrum_cloud
2//!
3//! Pure Rust implementation of Point Cloud Library (PCL).
4//!
5//! This library provides efficient, safe, and ergonomic APIs for point cloud processing,
6//! leveraging Rust's ownership system, zero-cost abstractions, and parallel processing capabilities.
7//!
8//! ## Features
9//!
10//! - **Memory Safety**: Leverages Rust's ownership system for safe memory management
11//! - **Zero-Copy Operations**: Efficient processing through views and references
12//! - **Parallel Processing**: Built-in support for parallel operations using Rayon
13//! - **Generic Point Types**: Flexible point type system supporting various point formats
14//! - **Comprehensive I/O**: Support for multiple point cloud file formats
15//!
16//! ## Quick Start
17//!
18//! ```rust
19//! use ferrum_cloud::prelude::*;
20//!
21//! fn main() -> Result<()> {
22//!     // Load a point cloud
23//!     let cloud = io::load_pcd("scene.pcd")?;
24//!
25//!     // Process the cloud
26//!     let processed = cloud
27//!         .voxel_downsample(0.05)
28//!         .remove_outliers(50, 1.0)
29//!         .estimate_normals(0.5);
30//!
31//!     // Save the result
32//!     io::save_ply(&processed, "processed.ply")?;
33//!
34//!     Ok(())
35//! }
36//! ```
37
38pub mod algorithms;
39pub mod core;
40pub mod error;
41pub mod io;
42pub mod search;
43pub mod utils;
44
45// #[cfg(feature = "visualization")]
46// pub mod visualization;
47
48/// Prelude module for convenient imports
49pub mod prelude {
50    pub use crate::algorithms::*;
51    pub use crate::core::{Point, PointCloud, PointCloudView, PointXYZ, PointXYZRGB};
52    pub use crate::error::{CloudError, Result};
53    pub use crate::io;
54    pub use crate::search::*;
55
56    // #[cfg(feature = "visualization")]
57    // pub use crate::visualization::*;
58}
59
60// Re-export commonly used types
61pub use crate::core::{Point, PointCloud, PointXYZ, PointXYZRGB};
62pub use crate::error::{CloudError, Result};
63
64#[cfg(test)]
65mod tests {
66    use super::*;
67    use crate::prelude::*;
68
69    #[test]
70    fn test_basic_point_creation() {
71        let point = PointXYZ::new(1.0, 2.0, 3.0);
72        assert_eq!(point.position(), [1.0, 2.0, 3.0]);
73    }
74
75    #[test]
76    fn test_point_cloud_creation() {
77        let points = vec![PointXYZ::new(0.0, 0.0, 0.0), PointXYZ::new(1.0, 1.0, 1.0)];
78        let cloud = PointCloud::from_points(points);
79        assert_eq!(cloud.len(), 2);
80    }
81}