feat: add Intensity Transformer
This commit is contained in:
parent
22d7d3c718
commit
2c0d5cd13f
4 changed files with 123 additions and 77 deletions
28
src/transformer/intensity.rs
Normal file
28
src/transformer/intensity.rs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
use log::debug;
|
||||
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 Intensity {
|
||||
}
|
||||
|
||||
impl Transformers for Intensity {
|
||||
fn apply(&self, point_list: &[Point], ws: &WorldState) -> Vec<Point> {
|
||||
// debug!("list helios {:?}", point_list);
|
||||
let out = point_list.iter().map(|pt| {
|
||||
Point {
|
||||
x: pt.x,
|
||||
y: pt.y,
|
||||
color: pt.color * ws.intensity
|
||||
}
|
||||
}).collect();
|
||||
debug!("list intensity {:?}", out);
|
||||
out
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue