Skip to content

Commit 10b63d9

Browse files
committed
Impl Neg for Point now that it has Mul too
1 parent 520951a commit 10b63d9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

core/src/math/point.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use core::{
22
array,
33
fmt::{Debug, Formatter},
44
marker::PhantomData as Pd,
5-
ops::{Add, Div, Index, IndexMut, Mul, Sub},
5+
ops::{Add, Div, Index, IndexMut, Mul, Neg, Sub},
66
ops::{AddAssign, DivAssign, MulAssign, SubAssign},
77
};
88

@@ -407,6 +407,17 @@ where
407407
}
408408
}
409409

410+
impl<R, Sp> Neg for Point<R, Sp>
411+
where
412+
Self: Mul<f32, Output = Self>,
413+
{
414+
type Output = Self;
415+
416+
fn neg(self) -> Self {
417+
self * -1.0
418+
}
419+
}
420+
410421
impl<R: Copy, Sp, Sc> Mul<Sc> for Point<R, Sp>
411422
where
412423
Self: Affine<Diff = Vector<R, Sp>>,

0 commit comments

Comments
 (0)