Skip to content

Commit

Permalink
Fix doc errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
spectria-limina committed Feb 7, 2024
1 parent 0a55cce commit 843275b
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions crates/bevy_math/src/primitives/dim2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,11 @@ impl Circle {
///
/// An arc has no area.
/// If you want to include the portion of a circle's area swept out by the arc,
/// use [CircularSector].
/// use [`CircularSector`].
/// If you want to include only the space inside the convex hull of the arc,
/// use [`CircularSegment`].
///
/// The arc is drawn starting from [Vec2::X], going counterclockwise.
/// The arc is drawn starting from [`Vec2::X`], going counterclockwise.
/// To orient the arc differently, apply a rotation.
/// The arc is drawn with the center of its circle at the origin (0, 0),
/// meaning that the center may not be inside its convex hull.
Expand All @@ -197,7 +199,7 @@ pub struct Arc {
impl Primitive2d for Arc {}

impl Default for Arc {
// Returns the default [`Arc`] with radius `0.5` and angle `1.0`.
/// Returns the default [`Arc`] with radius `0.5` and angle `1.0`.
fn default() -> Self {
Self {
radius: 0.5,
Expand Down Expand Up @@ -282,8 +284,9 @@ impl Arc {
/// the length of the line between the midpoints of the arc and its chord.
/// Equivalently, the height of the triangle whose base is the chord and whose apex is the midpoint of the arc.
///
/// If the arc is minor, i.e. less than half the circle, the this will be the difference of the [radius](Self::radius) and the [apothem](Self::apothem).
/// If it is [major](Self::major), it will be their sum.
/// If the arc is minor, i.e. less than half the circle, the this will be the difference of the [`radius`](Self::radius)
/// and the [`apothem`](Self::apothem_len).
/// If the arc is [major](Self::is_major), it will be their sum.
#[inline(always)]
pub fn sagitta_len(&self) -> f32 {
if self.is_major() {
Expand All @@ -302,7 +305,7 @@ impl Arc {

/// A primitive representing a circular sector: a pie slice of a circle.
///
/// The sector is drawn starting from [Vec2::X], going counterclockwise.
/// The sector is drawn starting from [`Vec2::X`], going counterclockwise.
/// To orient the sector differently, apply a rotation.
/// The sector is drawn with the center of its circle at the origin (0, 0).
#[derive(Clone, Copy, Debug, PartialEq)]
Expand All @@ -315,7 +318,7 @@ pub struct CircularSector {
impl Primitive2d for CircularSector {}

impl Default for CircularSector {
// Returns the default [`CircularSector`] with radius `0.5` and angle `1.0`.
/// Returns the default [`CircularSector`] with radius `0.5` and angle `1.0`.
fn default() -> Self {
Arc::default().into()
}
Expand All @@ -328,7 +331,7 @@ impl From<Arc> for CircularSector {
}

impl CircularSector {
/// Create a new [CircularSector] from a `radius`, and an `angle`
/// Create a new [`CircularSector`] from a `radius`, and an `angle`
#[inline(always)]
pub fn new(radius: f32, angle: f32) -> Self {
Arc::new(radius, angle).into()
Expand All @@ -344,10 +347,10 @@ impl CircularSector {
/// A primitive representing a circular segment:
/// the area enclosed by the arc of a circle and its chord (the line between its endpoints).
///
/// The segment is drawn starting from [Vec2::X], going counterclockwise.
/// The segment is drawn starting from [`Vec2::X`], going counterclockwise.
/// To orient the segment differently, apply a rotation.
/// The segment is drawn with the center of its circle at the origin (0, 0).
/// When positioning the segment, the [apothem_len](Self::apothem) and [sagitta_len](Sagitta) functions
/// When positioning the segment, the [`apothem_len`](Arc::apothem_len) and [`sagitta_len`](Arc::sagitta_len) functions
/// may be particularly useful.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
Expand All @@ -359,7 +362,7 @@ pub struct CircularSegment {
impl Primitive2d for CircularSegment {}

impl Default for CircularSegment {
// Returns the default [CircularSegment] with radius `0.5` and angle `1.0`.
/// Returns the default [`CircularSegment`] with radius `0.5` and angle `1.0`.
fn default() -> Self {
Arc::default().into()
}
Expand All @@ -372,7 +375,7 @@ impl From<Arc> for CircularSegment {
}

impl CircularSegment {
/// Create a new [CircularSegment] from a `radius`, and an `angle`
/// Create a new [`CircularSegment`] from a `radius`, and an `angle`
#[inline(always)]
pub fn new(radius: f32, angle: f32) -> Self {
Arc::new(radius, angle).into()
Expand Down

0 comments on commit 843275b

Please sign in to comment.