2023-06-29 21:24:56 +00:00
|
|
|
use crate::point::Color;
|
2023-07-01 12:34:30 +00:00
|
|
|
use nalgebra::base::Matrix3;
|
2023-07-01 12:44:51 +00:00
|
|
|
use crate::errors::{LJError,LJResult};
|
|
|
|
|
2023-06-29 21:24:56 +00:00
|
|
|
#[derive(Debug, Default)]
|
2023-06-29 20:36:00 +00:00
|
|
|
pub struct EDH {
|
2023-07-01 12:34:30 +00:00
|
|
|
pub matrix: Matrix3<f32>
|
2023-06-29 20:36:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl EDH {
|
2023-07-01 12:34:30 +00:00
|
|
|
pub fn new(vec: Vec<Vec<f32>>) -> LJResult<EDH> {
|
2023-07-01 12:44:51 +00:00
|
|
|
if vec.len() != 3 ||
|
|
|
|
vec[0].len() != 3 ||
|
|
|
|
vec[1].len() != 3 ||
|
|
|
|
vec[2].len() != 3 {
|
|
|
|
return Err(Box::new(LJError::BadEDH));
|
|
|
|
}
|
2023-07-01 12:34:30 +00:00
|
|
|
let matrix = Matrix3::new(vec[0][0], vec[0][1], vec[0][2],
|
|
|
|
vec[1][0], vec[1][1], vec[1][2],
|
|
|
|
vec[2][0], vec[2][1], vec[2][2]);
|
|
|
|
Ok(EDH { matrix })
|
|
|
|
}
|
2023-06-29 20:36:00 +00:00
|
|
|
}
|
|
|
|
|
2023-06-29 21:24:56 +00:00
|
|
|
#[derive(Debug, Default)]
|
2023-06-29 20:36:00 +00:00
|
|
|
pub struct WorldState {
|
|
|
|
pub edh: EDH,
|
|
|
|
pub resampler: Vec<f32>,
|
|
|
|
pub client_key: u8,
|
|
|
|
pub intensity: u8,
|
|
|
|
pub kpps: u32,
|
|
|
|
pub color: Color
|
|
|
|
}
|
|
|
|
|
2023-07-01 12:34:30 +00:00
|
|
|
impl WorldState {
|
2023-06-29 20:36:00 +00:00
|
|
|
|
|
|
|
}
|