Skip to main content

ShapeQuery

Trait ShapeQuery 

Source
pub trait ShapeQuery {
    // Required methods
    fn ray_cast(
        &self,
        ray_origin: [f64; 3],
        ray_dir: [f64; 3],
        max_toi: f64,
    ) -> Option<RayCastResult>;
    fn point_query(&self, point: [f64; 3]) -> PointQueryResult;
    fn aabb(&self) -> ([f64; 3], [f64; 3]);
}
Expand description

Common shape query interface.

Required Methods§

Source

fn ray_cast( &self, ray_origin: [f64; 3], ray_dir: [f64; 3], max_toi: f64, ) -> Option<RayCastResult>

Cast a ray from ray_origin in direction ray_dir (need not be normalised) up to parameter max_toi. Returns None when there is no hit.

Source

fn point_query(&self, point: [f64; 3]) -> PointQueryResult

Find the closest point on the shape to point and return it together with the signed distance and an inside flag.

Source

fn aabb(&self) -> ([f64; 3], [f64; 3])

Axis-aligned bounding box as (min, max) corner pair.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§