Skip to main content

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;
44pub mod tsdf;
45pub mod utils;
46
47// Re-export commonly used items
48pub use device::GpuContext;
49pub use filtering::{
50    gpu_radius_outlier_removal, gpu_remove_statistical_outliers, gpu_voxel_grid_filter,
51};
52pub use icp::gpu_icp;
53pub use mesh::{
54    mesh_to_gpu_mesh, FlatMaterial, GpuMesh, LodMesh, MeshCameraUniform, MeshLightingParams,
55    MeshRenderConfig, MeshRenderer, MeshVertex, PbrMaterial, ShadingMode,
56};
57pub use nearest_neighbor::{
58    gpu_find_k_nearest, gpu_find_k_nearest_batch, gpu_find_radius_neighbors,
59};
60pub use normals::gpu_estimate_normals;
61pub use renderer::{
62    colored_point_cloud_to_vertices, point_cloud_to_vertices, point_cloud_to_vertices_colored,
63    CameraUniform, PointCloudRenderer, PointVertex, RenderConfig, RenderParams,
64};
65pub use segmentation::{
66    gpu_extract_clusters, gpu_extract_euclidean_clusters, gpu_segment_plane,
67    gpu_segment_plane_ransac, GpuClusterConfig, GpuClusterExtractionResult,
68    GpuEuclideanClusterConfig, GpuPlaneModel, GpuPlaneSegmentationConfig,
69    GpuPlaneSegmentationResult,
70};
71pub use tsdf::{
72    create_tsdf_volume, gpu_tsdf_extract_surface, gpu_tsdf_integrate, CameraIntrinsics, TsdfVolume,
73    TsdfVolumeGpu, TsdfVoxel,
74};
75pub use utils::*;