From ed6696be3ee504835a9a36f86d299f07af81d1bb Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 29 Nov 2023 19:11:23 -0800 Subject: [PATCH] Aabb::size() + proper private fields for aabb --- src/aabb.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/aabb.rs b/src/aabb.rs index 4e4d0df..65e783f 100644 --- a/src/aabb.rs +++ b/src/aabb.rs @@ -2,8 +2,8 @@ use crate::integer::Planar64Vec3; #[derive(Clone)] pub struct Aabb{ - pub min:Planar64Vec3, - pub max:Planar64Vec3, + min:Planar64Vec3, + max:Planar64Vec3, } impl Default for Aabb { @@ -28,8 +28,11 @@ impl Aabb{ pub fn intersects(&self,aabb:&Aabb)->bool{ (self.min.cmplt(aabb.max)&aabb.min.cmplt(self.max)).all() } + pub fn size(&self)->Planar64Vec3{ + self.max-self.min + } pub fn center(&self)->Planar64Vec3{ - return self.min.midpoint(self.max) + self.min.midpoint(self.max) } //probably use floats for area & volume because we don't care about precision // pub fn area_weight(&self)->f32{