28 lines
618 B
Rust
28 lines
618 B
Rust
use crate::point::Point;
|
|
use crate::transformer::Transformers;
|
|
use crate::worldstate::WorldState;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// Flip Vertical
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
|
|
pub struct FlipVertical {
|
|
y: f32,
|
|
}
|
|
|
|
impl Transformers for FlipVertical {
|
|
fn apply(&self, point_list: &[Point], _ws: &WorldState) -> Vec<Point> {
|
|
point_list
|
|
.iter()
|
|
.map(|pt| {
|
|
let dy = pt.y - self.y;
|
|
Point {
|
|
y: dy - 2. * dy,
|
|
..*pt
|
|
}
|
|
})
|
|
.collect()
|
|
}
|
|
}
|