[][src]Trait dinotree_alg::query::RayTrait

pub trait RayTrait {
    type N: NumTrait;
    type T: HasAabb<Num = Self::N>;
    fn compute_distance_to_rect(
        &self,
        ray: &Ray<Self::N>,
        a: &Rect<Self::N>
    ) -> RayIntersectResult<Self::N>; fn compute_distance_to_bot(
        &self,
        ray: &Ray<Self::N>,
        a: &Self::T
    ) -> RayIntersectResult<Self::N> { ... } }

This is the trait that defines raycast specific geometric functions that are needed by this raytracing algorithm. By containing all these functions in this trait, we can keep the trait bounds of the underlying NumTrait to a minimum of only needing Ord.

Associated Types

type N: NumTrait

type T: HasAabb<Num = Self::N>

Loading content...

Required methods

fn compute_distance_to_rect(
    &self,
    ray: &Ray<Self::N>,
    a: &Rect<Self::N>
) -> RayIntersectResult<Self::N>

Returns true if the ray intersects with this rectangle. This function allows as to prune which nodes to visit.

Loading content...

Provided methods

fn compute_distance_to_bot(
    &self,
    ray: &Ray<Self::N>,
    a: &Self::T
) -> RayIntersectResult<Self::N>

Returns the length of ray between its origin, and where it intersects the line provided. Returns none if the ray doesnt intersect it. We use this to further prune nodes.If the closest possible distance of a bot in a particular node is bigger than what we've already seen, then we dont need to visit that node. The expensive collision detection This is where the user can do expensive collision detection on the shape contains within it's bounding box. Its default implementation just calls compute_distance_to_rect()

Loading content...

Implementors

Loading content...