Skip to content

Commit da1e6e6

Browse files
authored
Mention of Vec normalization for Dir::new (#13483)
# Objective - Fixes #13429 . ## Solution - Improved docs for methods `new`, `new_and_length` of `Dir2`, `Dir3`, `Dir3A`.
1 parent bd5148e commit da1e6e6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

crates/bevy_math/src/direction.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl Dir2 {
9595
/// The directional axes.
9696
pub const AXES: [Self; 2] = [Self::X, Self::Y];
9797

98-
/// Create a direction from a finite, nonzero [`Vec2`].
98+
/// Create a direction from a finite, nonzero [`Vec2`], normalizing it.
9999
///
100100
/// Returns [`Err(InvalidDirectionError)`](InvalidDirectionError) if the length
101101
/// of the given vector is zero (or very close to zero), infinite, or `NaN`.
@@ -118,7 +118,8 @@ impl Dir2 {
118118
Self(value)
119119
}
120120

121-
/// Create a direction from a finite, nonzero [`Vec2`], also returning its original length.
121+
/// Create a direction from a finite, nonzero [`Vec2`], normalizing it and
122+
/// also returning its original length.
122123
///
123124
/// Returns [`Err(InvalidDirectionError)`](InvalidDirectionError) if the length
124125
/// of the given vector is zero (or very close to zero), infinite, or `NaN`.
@@ -288,7 +289,7 @@ impl Dir3 {
288289
/// The directional axes.
289290
pub const AXES: [Self; 3] = [Self::X, Self::Y, Self::Z];
290291

291-
/// Create a direction from a finite, nonzero [`Vec3`].
292+
/// Create a direction from a finite, nonzero [`Vec3`], normalizing it.
292293
///
293294
/// Returns [`Err(InvalidDirectionError)`](InvalidDirectionError) if the length
294295
/// of the given vector is zero (or very close to zero), infinite, or `NaN`.
@@ -311,7 +312,8 @@ impl Dir3 {
311312
Self(value)
312313
}
313314

314-
/// Create a direction from a finite, nonzero [`Vec3`], also returning its original length.
315+
/// Create a direction from a finite, nonzero [`Vec3`], normalizing it and
316+
/// also returning its original length.
315317
///
316318
/// Returns [`Err(InvalidDirectionError)`](InvalidDirectionError) if the length
317319
/// of the given vector is zero (or very close to zero), infinite, or `NaN`.
@@ -488,7 +490,7 @@ impl Dir3A {
488490
/// The directional axes.
489491
pub const AXES: [Self; 3] = [Self::X, Self::Y, Self::Z];
490492

491-
/// Create a direction from a finite, nonzero [`Vec3A`].
493+
/// Create a direction from a finite, nonzero [`Vec3A`], normalizing it.
492494
///
493495
/// Returns [`Err(InvalidDirectionError)`](InvalidDirectionError) if the length
494496
/// of the given vector is zero (or very close to zero), infinite, or `NaN`.
@@ -511,7 +513,8 @@ impl Dir3A {
511513
Self(value)
512514
}
513515

514-
/// Create a direction from a finite, nonzero [`Vec3A`], also returning its original length.
516+
/// Create a direction from a finite, nonzero [`Vec3A`], normalizing it and
517+
/// also returning its original length.
515518
///
516519
/// Returns [`Err(InvalidDirectionError)`](InvalidDirectionError) if the length
517520
/// of the given vector is zero (or very close to zero), infinite, or `NaN`.

0 commit comments

Comments
 (0)