diff --git a/src/conf.rs b/src/conf.rs index 2996c7d..4ddf686 100644 --- a/src/conf.rs +++ b/src/conf.rs @@ -48,7 +48,9 @@ pub enum TransformConf { #[serde(rename = "grid")] Grid(transformer::Grid), #[serde(rename = "homography")] - Homography(transformer::Homography) + Homography(transformer::Homography), + #[serde(rename = "helios_to_etherdream")] + HeliosToEtherdream(transformer::HeliosToEtherdream), } @@ -73,6 +75,7 @@ impl Conf { TransformConf::FlipV(r) => Box::new(*r), TransformConf::Grid(r) => Box::new(*r), TransformConf::Homography(r) => Box::new(*r), + TransformConf::HeliosToEtherdream(r) => Box::new(*r), }; v.push(t); } diff --git a/src/transformer.rs b/src/transformer.rs index aa25291..2b9465f 100644 --- a/src/transformer.rs +++ b/src/transformer.rs @@ -6,6 +6,7 @@ mod flip_horizontal; mod flip_vertical; mod grid; mod homography; +mod helios_to_etherdream; use crate::point::Point; use crate::worldstate::WorldState; @@ -18,6 +19,7 @@ pub use flip_horizontal::FlipHorizontal; pub use flip_vertical::FlipVertical; pub use grid::Grid; pub use self::homography::Homography; +pub use helios_to_etherdream::HeliosToEtherdream; pub trait Transformers { fn apply( diff --git a/src/transformer/helios_to_etherdream.rs b/src/transformer/helios_to_etherdream.rs new file mode 100644 index 0000000..1891d5d --- /dev/null +++ b/src/transformer/helios_to_etherdream.rs @@ -0,0 +1,27 @@ +use crate::transformer::Transformers; +use crate::point::Point; +use crate::worldstate::WorldState; + +use serde::{Serialize, Deserialize}; + +/// Converts helios Geometry to Helios +#[allow(dead_code)] +#[derive(Serialize, Deserialize, Debug, Clone, Copy)] +pub struct HeliosToEtherdream { +} + +impl Transformers for HeliosToEtherdream { + fn apply(&self, point_list: &[Point], _ws: &WorldState) -> Vec { + // debug!("list helios {:?}", point_list); + let out = point_list.iter().map(|pt| { + Point { + x: 8.0 * (pt.x - 2047.0), + y: 8.0 * (pt.y - 2047.0), + ..*pt + } + }).collect(); + // debug!("list etherdream {:?}", out); + out + } +} +