does not build, mostly ported concentric_finder

This commit is contained in:
Henry Schimke
2023-03-11 19:06:55 -06:00
parent 520764e320
commit 80c5e57632
10 changed files with 785 additions and 35 deletions

View File

@@ -117,6 +117,22 @@ impl std::ops::Add for Point {
}
}
impl std::ops::Add<f32> for Point {
type Output = Self;
fn add(self, rhs: f32) -> Self::Output {
Self::new(self.x + rhs, self.y + rhs)
}
}
impl std::ops::Add<Point> for f32 {
type Output = Point;
fn add(self, rhs: Point) -> Self::Output {
Point::new(rhs.x + self, rhs.y + self)
}
}
impl std::ops::Mul for Point {
type Output = Self;
@@ -141,6 +157,14 @@ impl std::ops::Mul<i32> for Point {
}
}
impl std::ops::Mul<u32> for Point {
type Output = Self;
fn mul(self, rhs: u32) -> Self::Output {
Self::new(self.x * rhs as f32, self.y * rhs as f32)
}
}
impl std::ops::Mul<Point> for i32 {
type Output = Point;
@@ -165,6 +189,14 @@ impl std::ops::Div<f32> for Point {
}
}
impl std::ops::Mul<Point> for u32 {
type Output = Point;
fn mul(self, rhs: Point) -> Self::Output {
Self::Output::new(rhs.x * self as f32, rhs.y * self as f32)
}
}
impl Point {
pub fn dot(self, p: Self) -> f32 {
self.x * p.x + self.y * p.y