From 37f0b123e08d3f4e74b4e6e2067f1562ae98d093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sun, 8 Sep 2013 18:00:28 +0200 Subject: [PATCH] Make the dot-product and normalization related methods public for DVec. This will change soon with two traits: Dot and Norm. --- src/dvec.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/dvec.rs b/src/dvec.rs index 7931543d..bbfe1ed1 100644 --- a/src/dvec.rs +++ b/src/dvec.rs @@ -175,8 +175,9 @@ impl> Neg> for DVec { } impl DVec { + /// Will change soon. #[inline] - fn dot(&self, other: &DVec) -> N { + pub fn dot(&self, other: &DVec) -> N { assert!(self.at.len() == other.at.len()); let mut res: N = Zero::zero(); @@ -188,8 +189,9 @@ impl DVec { res } + /// Will change soon. #[inline] - fn sub_dot(&self, a: &DVec, b: &DVec) -> N { + pub fn sub_dot(&self, a: &DVec, b: &DVec) -> N { let mut res: N = Zero::zero(); for i in range(0u, self.at.len()) { @@ -271,18 +273,21 @@ impl + Neg + Clone> Translation> for DVec { } impl DVec { + /// Will change soon. #[inline] - fn sqnorm(&self) -> N { + pub fn sqnorm(&self) -> N { self.dot(self) } + /// Will change soon. #[inline] - fn norm(&self) -> N { + pub fn norm(&self) -> N { self.sqnorm().sqrt() } + /// Will change soon. #[inline] - fn normalized(&self) -> DVec { + pub fn normalized(&self) -> DVec { let mut res : DVec = self.clone(); res.normalize(); @@ -290,8 +295,9 @@ impl DVec { res } + /// Will change soon. #[inline] - fn normalize(&mut self) -> N { + pub fn normalize(&mut self) -> N { let l = self.norm(); for i in range(0u, self.at.len()) {