diff --git a/src/affine.rs b/src/affine.rs index 0c19a819..0d85382d 100644 --- a/src/affine.rs +++ b/src/affine.rs @@ -156,81 +156,99 @@ impl Affine { aff.pre_translate(-point.to_vec2()) } - /// A rotation by `th` followed by `self`. + /// A [rotation] by `th` followed by `self`. /// /// Equivalent to `self * Affine::rotate(th)` + /// + /// [rotation]: Affine::rotate #[inline] #[must_use] pub fn pre_rotate(self, th: f64) -> Self { self * Affine::rotate(th) } - /// A rotation by `th` about `center` followed by `self`. + /// A [rotation] by `th` about `center` followed by `self`. + /// + /// Equivalent to `self * Affine::rotate_about(th, center)` /// - /// Equivalent to `self * Affine::rotate_about(th)` + /// [rotation]: Affine::rotate_about #[inline] #[must_use] pub fn pre_rotate_about(self, th: f64, center: Point) -> Self { Affine::rotate_about(th, center) * self } - /// A scale by `scale` followed by `self`. + /// A [scale] by `scale` followed by `self`. /// /// Equivalent to `self * Affine::scale(scale)` + /// + /// [scale]: Affine::scale #[inline] #[must_use] pub fn pre_scale(self, scale: f64) -> Self { self * Affine::scale(scale) } - /// A scale by `(scale_x, scale_y)` followed by `self`. + /// A [scale] by `(scale_x, scale_y)` followed by `self`. /// /// Equivalent to `self * Affine::scale_non_uniform(scale_x, scale_y)` + /// + /// [scale]: Affine::scale_non_uniform #[inline] #[must_use] pub fn pre_scale_non_uniform(self, scale_x: f64, scale_y: f64) -> Self { self * Affine::scale_non_uniform(scale_x, scale_y) } - /// A translation of `trans` followed by `self`. + /// A [translation] of `trans` followed by `self`. /// /// Equivalent to `self * Affine::translate(trans)` + /// + /// [translation]: Affine::translate #[inline] #[must_use] pub fn pre_translate(self, trans: Vec2) -> Self { self * Affine::translate(trans) } - /// `self` followed by a rotation of `th`. + /// `self` followed by a [rotation] of `th`. /// /// Equivalent to `Affine::rotate(th) * self` + /// + /// [rotation]: Affine::rotate #[inline] #[must_use] pub fn then_rotate(self, th: f64) -> Self { Affine::rotate(th) * self } - /// `self` followed by a rotation of `th` about `center`. + /// `self` followed by a [rotation] of `th` about `center`. /// /// Equivalent to `Affine::rotate_about(th, center) * self` + /// + /// [rotation]: Affine::rotate_about #[inline] #[must_use] pub fn then_rotate_about(self, th: f64, center: Point) -> Self { Affine::rotate_about(th, center) * self } - /// `self` followed by a scale of `scale`. + /// `self` followed by a [scale] of `scale`. /// /// Equivalent to `Affine::scale(scale) * self` + /// + /// [scale]: Affine::scale #[inline] #[must_use] pub fn then_scale(self, scale: f64) -> Self { Affine::scale(scale) * self } - /// `self` followed by a scale of `(scale_x, scale_y)`. + /// `self` followed by a [scale] of `(scale_x, scale_y)`. /// /// Equivalent to `Affine::scale_non_uniform(scale_x, scale_y) * self` + /// + /// [scale]: Affine::scale_non_uniform #[inline] #[must_use] pub fn then_scale_non_uniform(self, scale_x: f64, scale_y: f64) -> Self { @@ -240,6 +258,8 @@ impl Affine { /// `self` followed by a translation of `trans`. /// /// Equivalent to `Affine::translate(trans) * self` + /// + /// [translation]: Affine::translate #[inline] #[must_use] pub fn then_translate(mut self, trans: Vec2) -> Self { @@ -297,7 +317,9 @@ impl Affine { Rect::from_points(p00, p01).union(Rect::from_points(p10, p11)) } - /// Is this map finite? + /// Is this map [finite]? + /// + /// [finite]: f64::is_finite #[inline] pub fn is_finite(&self) -> bool { self.0[0].is_finite() @@ -308,7 +330,9 @@ impl Affine { && self.0[5].is_finite() } - /// Is this map NaN? + /// Is this map [NaN]? + /// + /// [NaN]: f64::is_nan #[inline] pub fn is_nan(&self) -> bool { self.0[0].is_nan() diff --git a/src/arc.rs b/src/arc.rs index 03e92af8..de9b4499 100644 --- a/src/arc.rs +++ b/src/arc.rs @@ -13,7 +13,7 @@ use core::{ #[cfg(not(feature = "std"))] use crate::common::FloatFuncs; -/// A single arc segment. +/// A single elliptical arc segment. #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -80,9 +80,9 @@ impl Arc { } } - /// Converts an Arc into a series of cubic bezier segments. + /// Converts an `Arc` into a series of cubic bezier segments. /// - /// Closure will be invoked for each segment. + /// The closure `p` will be invoked with the control points for each segment. pub fn to_cubic_beziers
(self, tolerance: f64, mut p: P)
where
P: FnMut(Point, Point, Point),
diff --git a/src/circle.rs b/src/circle.rs
index 73c1d97c..13b8a39a 100644
--- a/src/circle.rs
+++ b/src/circle.rs
@@ -46,13 +46,17 @@ impl Circle {
}
}
- /// Is this circle finite?
+ /// Is this circle [finite]?
+ ///
+ /// [finite]: f64::is_finite
#[inline]
pub fn is_finite(&self) -> bool {
self.center.is_finite() && self.radius.is_finite()
}
- /// Is this circle NaN?
+ /// Is this circle [NaN]?
+ ///
+ /// [NaN]: f64::is_nan
#[inline]
pub fn is_nan(&self) -> bool {
self.center.is_nan() || self.radius.is_nan()
@@ -224,7 +228,9 @@ impl CircleSegment {
}
}
- /// Is this circle segment finite?
+ /// Is this circle segment [finite]?
+ ///
+ /// [finite]: f64::is_finite
#[inline]
pub fn is_finite(&self) -> bool {
self.center.is_finite()
@@ -234,7 +240,9 @@ impl CircleSegment {
&& self.sweep_angle.is_finite()
}
- /// Is this circle segment NaN?
+ /// Is this circle segment [NaN]?
+ ///
+ /// [NaN]: f64::is_nan
#[inline]
pub fn is_nan(&self) -> bool {
self.center.is_nan()
diff --git a/src/ellipse.rs b/src/ellipse.rs
index af1c11e6..6ded7dab 100644
--- a/src/ellipse.rs
+++ b/src/ellipse.rs
@@ -145,13 +145,17 @@ impl Ellipse {
self.inner.svd()
}
- /// Is this ellipse finite?
+ /// Is this ellipse [finite]?
+ ///
+ /// [finite]: f64::is_finite
#[inline]
pub fn is_finite(&self) -> bool {
self.inner.is_finite()
}
- /// Is this ellipse NaN?
+ /// Is this ellipse [NaN]?
+ ///
+ /// [NaN]: f64::is_nan
#[inline]
pub fn is_nan(&self) -> bool {
self.inner.is_nan()
diff --git a/src/line.rs b/src/line.rs
index 92810e6e..edd4aeac 100644
--- a/src/line.rs
+++ b/src/line.rs
@@ -52,13 +52,17 @@ impl Line {
Some(other.p0 + cd * h)
}
- /// Is this line finite?
+ /// Is this line `finite`?
+ ///
+ /// [finite]: f64::is_finite
#[inline]
pub fn is_finite(self) -> bool {
self.p0.is_finite() && self.p1.is_finite()
}
- /// Is this line NaN?
+ /// Is this line `NaN`?
+ ///
+ /// [NaN]: f64::is_nan
#[inline]
pub fn is_nan(self) -> bool {
self.p0.is_nan() || self.p1.is_nan()
@@ -157,13 +161,17 @@ impl ParamCurveExtrema for Line {
pub struct ConstPoint(Point);
impl ConstPoint {
- /// Is this point finite?
+ /// Is this point [finite]?
+ ///
+ /// [finite]: f64::is_finite
#[inline]
pub fn is_finite(self) -> bool {
self.0.is_finite()
}
- /// Is this point NaN?
+ /// Is this point [NaN]?
+ ///
+ /// [NaN]: f64::is_nan
#[inline]
pub fn is_nan(self) -> bool {
self.0.is_nan()
diff --git a/src/rect.rs b/src/rect.rs
index eeeb4aa3..dfb78788 100644
--- a/src/rect.rs
+++ b/src/rect.rs
@@ -308,7 +308,7 @@ impl Rect {
}
/// Returns a new `Rect`,
- /// with each coordinate value rounded to the nearest integer.
+ /// with each coordinate value [rounded] to the nearest integer.
///
/// # Examples
///
@@ -320,6 +320,8 @@ impl Rect {
/// assert_eq!(rect.x1, 3.0);
/// assert_eq!(rect.y1, -3.0);
/// ```
+ ///
+ /// [rounded]: f64::round
#[inline]
pub fn round(self) -> Rect {
Rect::new(
@@ -331,7 +333,7 @@ impl Rect {
}
/// Returns a new `Rect`,
- /// with each coordinate value rounded up to the nearest integer,
+ /// with each coordinate value [rounded up] to the nearest integer,
/// unless they are already an integer.
///
/// # Examples
@@ -344,6 +346,8 @@ impl Rect {
/// assert_eq!(rect.x1, 3.0);
/// assert_eq!(rect.y1, -3.0);
/// ```
+ ///
+ /// [rounded up]: f64::ceil
#[inline]
pub fn ceil(self) -> Rect {
Rect::new(
@@ -355,7 +359,7 @@ impl Rect {
}
/// Returns a new `Rect`,
- /// with each coordinate value rounded down to the nearest integer,
+ /// with each coordinate value [rounded down] to the nearest integer,
/// unless they are already an integer.
///
/// # Examples
@@ -368,6 +372,8 @@ impl Rect {
/// assert_eq!(rect.x1, 3.0);
/// assert_eq!(rect.y1, -4.0);
/// ```
+ ///
+ /// [rounded down]: f64::floor
#[inline]
pub fn floor(self) -> Rect {
Rect::new(
@@ -510,7 +516,7 @@ impl Rect {
}
/// Creates a new [`RoundedRect`] from this `Rect` and the provided
- /// corner radius.
+ /// corner [radius](RoundedRectRadii).
#[inline]
pub fn to_rounded_rect(self, radii: impl Into