diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-06-09 14:05:57 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-06-09 22:44:40 +0200 |
| commit | bce553a991f19b2b5bb9efef6b74bd12e15a10c6 (patch) | |
| tree | fa8ed4b3974927b30e6cffd0d71d4c3e980698de /src/geom/point.rs | |
| parent | 29cfef0a6dfef5820bda339d327638e285aaf4d3 (diff) | |
Tidy up
Diffstat (limited to 'src/geom/point.rs')
| -rw-r--r-- | src/geom/point.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/geom/point.rs b/src/geom/point.rs index babbdfef..8982dcea 100644 --- a/src/geom/point.rs +++ b/src/geom/point.rs @@ -26,6 +26,14 @@ impl Point { pub fn splat(value: Length) -> Self { Self { x: value, y: value } } + + /// Convert to the generic representation. + pub fn to_gen(self, main: SpecAxis) -> Gen<Length> { + match main { + SpecAxis::Horizontal => Gen::new(self.y, self.x), + SpecAxis::Vertical => Gen::new(self.x, self.y), + } + } } impl Get<SpecAxis> for Point { @@ -46,17 +54,6 @@ impl Get<SpecAxis> for Point { } } -impl Switch for Point { - type Other = Gen<Length>; - - fn switch(self, main: SpecAxis) -> Self::Other { - match main { - SpecAxis::Horizontal => Gen::new(self.y, self.x), - SpecAxis::Vertical => Gen::new(self.x, self.y), - } - } -} - impl Debug for Point { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "Point({:?}, {:?})", self.x, self.y) |
