diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-12-02 14:48:12 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-12-02 14:48:12 +0100 |
| commit | bfa9962632dd3c2e9110f9c3667d7e3cf6b133d4 (patch) | |
| tree | c48de05a4ae1e5c97eb4f6ddc9ede32ee65cf3ef /src/geom | |
| parent | f3bdc9d3daca2c26c4cc745be48a5ce1c8a10641 (diff) | |
Remove baseline weirdness
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() |
