delete unused aabb face code
This commit is contained in:
parent
a53d90f74b
commit
dc46cb3d45
46
src/aabb.rs
46
src/aabb.rs
@ -1,14 +1,5 @@
|
|||||||
use crate::integer::Planar64Vec3;
|
use crate::integer::Planar64Vec3;
|
||||||
|
|
||||||
#[derive(Debug,Clone,Copy,Hash,Eq,PartialEq)]
|
|
||||||
pub enum AabbFace{
|
|
||||||
Right,//+X
|
|
||||||
Top,
|
|
||||||
Back,
|
|
||||||
Left,
|
|
||||||
Bottom,
|
|
||||||
Front,
|
|
||||||
}
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Aabb{
|
pub struct Aabb{
|
||||||
pub min:Planar64Vec3,
|
pub min:Planar64Vec3,
|
||||||
@ -22,17 +13,6 @@ impl Default for Aabb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Aabb{
|
impl Aabb{
|
||||||
const VERTEX_DATA:[Planar64Vec3;8]=[
|
|
||||||
Planar64Vec3::int( 1,-1,-1),
|
|
||||||
Planar64Vec3::int( 1, 1,-1),
|
|
||||||
Planar64Vec3::int( 1, 1, 1),
|
|
||||||
Planar64Vec3::int( 1,-1, 1),
|
|
||||||
Planar64Vec3::int(-1,-1, 1),
|
|
||||||
Planar64Vec3::int(-1, 1, 1),
|
|
||||||
Planar64Vec3::int(-1, 1,-1),
|
|
||||||
Planar64Vec3::int(-1,-1,-1),
|
|
||||||
];
|
|
||||||
|
|
||||||
pub fn grow(&mut self,point:Planar64Vec3){
|
pub fn grow(&mut self,point:Planar64Vec3){
|
||||||
self.min=self.min.min(point);
|
self.min=self.min.min(point);
|
||||||
self.max=self.max.max(point);
|
self.max=self.max.max(point);
|
||||||
@ -48,32 +28,6 @@ impl Aabb{
|
|||||||
pub fn intersects(&self,aabb:&Aabb)->bool{
|
pub fn intersects(&self,aabb:&Aabb)->bool{
|
||||||
(self.min.cmplt(aabb.max)&aabb.min.cmplt(self.max)).all()
|
(self.min.cmplt(aabb.max)&aabb.min.cmplt(self.max)).all()
|
||||||
}
|
}
|
||||||
pub fn normal(face:AabbFace)->Planar64Vec3{
|
|
||||||
match face {
|
|
||||||
AabbFace::Right=>Planar64Vec3::int(1,0,0),
|
|
||||||
AabbFace::Top=>Planar64Vec3::int(0,1,0),
|
|
||||||
AabbFace::Back=>Planar64Vec3::int(0,0,1),
|
|
||||||
AabbFace::Left=>Planar64Vec3::int(-1,0,0),
|
|
||||||
AabbFace::Bottom=>Planar64Vec3::int(0,-1,0),
|
|
||||||
AabbFace::Front=>Planar64Vec3::int(0,0,-1),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub fn unit_vertices()->[Planar64Vec3;8] {
|
|
||||||
return Self::VERTEX_DATA;
|
|
||||||
}
|
|
||||||
// pub fn face(&self,face:AabbFace)->Aabb {
|
|
||||||
// let mut aabb=self.clone();
|
|
||||||
// //in this implementation face = worldspace aabb face
|
|
||||||
// match face {
|
|
||||||
// AabbFace::Right => aabb.min.x=aabb.max.x,
|
|
||||||
// AabbFace::Top => aabb.min.y=aabb.max.y,
|
|
||||||
// AabbFace::Back => aabb.min.z=aabb.max.z,
|
|
||||||
// AabbFace::Left => aabb.max.x=aabb.min.x,
|
|
||||||
// AabbFace::Bottom => aabb.max.y=aabb.min.y,
|
|
||||||
// AabbFace::Front => aabb.max.z=aabb.min.z,
|
|
||||||
// }
|
|
||||||
// return aabb;
|
|
||||||
// }
|
|
||||||
pub fn center(&self)->Planar64Vec3{
|
pub fn center(&self)->Planar64Vec3{
|
||||||
return self.min.midpoint(self.max)
|
return self.min.midpoint(self.max)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user