define more functions

This commit is contained in:
Quaternions 2024-09-12 12:16:19 -07:00
parent b9f280f94b
commit aae9ba5e80
2 changed files with 24 additions and 5 deletions

View File

@ -1,6 +1,6 @@
const VALVE_SCALE:Planar64=Planar64::raw(1<<28);// 1/16 const VALVE_SCALE:Planar64=Planar64::raw(1<<28);// 1/16
use crate::integer::{int,int3,Time,Ratio64,Planar64,Planar64Vec3}; use crate::integer::{int,vec3::int as int3,Time,Ratio64,Planar64,Planar64Vec3};
use crate::controls_bitflag::Controls; use crate::controls_bitflag::Controls;
#[derive(Clone,Debug)] #[derive(Clone,Debug)]

View File

@ -1,5 +1,5 @@
use fixed_wide::fixed::Fixed; pub use fixed_wide::fixed::Fixed;
use ratio_ops::ratio::Ratio; pub use ratio_ops::ratio::Ratio;
//integer units //integer units
#[derive(Clone,Copy,Hash,Eq,PartialEq,PartialOrd,Debug)] #[derive(Clone,Copy,Hash,Eq,PartialEq,PartialOrd,Debug)]
@ -451,13 +451,32 @@ pub mod vec3{
pub const NEG_X:Planar64Vec3=Planar64Vec3::new([Planar64::NEG_ONE,Planar64::ZERO,Planar64::ZERO]); pub const NEG_X:Planar64Vec3=Planar64Vec3::new([Planar64::NEG_ONE,Planar64::ZERO,Planar64::ZERO]);
pub const NEG_Y:Planar64Vec3=Planar64Vec3::new([Planar64::ZERO,Planar64::NEG_ONE,Planar64::ZERO]); pub const NEG_Y:Planar64Vec3=Planar64Vec3::new([Planar64::ZERO,Planar64::NEG_ONE,Planar64::ZERO]);
pub const NEG_Z:Planar64Vec3=Planar64Vec3::new([Planar64::ZERO,Planar64::ZERO,Planar64::NEG_ONE]); pub const NEG_Z:Planar64Vec3=Planar64Vec3::new([Planar64::ZERO,Planar64::ZERO,Planar64::NEG_ONE]);
pub fn int(x:i32,y:i32,z:i32)->Planar64Vec3{
Planar64Vec3::new([Planar64::from(x),Planar64::from(y),Planar64::from(z)])
}
pub fn raw_xyz(x:i64,y:i64,z:i64)->Planar64Vec3{
Planar64Vec3::new([Planar64::raw(x),Planar64::raw(y),Planar64::raw(z)])
}
} }
pub fn int(value:i32)->Planar64{ pub fn int(value:i32)->Planar64{
Planar64::from(value) Planar64::from(value)
} }
pub fn int3(x:i32,y:i32,z:i32)->Planar64Vec3{ pub mod mat3{
Planar64Vec3::new([Planar64::from(x),Planar64::from(y),Planar64::from(z)]) use super::*;
pub fn from_diagonal(diag:Planar64Vec3)->Planar64Mat3{
Planar64Mat3::new([
[diag.x,Planar64::ZERO,Planar64::ZERO],
[Planar64::ZERO,diag.y,Planar64::ZERO],
[Planar64::ZERO,Planar64::ZERO,diag.z],
])
}
pub fn from_rotation_yx(x:Angle32,y:Angle32)->Planar64Mat3{
todo!()
}
pub fn from_rotation_y(y:Angle32)->Planar64Mat3{
todo!()
}
} }
#[test] #[test]