From ca9b4e38dd0db9156f0313b4a386a6bf4e8e7ed8 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Wed, 3 Oct 2018 18:28:07 +0700 Subject: [PATCH] Add more see-also content to glm docs. --- nalgebra-glm/src/exponential.rs | 27 +++ nalgebra-glm/src/ext/scalar_constants.rs | 15 ++ nalgebra-glm/src/ext/vector_common.rs | 96 ++++++++++ nalgebra-glm/src/gtc/constants.rs | 219 ++++++++++++++++++++++- nalgebra-glm/src/gtc/matrix_access.rs | 24 +++ nalgebra-glm/src/gtx/component_wise.rs | 34 +++- nalgebra-glm/src/vector_relational.rs | 8 + 7 files changed, 421 insertions(+), 2 deletions(-) diff --git a/nalgebra-glm/src/exponential.rs b/nalgebra-glm/src/exponential.rs index 0cda3268..d73db3a8 100644 --- a/nalgebra-glm/src/exponential.rs +++ b/nalgebra-glm/src/exponential.rs @@ -3,18 +3,30 @@ use aliases::TVec; use traits::{Alloc, Dimension}; /// Component-wise exponential. +/// +/// # See also: +/// +/// * [`exp2`](fn.exp2.html) pub fn exp(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| x.exp()) } /// Component-wise base-2 exponential. +/// +/// # See also: +/// +/// * [`exp`](fn.exp.html) pub fn exp2(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| x.exp2()) } /// Compute the inverse of the square root of each component of `v`. +/// +/// # See also: +/// +/// * [`sqrt`](fn.sqrt.html) pub fn inversesqrt(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| N::one() / x.sqrt()) @@ -22,12 +34,20 @@ pub fn inversesqrt(v: &TVec) -> TVec } /// Component-wise logarithm. +/// +/// # See also: +/// +/// * [`log2`](fn.log2.html) pub fn log(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| x.ln()) } /// Component-wise base-2 logarithm. +/// +/// # See also: +/// +/// * [`log`](fn.log.html) pub fn log2(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| x.log2()) @@ -40,6 +60,13 @@ pub fn pow(base: &TVec, exponent: &TVec) -> T } /// Component-wise square root. +/// +/// # See also: +/// +/// * [`exp`](fn.exp.html) +/// * [`exp2`](fn.exp2.html) +/// * [`inversesqrt`](fn.inversesqrt.html) +/// * [`pow`](fn.pow.html) pub fn sqrt(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| x.sqrt()) diff --git a/nalgebra-glm/src/ext/scalar_constants.rs b/nalgebra-glm/src/ext/scalar_constants.rs index f4a25718..2b9ed14d 100644 --- a/nalgebra-glm/src/ext/scalar_constants.rs +++ b/nalgebra-glm/src/ext/scalar_constants.rs @@ -7,6 +7,21 @@ pub fn epsilon>() -> N { } /// The value of PI. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn pi() -> N { N::pi() } diff --git a/nalgebra-glm/src/ext/vector_common.rs b/nalgebra-glm/src/ext/vector_common.rs index d60ecfd6..4c736651 100644 --- a/nalgebra-glm/src/ext/vector_common.rs +++ b/nalgebra-glm/src/ext/vector_common.rs @@ -4,48 +4,144 @@ use traits::{Alloc, Number, Dimension}; use aliases::TVec; /// Component-wise maximum between a vector and a scalar. +/// +/// # See also: +/// +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_min`](fn.comp_min.html) +/// * [`max2`](fn.max2.html) +/// * [`max3`](fn.max3.html) +/// * [`max4`](fn.max4.html) +/// * [`min`](fn.min.html) +/// * [`min2`](fn.min2.html) +/// * [`min3`](fn.min3.html) +/// * [`min4`](fn.min4.html) pub fn max(a: &TVec, b: N) -> TVec where DefaultAllocator: Alloc { a.map(|a| na::sup(&a, &b)) } /// Component-wise maximum between two vectors. +/// +/// # See also: +/// +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_min`](fn.comp_min.html) +/// * [`max`](fn.max.html) +/// * [`max3`](fn.max3.html) +/// * [`max4`](fn.max4.html) +/// * [`min`](fn.min.html) +/// * [`min2`](fn.min2.html) +/// * [`min3`](fn.min3.html) +/// * [`min4`](fn.min4.html) pub fn max2(a: &TVec, b: &TVec) -> TVec where DefaultAllocator: Alloc { na::sup(a, b) } /// Component-wise maximum between three vectors. +/// +/// # See also: +/// +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_min`](fn.comp_min.html) +/// * [`max`](fn.max.html) +/// * [`max2`](fn.max2.html) +/// * [`max4`](fn.max4.html) +/// * [`min`](fn.min.html) +/// * [`min2`](fn.min2.html) +/// * [`min3`](fn.min3.html) +/// * [`min4`](fn.min4.html) pub fn max3(a: &TVec, b: &TVec, c: &TVec) -> TVec where DefaultAllocator: Alloc { max2(&max2(a, b), c) } /// Component-wise maximum between four vectors. +/// +/// # See also: +/// +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_min`](fn.comp_min.html) +/// * [`max`](fn.max.html) +/// * [`max2`](fn.max2.html) +/// * [`max3`](fn.max3.html) +/// * [`min`](fn.min.html) +/// * [`min2`](fn.min2.html) +/// * [`min3`](fn.min3.html) +/// * [`min4`](fn.min4.html) pub fn max4(a: &TVec, b: &TVec, c: &TVec, d: &TVec) -> TVec where DefaultAllocator: Alloc { max2(&max2(a, b), &max2(c, d)) } /// Component-wise minimum between a vector and a scalar. +/// +/// # See also: +/// +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_min`](fn.comp_min.html) +/// * [`max`](fn.max.html) +/// * [`max2`](fn.max2.html) +/// * [`max3`](fn.max3.html) +/// * [`max4`](fn.max4.html) +/// * [`min2`](fn.min2.html) +/// * [`min3`](fn.min3.html) +/// * [`min4`](fn.min4.html) pub fn min(x: &TVec, y: N) -> TVec where DefaultAllocator: Alloc { x.map(|x| na::inf(&x, &y)) } /// Component-wise minimum between two vectors. +/// +/// # See also: +/// +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_min`](fn.comp_min.html) +/// * [`max`](fn.max.html) +/// * [`max2`](fn.max2.html) +/// * [`max3`](fn.max3.html) +/// * [`max4`](fn.max4.html) +/// * [`min`](fn.min.html) +/// * [`min3`](fn.min3.html) +/// * [`min4`](fn.min4.html) pub fn min2(x: &TVec, y: &TVec) -> TVec where DefaultAllocator: Alloc { na::inf(x, y) } /// Component-wise minimum between three vectors. +/// +/// # See also: +/// +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_min`](fn.comp_min.html) +/// * [`max`](fn.max.html) +/// * [`max2`](fn.max2.html) +/// * [`max3`](fn.max3.html) +/// * [`max4`](fn.max4.html) +/// * [`min`](fn.min.html) +/// * [`min2`](fn.min2.html) +/// * [`min4`](fn.min4.html) pub fn min3(a: &TVec, b: &TVec, c: &TVec) -> TVec where DefaultAllocator: Alloc { min2(&min2(a, b), c) } /// Component-wise minimum between four vectors. +/// +/// # See also: +/// +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_min`](fn.comp_min.html) +/// * [`max`](fn.max.html) +/// * [`max2`](fn.max2.html) +/// * [`max3`](fn.max3.html) +/// * [`max4`](fn.max4.html) +/// * [`min`](fn.min.html) +/// * [`min2`](fn.min2.html) +/// * [`min3`](fn.min3.html) pub fn min4(a: &TVec, b: &TVec, c: &TVec, d: &TVec) -> TVec where DefaultAllocator: Alloc { min2(&min2(a, b), &min2(c, d)) diff --git a/nalgebra-glm/src/gtc/constants.rs b/nalgebra-glm/src/gtc/constants.rs index a982ff0b..10f387a4 100644 --- a/nalgebra-glm/src/gtc/constants.rs +++ b/nalgebra-glm/src/gtc/constants.rs @@ -11,6 +11,21 @@ pub fn euler() -> N { } /// Returns `4 / pi`. +/// +/// # See also: +/// +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`pi`](fn.pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn four_over_pi() -> N { na::convert::<_, N>(4.0) / N::pi() } @@ -21,21 +36,51 @@ pub fn golden_ratio() -> N { } /// Returns `pi / 2`. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`pi`](fn.pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn half_pi() -> N { N::frac_pi_2() } /// Returns `ln(ln(2))`. +/// +/// # See also: +/// +/// * [`ln_ten`](fn.ln_ten.html) +/// * [`ln_two`](fn.ln_two.html) pub fn ln_ln_two() -> N { N::ln_2().ln() } /// Returns `ln(10)`. +/// +/// # See also: +/// +/// * [`ln_ln_two`](fn.ln_ln_two.html) +/// * [`ln_two`](fn.ln_two.html) pub fn ln_ten() -> N { N::ln_10() } /// Returns `ln(2)`. +/// +/// # See also: +/// +/// * [`ln_ln_two`](fn.ln_ln_two.html) +/// * [`ln_ten`](fn.ln_ten.html) pub fn ln_two() -> N { N::ln_2() } @@ -44,6 +89,21 @@ pub fn ln_two() -> N { pub use na::one; /// Returns `1 / pi`. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`pi`](fn.pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn one_over_pi() -> N { N::frac_1_pi() } @@ -54,21 +114,71 @@ pub fn one_over_root_two() -> N { } /// Returns `1 / (2pi)`. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`pi`](fn.pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn one_over_two_pi() -> N { N::frac_1_pi() * na::convert(0.5) } /// Returns `pi / 4`. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`pi`](fn.pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn quarter_pi() -> N { N::frac_pi_4() } /// Returns `sqrt(5)`. +/// +/// # See also: +/// +/// * [`root_three`](fn.root_three.html) +/// * [`root_two`](fn.root_two.html) pub fn root_five() -> N { na::convert::<_, N>(5.0).sqrt() } /// Returns `sqrt(pi / 2)`. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`pi`](fn.pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn root_half_pi() -> N { (N::pi() / na::convert(2.0)).sqrt() } @@ -79,55 +189,162 @@ pub fn root_ln_four() -> N { } /// Returns the square root of pi. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`pi`](fn.pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn root_pi() -> N { N::pi().sqrt() } /// Returns the square root of 3. +/// +/// # See also: +/// +/// * [`root_five`](fn.root_five.html) +/// * [`root_two`](fn.root_two.html) pub fn root_three() -> N { na::convert::<_, N>(3.0).sqrt() } /// Returns the square root of 2. +/// +/// # See also: +/// +/// * [`root_five`](fn.root_five.html) +/// * [`root_three`](fn.root_three.html) pub fn root_two() -> N { // FIXME: there should be a ::sqrt_2() on the Real trait. na::convert::<_, N>(2.0).sqrt() } /// Returns the square root of 2pi. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`pi`](fn.pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn root_two_pi() -> N { N::two_pi().sqrt() } /// Returns `1 / 3`. +/// +/// # See also: +/// +/// * [`two_thirds`](fn.two_thirds.html) pub fn third() -> N { na::convert(1.0 / 3.0) } /// Returns `3 / (2pi)`. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`pi`](fn.pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn three_over_two_pi() -> N { na::convert::<_, N>(3.0) / N::two_pi() } /// Returns `2 / pi`. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn two_over_pi() -> N { N::frac_2_pi() } /// Returns `2 / sqrt(pi)`. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`pi`](fn.pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_pi`](fn.two_pi.html) pub fn two_over_root_pi() -> N { N::frac_2_sqrt_pi() } /// Returns `2pi`. +/// +/// # See also: +/// +/// * [`four_over_pi`](fn.four_over_pi.html) +/// * [`half_pi`](fn.half_pi.html) +/// * [`one_over_pi`](fn.one_over_pi.html) +/// * [`one_over_two_pi`](fn.one_over_two_pi.html) +/// * [`pi`](fn.pi.html) +/// * [`quarter_pi`](fn.quarter_pi.html) +/// * [`root_half_pi`](fn.root_half_pi.html) +/// * [`root_pi`](fn.root_pi.html) +/// * [`root_two_pi`](fn.root_two_pi.html) +/// * [`three_over_two_pi`](fn.three_over_two_pi.html) +/// * [`two_over_pi`](fn.two_over_pi.html) +/// * [`two_over_root_pi`](fn.two_over_root_pi.html) pub fn two_pi() -> N { N::two_pi() } /// Returns `2 / 3`. +/// +/// # See also: +/// +/// * [`third`](fn.third.html) pub fn two_thirds() -> N { na::convert(2.0 / 3.0) } /// Returns `0`. -pub use na::zero; \ No newline at end of file +pub use na::zero; diff --git a/nalgebra-glm/src/gtc/matrix_access.rs b/nalgebra-glm/src/gtc/matrix_access.rs index 40509b72..2db271c1 100644 --- a/nalgebra-glm/src/gtc/matrix_access.rs +++ b/nalgebra-glm/src/gtc/matrix_access.rs @@ -4,12 +4,24 @@ use traits::{Alloc, Dimension}; use aliases::{TVec, TMat}; /// The `index`-th column of the matrix `m`. +/// +/// # See also: +/// +/// * [`row`](fn.row.html) +/// * [`set_column`](fn.set_column.html) +/// * [`set_row`](fn.set_row.html) pub fn column(m: &TMat, index: usize) -> TVec where DefaultAllocator: Alloc { m.column(index).into_owned() } /// Sets to `x` the `index`-th column of the matrix `m`. +/// +/// # See also: +/// +/// * [`column`](fn.column.html) +/// * [`row`](fn.row.html) +/// * [`set_row`](fn.set_row.html) pub fn set_column(m: &TMat, index: usize, x: &TVec) -> TMat where DefaultAllocator: Alloc { let mut res = m.clone(); @@ -18,12 +30,24 @@ pub fn set_column(m: &TMat, inde } /// The `index`-th row of the matrix `m`. +/// +/// # See also: +/// +/// * [`column`](fn.column.html) +/// * [`set_column`](fn.set_column.html) +/// * [`set_row`](fn.set_row.html) pub fn row(m: &TMat, index: usize) -> TVec where DefaultAllocator: Alloc { m.row(index).into_owned().transpose() } /// Sets to `x` the `index`-th row of the matrix `m`. +/// +/// # See also: +/// +/// * [`column`](fn.column.html) +/// * [`row`](fn.row.html) +/// * [`set_column`](fn.set_column.html) pub fn set_row(m: &TMat, index: usize, x: &TVec) -> TMat where DefaultAllocator: Alloc { let mut res = m.clone(); diff --git a/nalgebra-glm/src/gtx/component_wise.rs b/nalgebra-glm/src/gtx/component_wise.rs index e10f3ba2..98171554 100644 --- a/nalgebra-glm/src/gtx/component_wise.rs +++ b/nalgebra-glm/src/gtx/component_wise.rs @@ -4,28 +4,60 @@ use traits::{Number, Alloc, Dimension}; use aliases::TMat; /// The sum of every components of the given matrix or vector. +/// +/// # See also: +/// +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_min`](fn.comp_min.html) +/// * [`comp_mul`](fn.comp_mul.html) pub fn comp_add(m: &TMat) -> N where DefaultAllocator: Alloc { m.iter().fold(N::zero(), |x, y| x + *y) } /// The maximum of every components of the given matrix or vector. +/// +/// # See also: +/// +/// * [`comp_add`](fn.comp_add.html) +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_min`](fn.comp_min.html) +/// * [`max`](fn.max.html) +/// * [`max2`](fn.max2.html) +/// * [`max3`](fn.max3.html) +/// * [`max4`](fn.max4.html) pub fn comp_max(m: &TMat) -> N where DefaultAllocator: Alloc { m.iter().fold(N::min_value(), |x, y| na::sup(&x, y)) } /// The minimum of every components of the given matrix or vector. +/// +/// # See also: +/// +/// * [`comp_add`](fn.comp_add.html) +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_mul`](fn.comp_mul.html) +/// * [`min`](fn.min.html) +/// * [`min2`](fn.min2.html) +/// * [`min3`](fn.min3.html) +/// * [`min4`](fn.min4.html) pub fn comp_min(m: &TMat) -> N where DefaultAllocator: Alloc { m.iter().fold(N::max_value(), |x, y| na::inf(&x, y)) } /// The product of every components of the given matrix or vector. +/// +/// # See also: +/// +/// * [`comp_add`](fn.comp_add.html) +/// * [`comp_max`](fn.comp_max.html) +/// * [`comp_min`](fn.comp_min.html) pub fn comp_mul(m: &TMat) -> N where DefaultAllocator: Alloc { m.iter().fold(N::one(), |x, y| x * *y) } //pub fn vec< L, floatType, Q > compNormalize (vec< L, T, Q > const &v) -//pub fn vec< L, T, Q > compScale (vec< L, floatType, Q > const &v) \ No newline at end of file +//pub fn vec< L, T, Q > compScale (vec< L, floatType, Q > const &v) diff --git a/nalgebra-glm/src/vector_relational.rs b/nalgebra-glm/src/vector_relational.rs index 09157a10..1d24f59b 100644 --- a/nalgebra-glm/src/vector_relational.rs +++ b/nalgebra-glm/src/vector_relational.rs @@ -4,12 +4,20 @@ use aliases::TVec; use traits::{Number, Alloc, Dimension}; /// Checks that all the vector components are `true`. +/// +/// # See also: +/// +/// * [`any`](fn.any.html) pub fn all(v: &TVec) -> bool where DefaultAllocator: Alloc { v.iter().all(|x| *x) } /// Checks that at least one of the vector components is `true`. +/// +/// # See also: +/// +/// * [`all`](fn.all.html) pub fn any(v: &TVec) -> bool where DefaultAllocator: Alloc { v.iter().any(|x| *x)