threecrate_gpu/lib.rs
1//! # ThreeCrate GPU
2//!
3//! GPU-accelerated computing for 3D point cloud processing using WGPU.
4//!
5//! This crate provides GPU-accelerated implementations of common 3D point cloud
6//! processing algorithms, leveraging the power of modern graphics hardware.
7//!
8//! ## Example Usage
9//!
10//! ```rust,no_run
11//! use threecrate_gpu::{GpuContext, gpu_remove_statistical_outliers, gpu_radius_outlier_removal, gpu_voxel_grid_filter};
12//! use threecrate_core::{PointCloud, Point3f};
13//!
14//! async fn example() -> threecrate_core::Result<()> {
15//! let gpu_context = GpuContext::new().await?;
16//!
17//! let mut point_cloud = PointCloud::<Point3f>::new();
18//! // ... populate point cloud
19//!
20//! // Compute normals using GPU acceleration
21//! let normals = gpu_context.compute_normals(&point_cloud.points, 10).await?;
22//!
23//! // Filter outliers using GPU acceleration
24//! let filtered = gpu_remove_statistical_outliers(&gpu_context, &point_cloud, 10, 1.0).await?;
25//!
26//! // Remove isolated points using radius-based filtering
27//! let filtered = gpu_radius_outlier_removal(&gpu_context, &point_cloud, 0.1, 5).await?;
28//!
29//! // Downsample using voxel grid filtering
30//! let downsampled = gpu_voxel_grid_filter(&gpu_context, &point_cloud, 0.05).await?;
31//!
32//! Ok(())
33//! }
34//! ```
35
36pub mod device;
37pub mod filtering;
38pub mod icp;
39pub mod mesh;
40pub mod nearest_neighbor;
41pub mod normals;
42pub mod renderer;
43pub mod segmentation;
44mod spatial;
45pub mod tsdf;
46pub mod utils;
47
48// Re-export commonly used items
49pub use device::GpuContext;
50pub use filtering::{
51 gpu_radius_outlier_removal, gpu_remove_statistical_outliers, gpu_voxel_grid_filter,
52};
53pub use icp::gpu_icp;
54pub use mesh::{
55 mesh_to_gpu_mesh, FlatMaterial, GpuMesh, LodMesh, MeshCameraUniform, MeshLightingParams,
56 MeshRenderConfig, MeshRenderer, MeshVertex, PbrMaterial, ShadingMode,
57};
58pub use nearest_neighbor::{
59 gpu_find_k_nearest, gpu_find_k_nearest_batch, gpu_find_radius_neighbors,
60};
61pub use normals::gpu_estimate_normals;
62pub use renderer::{
63 colored_point_cloud_to_vertices, point_cloud_to_vertices, point_cloud_to_vertices_colored,
64 CameraUniform, PointCloudRenderer, PointVertex, RenderConfig, RenderParams,
65};
66pub use segmentation::{
67 gpu_extract_clusters, gpu_extract_euclidean_clusters, gpu_segment_plane,
68 gpu_segment_plane_ransac, GpuClusterConfig, GpuClusterExtractionResult,
69 GpuEuclideanClusterConfig, GpuPlaneModel, GpuPlaneSegmentationConfig,
70 GpuPlaneSegmentationResult,
71};
72pub use tsdf::{
73 create_tsdf_volume, gpu_tsdf_extract_surface, gpu_tsdf_integrate, CameraIntrinsics, TsdfVolume,
74 TsdfVolumeGpu, TsdfVoxel,
75};
76pub use utils::*;