1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::rc::Rc;

use crate::float::Float;
use crate::ray::Ray;
use crate::hit::Hit;
use crate::actor::Actor;

pub mod linear;
pub mod oct;
pub mod binary;

pub trait Tree<T>
    where T: Float
{
    fn add_actor(&mut self, actor: Rc<Actor<T>>) -> bool;

    fn get_hit(&self, ray: &Ray<T>, t_min: T, t_max: T) -> Option<(Rc<Actor<T>>, Hit<T>)>;
}

pub enum TreeType {
    Linear,
    Binary,
    Oct
}