[][src]Trait bvh::aabb::Bounded

pub trait Bounded {
    fn aabb(&self) -> AABB;
}

A trait implemented by things which can be bounded by an AABB.

Required methods

fn aabb(&self) -> AABB

Returns the geometric bounds of this object in the form of an AABB.

Examples

use bvh::aabb::{AABB, Bounded};
use bvh::nalgebra::Point3;

struct Something;

impl Bounded for Something {
    fn aabb(&self) -> AABB {
        let point1 = Point3::new(0.0,0.0,0.0);
        let point2 = Point3::new(1.0,1.0,1.0);
        AABB::with_bounds(point1, point2)
    }
}

let something = Something;
let aabb = something.aabb();

assert!(aabb.contains(&Point3::new(0.0,0.0,0.0)));
assert!(aabb.contains(&Point3::new(1.0,1.0,1.0)));
Loading content...

Implementations on Foreign Types

impl Bounded for Point3<f32>[src]

Implementation of Bounded for Point3.

Examples

use bvh::aabb::{AABB, Bounded};
use bvh::nalgebra::Point3;

let point = Point3::new(3.0,4.0,5.0);

let aabb = point.aabb();
assert!(aabb.contains(&point));
Loading content...

Implementors

impl Bounded for AABB[src]

Implementation of Bounded for AABB.

Examples

use bvh::aabb::{AABB, Bounded};
use bvh::nalgebra::Point3;

let point_a = Point3::new(3.0,4.0,5.0);
let point_b = Point3::new(17.0,18.0,19.0);
let aabb = AABB::empty().grow(&point_a).grow(&point_b);

let aabb_aabb = aabb.aabb();

assert_eq!(aabb_aabb.min, aabb.min);
assert_eq!(aabb_aabb.max, aabb.max);
Loading content...