From ab19d3f72a1b7aad7c4ba46ec79089cf363d2864 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Sun, 20 Feb 2022 12:39:42 +0100 Subject: [PATCH] Remove redundant access to vector surface coords --- src/kernel/geometry/surfaces/swept.rs | 3 +-- src/math/point.rs | 4 ++-- src/math/vector.rs | 12 +----------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/kernel/geometry/surfaces/swept.rs b/src/kernel/geometry/surfaces/swept.rs index c37721ecb..d85bdea6f 100644 --- a/src/kernel/geometry/surfaces/swept.rs +++ b/src/kernel/geometry/surfaces/swept.rs @@ -38,8 +38,7 @@ impl Swept { /// Convert a vector in surface coordinates to model coordinates pub fn vector_surface_to_model(&self, vector: &Vector<2>) -> Vector<3> { - self.curve.vector_curve_to_model(&vector.to_t()) - + self.path * vector.v() + self.curve.vector_curve_to_model(&vector.to_t()) + self.path * vector.v } } diff --git a/src/math/point.rs b/src/math/point.rs index 6dac297e4..3a3099806 100644 --- a/src/math/point.rs +++ b/src/math/point.rs @@ -65,12 +65,12 @@ impl Point<1> { impl Point<2> { /// Access the point's x coordinate pub fn u(&self) -> Scalar { - self.coords.u() + self.coords.u } /// Access the point's y coordinate pub fn v(&self) -> Scalar { - self.coords.v() + self.coords.v } } diff --git a/src/math/vector.rs b/src/math/vector.rs index de42c4f0b..cef23dda8 100644 --- a/src/math/vector.rs +++ b/src/math/vector.rs @@ -71,19 +71,9 @@ impl Vector<1> { } impl Vector<2> { - /// Access the surface vector's u coordinate - pub fn u(&self) -> Scalar { - self.0[0] - } - - /// Access the surface vector's v coordinate - pub fn v(&self) -> Scalar { - self.0[1] - } - /// Extend a 2-dimensional vector into a 3-dimensional one pub fn to_xyz(&self, z: Scalar) -> Vector<3> { - Vector::from([self.u(), self.v(), z]) + Vector::from([self.u, self.v, z]) } }