2024-08-30 20:07:56 +00:00
|
|
|
use crate::{Vector2,Vector3,Matrix3};
|
2024-08-28 20:36:17 +00:00
|
|
|
|
|
|
|
type Planar64=fixed_wide::types::I32F32;
|
2024-08-30 19:52:54 +00:00
|
|
|
type Planar64Wide1=fixed_wide::types::I64F64;
|
2024-08-28 20:36:17 +00:00
|
|
|
//type Planar64Wide2=fixed_wide::types::I128F128;
|
|
|
|
type Planar64Wide3=fixed_wide::types::I256F256;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn wide_vec3(){
|
|
|
|
let v=Vector3::from_value(Planar64::from(3));
|
2024-09-03 00:41:54 +00:00
|
|
|
let v1=v.wide_mul_1_1(v);
|
|
|
|
let v2=v1.wide_mul_2_2(v1);
|
|
|
|
let v3=v2.wide_mul_4_4(v2);
|
2024-08-28 20:36:17 +00:00
|
|
|
|
|
|
|
assert_eq!(v3,Vector3::from_value(Planar64Wide3::from(3i128.pow(8))));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn wide_vec3_dot(){
|
|
|
|
let v=Vector3::from_value(Planar64::from(3));
|
2024-09-03 00:41:54 +00:00
|
|
|
let v1=v.wide_mul_1_1(v);
|
|
|
|
let v2=v1.wide_mul_2_2(v1);
|
|
|
|
let v3=v2.wide_dot_4_4(v2);
|
2024-08-28 20:36:17 +00:00
|
|
|
|
|
|
|
assert_eq!(v3,Planar64Wide3::from(3i128.pow(8)*3));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn wide_vec3_length_squared(){
|
|
|
|
let v=Vector3::from_value(Planar64::from(3));
|
2024-09-03 00:41:54 +00:00
|
|
|
let v1=v.wide_mul_1_1(v);
|
|
|
|
let v2=v1.wide_mul_2_2(v1);
|
2024-08-28 20:36:17 +00:00
|
|
|
let v3=v2.wide_length_squared();
|
|
|
|
|
|
|
|
assert_eq!(v3,Planar64Wide3::from(3i128.pow(8)*3));
|
|
|
|
}
|
2024-08-30 19:52:54 +00:00
|
|
|
|
2024-08-30 20:07:56 +00:00
|
|
|
#[test]
|
|
|
|
fn wide_matrix_dot(){
|
|
|
|
let m=Matrix3::<Vector3<_>>::from_value_2d(Planar64::from(3));
|
2024-08-30 19:52:54 +00:00
|
|
|
//normal matrix product
|
2024-08-30 20:25:27 +00:00
|
|
|
todo!()
|
2024-09-03 00:41:54 +00:00
|
|
|
//let m_dot=m.wide_dot_1_1(m);
|
2024-08-30 20:25:27 +00:00
|
|
|
//assert_eq!(m_dot,Matrix3::<Vector3<_>>::from_value_2d(Planar64Wide1::from(3i128.pow(2))));
|
2024-08-30 19:52:54 +00:00
|
|
|
}
|