add homography crate, use Matrix3 to store EDH
This commit is contained in:
parent
63c700f12d
commit
5470a9b78a
@ -11,8 +11,11 @@ config = "0.13.3"
|
||||
ctrlc = "3.4.0"
|
||||
env_logger = "0.10.0"
|
||||
helios-dac = { version = "0.1", default-features = false, features = ["native"] }
|
||||
|
||||
log = "0.4.18"
|
||||
redis = "0.23.0"
|
||||
ron = "0.8.0"
|
||||
serde = { version = "1.0.163", features = ["derive"] }
|
||||
toml = "0.7.4"
|
||||
homography = { git = "https://github.com/azazdeaz/homography" }
|
||||
nalgebra = "0.32.2"
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::device::{Device, Status, PlaybackState};
|
||||
use crate::errors::{LJError, LJResult};
|
||||
use crate::errors::LJResult;
|
||||
use crate::point::Point;
|
||||
use log::debug;
|
||||
|
||||
pub struct DummyDevice {
|
||||
state: PlaybackState
|
||||
@ -27,7 +28,8 @@ impl Device for DummyDevice {
|
||||
line: Vec<Point>,
|
||||
speed: u32,
|
||||
) -> LJResult<()> {
|
||||
Ok(())
|
||||
debug!("Draw Line at speed {speed} : {:?}", line);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn stop(&mut self) -> LJResult<()> {
|
||||
|
@ -113,6 +113,7 @@ impl RedisCtrl {
|
||||
// Get new EDH
|
||||
let edh : String = self.connection.get("/EDH/0")?;
|
||||
let edh : Vec<Vec<f32>> = from_str(&edh)?;
|
||||
Ok(EDH { matrix: edh })
|
||||
let edh = EDH::new(edh)?;
|
||||
Ok(edh)
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,19 @@
|
||||
use crate::point::Color;
|
||||
|
||||
use nalgebra::base::Matrix3;
|
||||
use crate::errors::LJResult;
|
||||
#[derive(Debug, Default)]
|
||||
pub struct EDH {
|
||||
pub matrix: Vec<Vec<f32>> //Matrix3
|
||||
pub matrix: Matrix3<f32>
|
||||
}
|
||||
|
||||
|
||||
impl EDH {
|
||||
|
||||
pub fn new(vec: Vec<Vec<f32>>) -> LJResult<EDH> {
|
||||
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 })
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
@ -20,6 +26,6 @@ pub struct WorldState {
|
||||
pub color: Color
|
||||
}
|
||||
|
||||
impl WorldState{
|
||||
impl WorldState {
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user