feat: add helios to etherdream transformer
This commit is contained in:
parent
ff96bdf6fa
commit
3ce346306f
@ -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);
|
||||
}
|
||||
|
@ -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(
|
||||
|
27
src/transformer/helios_to_etherdream.rs
Normal file
27
src/transformer/helios_to_etherdream.rs
Normal file
@ -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<Point> {
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user