diff options
| author | Crozet Sébastien <developer@crozet.re> | 2020-10-20 11:55:33 +0200 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2020-10-20 11:56:09 +0200 |
| commit | 865ce8a8e5301b23ca474adaaffe8b43e725803e (patch) | |
| tree | 67b57d0c63d11a6d5e4a23c6f1242f72efc721b9 /src/geometry/trimesh.rs | |
| parent | 947c4813c9666fd8215743de298fe17780fa3ef2 (diff) | |
| download | rapier-865ce8a8e5301b23ca474adaaffe8b43e725803e.tar.gz rapier-865ce8a8e5301b23ca474adaaffe8b43e725803e.tar.bz2 rapier-865ce8a8e5301b23ca474adaaffe8b43e725803e.zip | |
Collider shape: use a trait-object instead of an enum.
Diffstat (limited to 'src/geometry/trimesh.rs')
| -rw-r--r-- | src/geometry/trimesh.rs | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/src/geometry/trimesh.rs b/src/geometry/trimesh.rs index b6e23e7..38ce0a3 100644 --- a/src/geometry/trimesh.rs +++ b/src/geometry/trimesh.rs @@ -1,13 +1,9 @@ -use crate::geometry::{Triangle, WQuadtree}; +use crate::geometry::{PointProjection, Ray, RayIntersection, Triangle, WQuadtree}; use crate::math::{Isometry, Point}; use na::Point3; use ncollide::bounding_volume::{HasBoundingVolume, AABB}; - -#[cfg(feature = "dim3")] -use { - crate::geometry::{Ray, RayIntersection}, - ncollide::query::RayCast, -}; +use ncollide::query::{PointQuery, RayCast}; +use ncollide::shape::FeatureId; #[derive(Clone)] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] @@ -110,6 +106,41 @@ impl Trimesh { } } +impl PointQuery<f32> for Trimesh { + fn project_point(&self, m: &Isometry<f32>, pt: &Point<f32>, solid: bool) -> PointProjection { + // TODO + unimplemented!() + } + + fn project_point_with_feature( + &self, + m: &Isometry<f32>, + pt: &Point<f32>, + ) -> (PointProjection, FeatureId) { + // TODO + unimplemented!() + } +} + +#[cfg(feature = "dim2")] +impl RayCast<f32> for Trimesh { + fn toi_and_normal_with_ray( + &self, + m: &Isometry<f32>, + ray: &Ray, + max_toi: f32, + solid: bool, + ) -> Option<RayIntersection> { + // TODO + None + } + + fn intersects_ray(&self, m: &Isometry<f32>, ray: &Ray, max_toi: f32) -> bool { + // TODO + false + } +} + #[cfg(feature = "dim3")] impl RayCast<f32> for Trimesh { fn toi_and_normal_with_ray( |
