dedicated affine type means less math
This commit is contained in:
parent
aae9ba5e80
commit
1a5a48d303
@ -440,9 +440,9 @@ impl TryFrom<[f32;3]> for Unit32Vec3{
|
||||
pub type Planar64=fixed_wide::types::I32F32;
|
||||
pub type Planar64Vec3=linear_ops::types::Vector3<Planar64>;
|
||||
pub type Planar64Mat3=linear_ops::types::Matrix3<Planar64>;
|
||||
pub type Planar64Affine3=linear_ops::types::Matrix4x3<Planar64>;
|
||||
pub mod vec3{
|
||||
use super::*;
|
||||
pub use linear_ops::types::Vector3;
|
||||
pub const ZERO:Planar64Vec3=Planar64Vec3::new([Planar64::ZERO;3]);
|
||||
pub const ZERO_2:linear_ops::types::Vector3<Fixed::<2,64>>=linear_ops::types::Vector3::new([Fixed::<2,64>::ZERO;3]);
|
||||
pub const X:Planar64Vec3=Planar64Vec3::new([Planar64::ONE,Planar64::ZERO,Planar64::ZERO]);
|
||||
@ -464,6 +464,7 @@ pub fn int(value:i32)->Planar64{
|
||||
}
|
||||
pub mod mat3{
|
||||
use super::*;
|
||||
pub use linear_ops::types::Matrix3;
|
||||
pub fn from_diagonal(diag:Planar64Vec3)->Planar64Mat3{
|
||||
Planar64Mat3::new([
|
||||
[diag.x,Planar64::ZERO,Planar64::ZERO],
|
||||
@ -479,6 +480,22 @@ pub mod mat3{
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone,Copy,Default,Hash,Eq,PartialEq)]
|
||||
pub struct Planar64Affine3{
|
||||
pub matrix3:Planar64Mat3,//includes scale above 1
|
||||
pub translation:Planar64Vec3,
|
||||
}
|
||||
impl Planar64Affine3{
|
||||
#[inline]
|
||||
pub const fn new(matrix3:Planar64Mat3,translation:Planar64Vec3)->Self{
|
||||
Self{matrix3,translation}
|
||||
}
|
||||
#[inline]
|
||||
pub fn transform_point3(&self,point:Planar64Vec3)->vec3::Vector3<Fixed<2,64>>{
|
||||
self.translation.fix_2()+self.matrix3*point
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sqrt(){
|
||||
let r=int(400);
|
||||
|
Loading…
Reference in New Issue
Block a user