Remove redundant access to vector surface coords

This commit is contained in:
Hanno Braun 2022-02-20 12:39:42 +01:00
parent 8256b5574a
commit ab19d3f72a
3 changed files with 4 additions and 15 deletions

View File

@ -38,8 +38,7 @@ impl Swept {
/// Convert a vector in surface coordinates to model coordinates /// Convert a vector in surface coordinates to model coordinates
pub fn vector_surface_to_model(&self, vector: &Vector<2>) -> Vector<3> { pub fn vector_surface_to_model(&self, vector: &Vector<2>) -> Vector<3> {
self.curve.vector_curve_to_model(&vector.to_t()) self.curve.vector_curve_to_model(&vector.to_t()) + self.path * vector.v
+ self.path * vector.v()
} }
} }

View File

@ -65,12 +65,12 @@ impl Point<1> {
impl Point<2> { impl Point<2> {
/// Access the point's x coordinate /// Access the point's x coordinate
pub fn u(&self) -> Scalar { pub fn u(&self) -> Scalar {
self.coords.u() self.coords.u
} }
/// Access the point's y coordinate /// Access the point's y coordinate
pub fn v(&self) -> Scalar { pub fn v(&self) -> Scalar {
self.coords.v() self.coords.v
} }
} }

View File

@ -71,19 +71,9 @@ impl Vector<1> {
} }
impl Vector<2> { 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 /// Extend a 2-dimensional vector into a 3-dimensional one
pub fn to_xyz(&self, z: Scalar) -> Vector<3> { pub fn to_xyz(&self, z: Scalar) -> Vector<3> {
Vector::from([self.u(), self.v(), z]) Vector::from([self.u, self.v, z])
} }
} }