pax_runtime_api/
math.rs

1use std::ops::Mul;
2
3use kurbo::Affine;
4
5mod point;
6mod transform;
7mod vector;
8
9pub use point::Point2;
10pub use transform::Transform2;
11pub use transform::TransformParts;
12pub use vector::Vector2;
13
14pub trait Space: 'static {}
15
16pub struct Generic;
17
18impl Space for Generic {}
19
20// TODO remove after Affine not used
21impl<W: Space> Mul<Point2<W>> for Affine {
22    type Output = Point2<W>;
23
24    #[inline]
25    fn mul(self, other: Point2<W>) -> Point2<W> {
26        let coeffs = self.as_coeffs();
27        Self::Output::new(
28            coeffs[0] * other.x + coeffs[2] * other.y + coeffs[4],
29            coeffs[1] * other.x + coeffs[3] * other.y + coeffs[5],
30        )
31    }
32}