From 3d331fb1e4c2743a27b32c294ae4fa6fd6a96302 Mon Sep 17 00:00:00 2001 From: julia Date: Sat, 28 Sep 2024 09:16:04 +1000 Subject: [PATCH] little doc cleanup --- src/point.rs | 1 - src/triangle.rs | 18 +++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/point.rs b/src/point.rs index ca8dcd27..cd4909b4 100644 --- a/src/point.rs +++ b/src/point.rs @@ -185,7 +185,6 @@ impl Point { pub fn is_nan(self) -> bool { self.x.is_nan() || self.y.is_nan() } - } impl From<(f32, f32)> for Point { diff --git a/src/triangle.rs b/src/triangle.rs index 89d079c0..477c78d5 100644 --- a/src/triangle.rs +++ b/src/triangle.rs @@ -34,7 +34,7 @@ impl Triangle { /// The empty [`Triangle`] at the origin pub const ZERO: Self = Self::from_coords((0., 0.), (0., 0.), (0., 0.)); - /// equilateral [`Triangle`] + /// Equilateral [`Triangle`] with the x-axis unit vector as its base. pub const EQUILATERAL: Self = Self::from_coords( ( 1.0 / 2.0, @@ -118,7 +118,9 @@ impl Triangle { self.area() == 0.0 } - /// The inscribed circle of [`Triangle`] (the greatest [`Circle`] that lies within the [`Triangle`]) + /// The inscribed circle of [`Triangle`] + /// + /// This is defined as the greatest [`Circle`] that lies within the [`Triangle`] #[doc(alias = "incircle")] #[inline] pub fn inscribed_circle(&self) -> Circle { @@ -129,7 +131,9 @@ impl Triangle { Circle::new(self.circumcenter(), 2.0 * self.area() / (ab + bc + ac)) } - /// The circumscribed circle of [`Triangle`] (the smallest [`Circle`] which intercepts each vertex of the [`Triangle`]) + /// The circumscribed circle of [`Triangle`] + /// + /// This is defined as the smallest [`Circle`] which intercepts each vertex of the [`Triangle`] #[doc(alias = "circumcircle")] #[inline] pub fn circumscribed_circle(&self) -> Circle { @@ -316,17 +320,17 @@ mod tests { #[test] fn inradius() { - let test = Triangle::EQUILATERAL.inscribed_circle(); + let test = Triangle::EQUILATERAL.inscribed_circle().radius; let expected = 0.28867513459481287; - assert_approx_eq(test.radius, expected); + assert_approx_eq(test, expected); } #[test] fn circumradius() { - let test = Triangle::EQUILATERAL.circumscribed_circle(); + let test = Triangle::EQUILATERAL.circumscribed_circle().radius; let expected = 0.5773502691896258; - assert_approx_eq(test.radius, expected); + assert_approx_eq(test, expected); } }