mirror of https://github.com/hannobraun/Fornjot
Merge pull request #228 from hannobraun/vertex
Fix method being too broadly available
This commit is contained in:
commit
68a6762d1b
|
@ -69,6 +69,23 @@ impl Vertex<3> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Vertex<1> {
|
||||||
|
/// Create a transformed vertex
|
||||||
|
///
|
||||||
|
/// This is a 3D transformation that transforms the canonical form of the
|
||||||
|
/// vertex, but leaves the location untouched. Since `self` is a
|
||||||
|
/// 1-dimensional vertex, transforming the location is not possible.
|
||||||
|
///
|
||||||
|
/// And, presumably, also not necessary, as this is likely part of a larger
|
||||||
|
/// transformation that also transforms the curve the vertex is on. Making
|
||||||
|
/// sure this is the case, is the responsibility of the caller.
|
||||||
|
#[must_use]
|
||||||
|
pub fn transform(mut self, transform: &Transform) -> Self {
|
||||||
|
self.canonical = transform.transform_point(&self.canonical);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<const D: usize> Vertex<D> {
|
impl<const D: usize> Vertex<D> {
|
||||||
/// Access the location of this vertex
|
/// Access the location of this vertex
|
||||||
pub fn location(&self) -> &Point<D> {
|
pub fn location(&self) -> &Point<D> {
|
||||||
|
@ -82,14 +99,4 @@ impl<const D: usize> Vertex<D> {
|
||||||
canonical: self.canonical,
|
canonical: self.canonical,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a transformed vertex
|
|
||||||
///
|
|
||||||
/// The transformed vertex has its canonical form transformed by the
|
|
||||||
/// transformation provided, but is otherwise identical.
|
|
||||||
#[must_use]
|
|
||||||
pub fn transform(mut self, transform: &Transform) -> Self {
|
|
||||||
self.canonical = transform.transform_point(&self.canonical);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue