diff options
Diffstat (limited to 'src/geom')
| -rw-r--r-- | src/geom/point.rs | 9 | ||||
| -rw-r--r-- | src/geom/spec.rs | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/geom/point.rs b/src/geom/point.rs index 30e3f9b6..ab8f4439 100644 --- a/src/geom/point.rs +++ b/src/geom/point.rs @@ -35,12 +35,9 @@ impl Point { Self { x: Length::zero(), y } } - /// Convert to the generic representation. - pub const 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), - } + /// Whether both components are zero. + pub fn is_zero(self) -> bool { + self.x.is_zero() && self.y.is_zero() } /// Transform the point with the given transformation. diff --git a/src/geom/spec.rs b/src/geom/spec.rs index 5d89c894..40d7386b 100644 --- a/src/geom/spec.rs +++ b/src/geom/spec.rs @@ -193,6 +193,11 @@ impl Size { self.x.fits(other.x) && self.y.fits(other.y) } + /// Whether both components are zero. + pub fn is_zero(self) -> bool { + self.x.is_zero() && self.y.is_zero() + } + /// Whether both components are finite. pub fn is_finite(self) -> bool { self.x.is_finite() && self.y.is_finite() |
