From 0a50704caa9de88b2238fd5e2efdd2c1033176f6 Mon Sep 17 00:00:00 2001 From: Nicole Date: Mon, 28 Oct 2024 18:14:18 -0300 Subject: [PATCH] addition between referenced and non-referenced values --- math/src/circle/point.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/math/src/circle/point.rs b/math/src/circle/point.rs index e4fc6000f..e512eb9e3 100644 --- a/math/src/circle/point.rs +++ b/math/src/circle/point.rs @@ -78,6 +78,24 @@ impl> Add for &CirclePoint { CirclePoint { x, y } } } +impl> Add> for CirclePoint { + type Output = CirclePoint; + fn add(self, rhs: CirclePoint) -> Self::Output { + &self + &rhs + } +} +impl> Add> for &CirclePoint { + type Output = CirclePoint; + fn add(self, rhs: CirclePoint) -> Self::Output { + self + &rhs + } +} +impl> Add<&CirclePoint> for CirclePoint { + type Output = CirclePoint; + fn add(self, rhs: &CirclePoint) -> Self::Output { + &self + rhs + } +} /// Multiplication between a point and a scalar (i.e. group operation repeatedly): /// (x, y) * n = (x ,y) + ... + (x, y) n-times.