Merge pull request #1265 from waywardmonkeys/fix-html-links

docs: Use intradoc links rather than HTML.
This commit is contained in:
Sébastien Crozet 2023-09-30 18:24:28 +02:00 committed by GitHub
commit c6ff3eeb7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 965 additions and 970 deletions

View File

@ -5,38 +5,38 @@ use na::{
/// A matrix with components of type `T`. It has `R` rows, and `C` columns. /// A matrix with components of type `T`. It has `R` rows, and `C` columns.
/// ///
/// In this library, vectors, represented as [`TVec`](type.TVec.html) and /// In this library, vectors, represented as [`TVec`] and
/// friends, are also matrices. Operations that operate on a matrix will /// friends, are also matrices. Operations that operate on a matrix will
/// also work on a vector. /// also work on a vector.
/// ///
/// # See also: /// # See also:
/// ///
/// * [`TMat2`](type.TMat2.html) /// * [`TMat2`]
/// * [`TMat2x2`](type.TMat2x2.html) /// * [`TMat2x2`]
/// * [`TMat2x3`](type.TMat2x3.html) /// * [`TMat2x3`]
/// * [`TMat2x4`](type.TMat2x4.html) /// * [`TMat2x4`]
/// * [`TMat3`](type.TMat3.html) /// * [`TMat3`]
/// * [`TMat3x2`](type.TMat3x2.html) /// * [`TMat3x2`]
/// * [`TMat3x3`](type.TMat3x3.html) /// * [`TMat3x3`]
/// * [`TMat3x4`](type.TMat3x4.html) /// * [`TMat3x4`]
/// * [`TMat4`](type.TMat4.html) /// * [`TMat4`]
/// * [`TMat4x2`](type.TMat4x2.html) /// * [`TMat4x2`]
/// * [`TMat4x3`](type.TMat4x3.html) /// * [`TMat4x3`]
/// * [`TMat4x4`](type.TMat4x4.html) /// * [`TMat4x4`]
/// * [`TVec`](type.TVec.html) /// * [`TVec`]
pub type TMat<T, const R: usize, const C: usize> = SMatrix<T, R, C>; pub type TMat<T, const R: usize, const C: usize> = SMatrix<T, R, C>;
/// A column vector with components of type `T`. It has `D` rows (and one column). /// A column vector with components of type `T`. It has `D` rows (and one column).
/// ///
/// In this library, vectors are represented as a single column matrix, so /// In this library, vectors are represented as a single column matrix, so
/// operations on [`TMat`](type.TMat.html) are also valid on vectors. /// operations on [`TMat`] are also valid on vectors.
/// ///
/// # See also: /// # See also:
/// ///
/// * [`TMat`](type.TMat.html) /// * [`TMat`]
/// * [`TVec1`](type.TVec1.html) /// * [`TVec1`]
/// * [`TVec2`](type.TVec2.html) /// * [`TVec2`]
/// * [`TVec3`](type.TVec3.html) /// * [`TVec3`]
/// * [`TVec4`](type.TVec4.html) /// * [`TVec4`]
pub type TVec<T, const R: usize> = SVector<T, R>; pub type TVec<T, const R: usize> = SVector<T, R>;
/// A quaternion with components of type `T`. /// A quaternion with components of type `T`.
pub type Qua<T> = Quaternion<T>; pub type Qua<T> = Quaternion<T>;
@ -47,28 +47,28 @@ pub type Qua<T> = Quaternion<T>;
/// ///
/// ## Constructors: /// ## Constructors:
/// ///
/// * [`make_vec1`](fn.make_vec1.html) /// * [`make_vec1()`](crate::make_vec1)
/// * [`vec1`](fn.vec1.html) /// * [`vec1()`](crate::vec1)
/// * [`vec2_to_vec1`](fn.vec2_to_vec1.html) /// * [`vec2_to_vec1()`](crate::vec2_to_vec1)
/// * [`vec3_to_vec1`](fn.vec3_to_vec1.html) /// * [`vec3_to_vec1()`](crate::vec3_to_vec1)
/// * [`vec4_to_vec1`](fn.vec4_to_vec1.html) /// * [`vec4_to_vec1()`](crate::vec4_to_vec1)
/// ///
/// ## Related types: /// ## Related types:
/// ///
/// * [`BVec1`](type.BVec1.html) /// * [`BVec1`]
/// * [`DVec1`](type.DVec1.html) /// * [`DVec1`]
/// * [`IVec1`](type.IVec1.html) /// * [`IVec1`]
/// * [`I16Vec1`](type.I16Vec1.html) /// * [`I16Vec1`]
/// * [`I32Vec1`](type.I32Vec1.html) /// * [`I32Vec1`]
/// * [`I64Vec1`](type.I64Vec1.html) /// * [`I64Vec1`]
/// * [`I8Vec1`](type.I8Vec1.html) /// * [`I8Vec1`]
/// * [`TVec`](type.TVec.html) /// * [`TVec`]
/// * [`UVec1`](type.UVec1.html) /// * [`UVec1`]
/// * [`U16Vec1`](type.U16Vec1.html) /// * [`U16Vec1`]
/// * [`U32Vec1`](type.U32Vec1.html) /// * [`U32Vec1`]
/// * [`U64Vec1`](type.U64Vec1.html) /// * [`U64Vec1`]
/// * [`U8Vec1`](type.U8Vec1.html) /// * [`U8Vec1`]
/// * [`Vec1`](type.Vec1.html) /// * [`Vec1`]
pub type TVec1<T> = TVec<T, 1>; pub type TVec1<T> = TVec<T, 1>;
/// A 2D vector with components of type `T`. /// A 2D vector with components of type `T`.
/// ///
@ -76,29 +76,28 @@ pub type TVec1<T> = TVec<T, 1>;
/// ///
/// ## Constructors: /// ## Constructors:
/// ///
/// * [`make_vec2`](fn.make_vec2.html) /// * [`make_vec2()`](crate::make_vec2)
/// * [`vec2`](fn.vec2.html) /// * [`vec2()`](crate::vec2)
/// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec2()`](crate::vec1_to_vec2)
/// * [`vec3_to_vec2`](fn.vec3_to_vec2.html) /// * [`vec3_to_vec2()`](crate::vec3_to_vec2)
/// * [`vec4_to_vec2`](fn.vec4_to_vec2.html) /// * [`vec4_to_vec2()`](crate::vec4_to_vec2)
/// ///
/// ## Related types: /// ## Related types:
/// ///
/// * [`vec2`](fn.vec2.html) /// * [`BVec2`]
/// * [`BVec2`](type.BVec2.html) /// * [`DVec2`]
/// * [`DVec2`](type.DVec2.html) /// * [`IVec2`]
/// * [`IVec2`](type.IVec2.html) /// * [`I16Vec2`]
/// * [`I16Vec2`](type.I16Vec2.html) /// * [`I32Vec2`]
/// * [`I32Vec2`](type.I32Vec2.html) /// * [`I64Vec2`]
/// * [`I64Vec2`](type.I64Vec2.html) /// * [`I8Vec2`]
/// * [`I8Vec2`](type.I8Vec2.html) /// * [`TVec`]
/// * [`TVec`](type.TVec.html) /// * [`UVec2`]
/// * [`UVec2`](type.UVec2.html) /// * [`U16Vec2`]
/// * [`U16Vec2`](type.U16Vec2.html) /// * [`U32Vec2`]
/// * [`U32Vec2`](type.U32Vec2.html) /// * [`U64Vec2`]
/// * [`U64Vec2`](type.U64Vec2.html) /// * [`U8Vec2`]
/// * [`U8Vec2`](type.U8Vec2.html) /// * [`Vec2`]
/// * [`Vec2`](type.Vec2.html)
pub type TVec2<T> = TVec<T, 2>; pub type TVec2<T> = TVec<T, 2>;
/// A 3D vector with components of type `T`. /// A 3D vector with components of type `T`.
/// ///
@ -106,29 +105,28 @@ pub type TVec2<T> = TVec<T, 2>;
/// ///
/// ## Constructors: /// ## Constructors:
/// ///
/// * [`make_vec3`](fn.make_vec3.html) /// * [`make_vec3()`](crate::make_vec3)
/// * [`vec3`](fn.vec3.html) /// * [`vec3()`](crate::vec3)
/// * [`vec1_to_vec3`](fn.vec1_to_vec3.html) /// * [`vec1_to_vec3()`](crate::vec1_to_vec3)
/// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec3()`](crate::vec2_to_vec3)
/// * [`vec4_to_vec3`](fn.vec4_to_vec3.html) /// * [`vec4_to_vec3()`](crate::vec4_to_vec3)
/// ///
/// ## Related types: /// ## Related types:
/// ///
/// * [`vec3`](fn.vec3.html) /// * [`BVec3`]
/// * [`BVec3`](type.BVec3.html) /// * [`DVec3`]
/// * [`DVec3`](type.DVec3.html) /// * [`IVec3`]
/// * [`IVec3`](type.IVec3.html) /// * [`I16Vec3`]
/// * [`I16Vec3`](type.I16Vec3.html) /// * [`I32Vec3`]
/// * [`I32Vec3`](type.I32Vec3.html) /// * [`I64Vec3`]
/// * [`I64Vec3`](type.I64Vec3.html) /// * [`I8Vec3`]
/// * [`I8Vec3`](type.I8Vec3.html) /// * [`TVec`]
/// * [`TVec`](type.TVec.html) /// * [`UVec3`]
/// * [`UVec3`](type.UVec3.html) /// * [`U16Vec3`]
/// * [`U16Vec3`](type.U16Vec3.html) /// * [`U32Vec3`]
/// * [`U32Vec3`](type.U32Vec3.html) /// * [`U64Vec3`]
/// * [`U64Vec3`](type.U64Vec3.html) /// * [`U8Vec3`]
/// * [`U8Vec3`](type.U8Vec3.html) /// * [`Vec3`]
/// * [`Vec3`](type.Vec3.html)
pub type TVec3<T> = TVec<T, 3>; pub type TVec3<T> = TVec<T, 3>;
/// A 4D vector with components of type `T`. /// A 4D vector with components of type `T`.
/// ///
@ -136,28 +134,27 @@ pub type TVec3<T> = TVec<T, 3>;
/// ///
/// ## Constructors: /// ## Constructors:
/// ///
/// * [`make_vec4`](fn.make_vec4.html) /// * [`make_vec4()`](crate::make_vec4)
/// * [`vec4`](fn.vec4.html) /// * [`vec4()`](crate::vec4)
/// * [`vec1_to_vec4`](fn.vec1_to_vec4.html) /// * [`vec1_to_vec4()`](crate::vec1_to_vec4)
/// * [`vec2_to_vec4`](fn.vec2_to_vec4.html) /// * [`vec2_to_vec4()`](crate::vec2_to_vec4)
/// * [`vec3_to_vec4`](fn.vec3_to_vec4.html) /// * [`vec3_to_vec4()`](crate::vec3_to_vec4)
/// ///
/// ## Related types: /// ## Related types:
/// ///
/// * [`vec4`](fn.vec4.html) /// * [`BVec4`]
/// * [`BVec4`](type.BVec4.html) /// * [`DVec4`]
/// * [`DVec4`](type.DVec4.html) /// * [`IVec4`]
/// * [`IVec4`](type.IVec4.html) /// * [`I16Vec4`]
/// * [`I16Vec4`](type.I16Vec4.html) /// * [`I32Vec4`]
/// * [`I32Vec4`](type.I32Vec4.html) /// * [`I64Vec4`]
/// * [`I64Vec4`](type.I64Vec4.html) /// * [`I8Vec4`]
/// * [`I8Vec4`](type.I8Vec4.html) /// * [`UVec4`]
/// * [`UVec4`](type.UVec4.html) /// * [`U16Vec4`]
/// * [`U16Vec4`](type.U16Vec4.html) /// * [`U32Vec4`]
/// * [`U32Vec4`](type.U32Vec4.html) /// * [`U64Vec4`]
/// * [`U64Vec4`](type.U64Vec4.html) /// * [`U8Vec4`]
/// * [`U8Vec4`](type.U8Vec4.html) /// * [`Vec4`]
/// * [`Vec4`](type.Vec4.html)
pub type TVec4<T> = TVec<T, 4>; pub type TVec4<T> = TVec<T, 4>;
/// A 1D vector with boolean components. /// A 1D vector with boolean components.
pub type BVec1 = TVec1<bool>; pub type BVec1 = TVec1<bool>;

View File

@ -19,7 +19,7 @@ use crate::RealNumber;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`sign`](fn.sign.html) /// * [`sign()`]
pub fn abs<T: Number, const R: usize, const C: usize>(x: &TMat<T, R, C>) -> TMat<T, R, C> { pub fn abs<T: Number, const R: usize, const C: usize>(x: &TMat<T, R, C>) -> TMat<T, R, C> {
x.abs() x.abs()
} }
@ -36,11 +36,11 @@ pub fn abs<T: Number, const R: usize, const C: usize>(x: &TMat<T, R, C>) -> TMat
/// ///
/// # See also: /// # See also:
/// ///
/// * [`ceil`](fn.ceil.html) /// * [`ceil()`]
/// * [`floor`](fn.floor.html) /// * [`floor()`]
/// * [`fract`](fn.fract.html) /// * [`fract()`]
/// * [`round`](fn.round.html) /// * [`round()`]
/// * [`trunc`](fn.trunc.html) /// * [`trunc()`]
pub fn ceil<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> { pub fn ceil<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> {
x.map(|x| x.ceil()) x.map(|x| x.ceil())
} }
@ -64,8 +64,8 @@ pub fn ceil<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`clamp`](fn.clamp.html) /// * [`clamp()`]
/// * [`clamp_vec`](fn.clamp_vec.html) /// * [`clamp_vec()`]
pub fn clamp_scalar<T: Number>(x: T, min_val: T, max_val: T) -> T { pub fn clamp_scalar<T: Number>(x: T, min_val: T, max_val: T) -> T {
na::clamp(x, min_val, max_val) na::clamp(x, min_val, max_val)
} }
@ -88,8 +88,8 @@ pub fn clamp_scalar<T: Number>(x: T, min_val: T, max_val: T) -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`clamp_scalar`](fn.clamp_scalar.html) /// * [`clamp_scalar()`]
/// * [`clamp_vec`](fn.clamp_vec.html) /// * [`clamp_vec()`]
pub fn clamp<T: Number, const D: usize>(x: &TVec<T, D>, min_val: T, max_val: T) -> TVec<T, D> { pub fn clamp<T: Number, const D: usize>(x: &TVec<T, D>, min_val: T, max_val: T) -> TVec<T, D> {
x.map(|x| na::clamp(x, min_val, max_val)) x.map(|x| na::clamp(x, min_val, max_val))
} }
@ -119,8 +119,8 @@ pub fn clamp<T: Number, const D: usize>(x: &TVec<T, D>, min_val: T, max_val: T)
/// ///
/// # See also: /// # See also:
/// ///
/// * [`clamp_scalar`](fn.clamp_scalar.html) /// * [`clamp_scalar()`]
/// * [`clamp`](fn.clamp.html) /// * [`clamp()`]
pub fn clamp_vec<T: Number, const D: usize>( pub fn clamp_vec<T: Number, const D: usize>(
x: &TVec<T, D>, x: &TVec<T, D>,
min_val: &TVec<T, D>, min_val: &TVec<T, D>,
@ -135,13 +135,13 @@ pub fn clamp_vec<T: Number, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`float_bits_to_int_vec`](fn.float_bits_to_int_vec.html) /// * [`float_bits_to_int_vec()`]
/// * [`float_bits_to_uint`](fn.float_bits_to_uint.html) /// * [`float_bits_to_uint()`]
/// * [`float_bits_to_uint_vec`](fn.float_bits_to_uint_vec.html) /// * [`float_bits_to_uint_vec()`]
/// * [`int_bits_to_float`](fn.int_bits_to_float.html) /// * [`int_bits_to_float()`]
/// * [`int_bits_to_float_vec`](fn.int_bits_to_float_vec.html) /// * [`int_bits_to_float_vec()`]
/// * [`uint_bits_to_float`](fn.uint_bits_to_float.html) /// * [`uint_bits_to_float()`]
/// * [`uint_bits_to_float_scalar`](fn.uint_bits_to_float_scalar.html) /// * [`uint_bits_to_float_scalar()`]
pub fn float_bits_to_int(v: f32) -> i32 { pub fn float_bits_to_int(v: f32) -> i32 {
unsafe { mem::transmute(v) } unsafe { mem::transmute(v) }
} }
@ -152,13 +152,13 @@ pub fn float_bits_to_int(v: f32) -> i32 {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`float_bits_to_int`](fn.float_bits_to_int.html) /// * [`float_bits_to_int()`]
/// * [`float_bits_to_uint`](fn.float_bits_to_uint.html) /// * [`float_bits_to_uint()`]
/// * [`float_bits_to_uint_vec`](fn.float_bits_to_uint_vec.html) /// * [`float_bits_to_uint_vec()`]
/// * [`int_bits_to_float`](fn.int_bits_to_float.html) /// * [`int_bits_to_float()`]
/// * [`int_bits_to_float_vec`](fn.int_bits_to_float_vec.html) /// * [`int_bits_to_float_vec()`]
/// * [`uint_bits_to_float`](fn.uint_bits_to_float.html) /// * [`uint_bits_to_float()`]
/// * [`uint_bits_to_float_scalar`](fn.uint_bits_to_float_scalar.html) /// * [`uint_bits_to_float_scalar()`]
pub fn float_bits_to_int_vec<const D: usize>(v: &TVec<f32, D>) -> TVec<i32, D> { pub fn float_bits_to_int_vec<const D: usize>(v: &TVec<f32, D>) -> TVec<i32, D> {
v.map(float_bits_to_int) v.map(float_bits_to_int)
} }
@ -169,13 +169,13 @@ pub fn float_bits_to_int_vec<const D: usize>(v: &TVec<f32, D>) -> TVec<i32, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`float_bits_to_int`](fn.float_bits_to_int.html) /// * [`float_bits_to_int()`]
/// * [`float_bits_to_int_vec`](fn.float_bits_to_int_vec.html) /// * [`float_bits_to_int_vec()`]
/// * [`float_bits_to_uint_vec`](fn.float_bits_to_uint_vec.html) /// * [`float_bits_to_uint_vec()`]
/// * [`int_bits_to_float`](fn.int_bits_to_float.html) /// * [`int_bits_to_float()`]
/// * [`int_bits_to_float_vec`](fn.int_bits_to_float_vec.html) /// * [`int_bits_to_float_vec()`]
/// * [`uint_bits_to_float`](fn.uint_bits_to_float.html) /// * [`uint_bits_to_float()`]
/// * [`uint_bits_to_float_scalar`](fn.uint_bits_to_float_scalar.html) /// * [`uint_bits_to_float_scalar()`]
pub fn float_bits_to_uint(v: f32) -> u32 { pub fn float_bits_to_uint(v: f32) -> u32 {
unsafe { mem::transmute(v) } unsafe { mem::transmute(v) }
} }
@ -186,13 +186,13 @@ pub fn float_bits_to_uint(v: f32) -> u32 {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`float_bits_to_int`](fn.float_bits_to_int.html) /// * [`float_bits_to_int()`]
/// * [`float_bits_to_int_vec`](fn.float_bits_to_int_vec.html) /// * [`float_bits_to_int_vec()`]
/// * [`float_bits_to_uint`](fn.float_bits_to_uint.html) /// * [`float_bits_to_uint()`]
/// * [`int_bits_to_float`](fn.int_bits_to_float.html) /// * [`int_bits_to_float()`]
/// * [`int_bits_to_float_vec`](fn.int_bits_to_float_vec.html) /// * [`int_bits_to_float_vec()`]
/// * [`uint_bits_to_float`](fn.uint_bits_to_float.html) /// * [`uint_bits_to_float()`]
/// * [`uint_bits_to_float_scalar`](fn.uint_bits_to_float_scalar.html) /// * [`uint_bits_to_float_scalar()`]
pub fn float_bits_to_uint_vec<const D: usize>(v: &TVec<f32, D>) -> TVec<u32, D> { pub fn float_bits_to_uint_vec<const D: usize>(v: &TVec<f32, D>) -> TVec<u32, D> {
v.map(float_bits_to_uint) v.map(float_bits_to_uint)
} }
@ -209,10 +209,10 @@ pub fn float_bits_to_uint_vec<const D: usize>(v: &TVec<f32, D>) -> TVec<u32, D>
/// ///
/// # See also: /// # See also:
/// ///
/// * [`ceil`](fn.ceil.html) /// * [`ceil()`]
/// * [`fract`](fn.fract.html) /// * [`fract()`]
/// * [`round`](fn.round.html) /// * [`round()`]
/// * [`trunc`](fn.trunc.html) /// * [`trunc()`]
pub fn floor<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> { pub fn floor<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> {
x.map(|x| x.floor()) x.map(|x| x.floor())
} }
@ -235,10 +235,10 @@ pub fn floor<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`ceil`](fn.ceil.html) /// * [`ceil()`]
/// * [`floor`](fn.floor.html) /// * [`floor()`]
/// * [`round`](fn.round.html) /// * [`round()`]
/// * [`trunc`](fn.trunc.html) /// * [`trunc()`]
pub fn fract<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> { pub fn fract<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> {
x.map(|x| x.fract()) x.map(|x| x.fract())
} }
@ -257,13 +257,13 @@ pub fn fract<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`float_bits_to_int`](fn.float_bits_to_int.html) /// * [`float_bits_to_int()`]
/// * [`float_bits_to_int_vec`](fn.float_bits_to_int_vec.html) /// * [`float_bits_to_int_vec()`]
/// * [`float_bits_to_uint`](fn.float_bits_to_uint.html) /// * [`float_bits_to_uint()`]
/// * [`float_bits_to_uint_vec`](fn.float_bits_to_uint_vec.html) /// * [`float_bits_to_uint_vec()`]
/// * [`int_bits_to_float_vec`](fn.int_bits_to_float_vec.html) /// * [`int_bits_to_float_vec()`]
/// * [`uint_bits_to_float`](fn.uint_bits_to_float.html) /// * [`uint_bits_to_float()`]
/// * [`uint_bits_to_float_scalar`](fn.uint_bits_to_float_scalar.html) /// * [`uint_bits_to_float_scalar()`]
pub fn int_bits_to_float(v: i32) -> f32 { pub fn int_bits_to_float(v: i32) -> f32 {
f32::from_bits(v as u32) f32::from_bits(v as u32)
} }
@ -274,13 +274,13 @@ pub fn int_bits_to_float(v: i32) -> f32 {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`float_bits_to_int`](fn.float_bits_to_int.html) /// * [`float_bits_to_int()`]
/// * [`float_bits_to_int_vec`](fn.float_bits_to_int_vec.html) /// * [`float_bits_to_int_vec()`]
/// * [`float_bits_to_uint`](fn.float_bits_to_uint.html) /// * [`float_bits_to_uint()`]
/// * [`float_bits_to_uint_vec`](fn.float_bits_to_uint_vec.html) /// * [`float_bits_to_uint_vec()`]
/// * [`int_bits_to_float`](fn.int_bits_to_float.html) /// * [`int_bits_to_float()`]
/// * [`uint_bits_to_float`](fn.uint_bits_to_float.html) /// * [`uint_bits_to_float()`]
/// * [`uint_bits_to_float_scalar`](fn.uint_bits_to_float_scalar.html) /// * [`uint_bits_to_float_scalar()`]
pub fn int_bits_to_float_vec<const D: usize>(v: &TVec<i32, D>) -> TVec<f32, D> { pub fn int_bits_to_float_vec<const D: usize>(v: &TVec<i32, D>) -> TVec<f32, D> {
v.map(int_bits_to_float) v.map(int_bits_to_float)
} }
@ -314,8 +314,8 @@ pub fn int_bits_to_float_vec<const D: usize>(v: &TVec<i32, D>) -> TVec<f32, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`mix`](fn.mix.html) /// * [`mix()`]
/// * [`mix_vec`](fn.mix_vec.html) /// * [`mix_vec()`]
pub fn mix_scalar<T: Number>(x: T, y: T, a: T) -> T { pub fn mix_scalar<T: Number>(x: T, y: T, a: T) -> T {
x * (T::one() - a) + y * a x * (T::one() - a) + y * a
} }
@ -335,8 +335,8 @@ pub fn mix_scalar<T: Number>(x: T, y: T, a: T) -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`mix_scalar`](fn.mix_scalar.html) /// * [`mix_scalar()`]
/// * [`mix_vec`](fn.mix_vec.html) /// * [`mix_vec()`]
pub fn mix<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>, a: T) -> TVec<T, D> { pub fn mix<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>, a: T) -> TVec<T, D> {
x * (T::one() - a) + y * a x * (T::one() - a) + y * a
} }
@ -358,8 +358,8 @@ pub fn mix<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>, a: T) -> T
/// ///
/// # See also: /// # See also:
/// ///
/// * [`mix_scalar`](fn.mix_scalar.html) /// * [`mix_scalar()`]
/// * [`mix`](fn.mix.html) /// * [`mix()`]
pub fn mix_vec<T: Number, const D: usize>( pub fn mix_vec<T: Number, const D: usize>(
x: &TVec<T, D>, x: &TVec<T, D>,
y: &TVec<T, D>, y: &TVec<T, D>,
@ -382,8 +382,8 @@ pub fn mix_vec<T: Number, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`lerp`](fn.lerp.html) /// * [`lerp()`]
/// * [`lerp_vec`](fn.lerp_vec.html) /// * [`lerp_vec()`]
pub fn lerp_scalar<T: Number>(x: T, y: T, a: T) -> T { pub fn lerp_scalar<T: Number>(x: T, y: T, a: T) -> T {
mix_scalar(x, y, a) mix_scalar(x, y, a)
} }
@ -404,8 +404,8 @@ pub fn lerp_scalar<T: Number>(x: T, y: T, a: T) -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`lerp_scalar`](fn.lerp_scalar.html) /// * [`lerp_scalar()`]
/// * [`lerp_vec`](fn.lerp_vec.html) /// * [`lerp_vec()`]
pub fn lerp<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>, a: T) -> TVec<T, D> { pub fn lerp<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>, a: T) -> TVec<T, D> {
mix(x, y, a) mix(x, y, a)
} }
@ -428,8 +428,8 @@ pub fn lerp<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>, a: T) ->
/// ///
/// # See also: /// # See also:
/// ///
/// * [`lerp_scalar`](fn.lerp_scalar.html) /// * [`lerp_scalar()`]
/// * [`lerp`](fn.lerp.html) /// * [`lerp()`]
pub fn lerp_vec<T: Number, const D: usize>( pub fn lerp_vec<T: Number, const D: usize>(
x: &TVec<T, D>, x: &TVec<T, D>,
y: &TVec<T, D>, y: &TVec<T, D>,
@ -444,7 +444,7 @@ pub fn lerp_vec<T: Number, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`modf`](fn.modf.html) /// * [`modf()`]
pub fn modf_vec<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<T, D> { pub fn modf_vec<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<T, D> {
x.zip_map(y, |x, y| x % y) x.zip_map(y, |x, y| x % y)
} }
@ -453,7 +453,7 @@ pub fn modf_vec<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TV
/// ///
/// # See also: /// # See also:
/// ///
/// * [`modf_vec`](fn.modf_vec.html) /// * [`modf_vec()`]
pub fn modf<T: Number>(x: T, i: T) -> T { pub fn modf<T: Number>(x: T, i: T) -> T {
x % i x % i
} }
@ -472,10 +472,10 @@ pub fn modf<T: Number>(x: T, i: T) -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`ceil`](fn.ceil.html) /// * [`ceil()`]
/// * [`floor`](fn.floor.html) /// * [`floor()`]
/// * [`fract`](fn.fract.html) /// * [`fract()`]
/// * [`trunc`](fn.trunc.html) /// * [`trunc()`]
pub fn round<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> { pub fn round<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> {
x.map(|x| x.round()) x.map(|x| x.round())
} }
@ -496,7 +496,7 @@ pub fn round<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`abs`](fn.abs.html) /// * [`abs()`]
/// ///
pub fn sign<T: Number, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> { pub fn sign<T: Number, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> {
x.map(|x| if x.is_zero() { T::zero() } else { x.signum() }) x.map(|x| if x.is_zero() { T::zero() } else { x.signum() })
@ -544,10 +544,10 @@ pub fn step_vec<T: Number, const D: usize>(edge: &TVec<T, D>, x: &TVec<T, D>) ->
/// ///
/// # See also: /// # See also:
/// ///
/// * [`ceil`](fn.ceil.html) /// * [`ceil()`]
/// * [`floor`](fn.floor.html) /// * [`floor()`]
/// * [`fract`](fn.fract.html) /// * [`fract()`]
/// * [`round`](fn.round.html) /// * [`round()`]
pub fn trunc<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> { pub fn trunc<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> {
x.map(|x| x.trunc()) x.map(|x| x.trunc())
} }
@ -558,13 +558,13 @@ pub fn trunc<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> TVec<T, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`float_bits_to_int`](fn.float_bits_to_int.html) /// * [`float_bits_to_int()`]
/// * [`float_bits_to_int_vec`](fn.float_bits_to_int_vec.html) /// * [`float_bits_to_int_vec()`]
/// * [`float_bits_to_uint`](fn.float_bits_to_uint.html) /// * [`float_bits_to_uint()`]
/// * [`float_bits_to_uint_vec`](fn.float_bits_to_uint_vec.html) /// * [`float_bits_to_uint_vec()`]
/// * [`int_bits_to_float`](fn.int_bits_to_float.html) /// * [`int_bits_to_float()`]
/// * [`int_bits_to_float_vec`](fn.int_bits_to_float_vec.html) /// * [`int_bits_to_float_vec()`]
/// * [`uint_bits_to_float`](fn.uint_bits_to_float.html) /// * [`uint_bits_to_float()`]
pub fn uint_bits_to_float_scalar(v: u32) -> f32 { pub fn uint_bits_to_float_scalar(v: u32) -> f32 {
f32::from_bits(v) f32::from_bits(v)
} }
@ -575,13 +575,13 @@ pub fn uint_bits_to_float_scalar(v: u32) -> f32 {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`float_bits_to_int`](fn.float_bits_to_int.html) /// * [`float_bits_to_int()`]
/// * [`float_bits_to_int_vec`](fn.float_bits_to_int_vec.html) /// * [`float_bits_to_int_vec()`]
/// * [`float_bits_to_uint`](fn.float_bits_to_uint.html) /// * [`float_bits_to_uint()`]
/// * [`float_bits_to_uint_vec`](fn.float_bits_to_uint_vec.html) /// * [`float_bits_to_uint_vec()`]
/// * [`int_bits_to_float`](fn.int_bits_to_float.html) /// * [`int_bits_to_float()`]
/// * [`int_bits_to_float_vec`](fn.int_bits_to_float_vec.html) /// * [`int_bits_to_float_vec()`]
/// * [`uint_bits_to_float_scalar`](fn.uint_bits_to_float_scalar.html) /// * [`uint_bits_to_float_scalar()`]
pub fn uint_bits_to_float<const D: usize>(v: &TVec<u32, D>) -> TVec<f32, D> { pub fn uint_bits_to_float<const D: usize>(v: &TVec<u32, D>) -> TVec<f32, D> {
v.map(uint_bits_to_float_scalar) v.map(uint_bits_to_float_scalar)
} }

View File

@ -5,7 +5,7 @@ use crate::RealNumber;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`exp2`](fn.exp2.html) /// * [`exp2()`]
pub fn exp<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> { pub fn exp<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> {
v.map(|x| x.exp()) v.map(|x| x.exp())
} }
@ -14,7 +14,7 @@ pub fn exp<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`exp`](fn.exp.html) /// * [`exp()`]
pub fn exp2<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> { pub fn exp2<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> {
v.map(|x| x.exp2()) v.map(|x| x.exp2())
} }
@ -23,7 +23,7 @@ pub fn exp2<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`sqrt`](fn.sqrt.html) /// * [`sqrt()`]
pub fn inversesqrt<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> { pub fn inversesqrt<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> {
v.map(|x| T::one() / x.sqrt()) v.map(|x| T::one() / x.sqrt())
} }
@ -32,7 +32,7 @@ pub fn inversesqrt<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D>
/// ///
/// # See also: /// # See also:
/// ///
/// * [`log2`](fn.log2.html) /// * [`log2()`]
pub fn log<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> { pub fn log<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> {
v.map(|x| x.ln()) v.map(|x| x.ln())
} }
@ -41,7 +41,7 @@ pub fn log<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`log`](fn.log.html) /// * [`log()`]
pub fn log2<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> { pub fn log2<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> {
v.map(|x| x.log2()) v.map(|x| x.log2())
} }
@ -55,10 +55,10 @@ pub fn pow<T: RealNumber, const D: usize>(base: &TVec<T, D>, exponent: &TVec<T,
/// ///
/// # See also: /// # See also:
/// ///
/// * [`exp`](fn.exp.html) /// * [`exp()`]
/// * [`exp2`](fn.exp2.html) /// * [`exp2()`]
/// * [`inversesqrt`](fn.inversesqrt.html) /// * [`inversesqrt()`]
/// * [`pow`](fn.pow.html) /// * [`pow`]
pub fn sqrt<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> { pub fn sqrt<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> TVec<T, D> {
v.map(|x| x.sqrt()) v.map(|x| x.sqrt())
} }

View File

@ -39,11 +39,11 @@ pub fn pick_matrix<T: RealNumber>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`project_no`](fn.project_no.html) /// * [`project_no()`]
/// * [`project_zo`](fn.project_zo.html) /// * [`project_zo()`]
/// * [`unproject`](fn.unproject.html) /// * [`unproject()`]
/// * [`unproject_no`](fn.unproject_no.html) /// * [`unproject_no()`]
/// * [`unproject_zo`](fn.unproject_zo.html) /// * [`unproject_zo()`]
pub fn project<T: RealNumber>( pub fn project<T: RealNumber>(
obj: &TVec3<T>, obj: &TVec3<T>,
model: &TMat4<T>, model: &TMat4<T>,
@ -66,11 +66,11 @@ pub fn project<T: RealNumber>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`project`](fn.project.html) /// * [`project()`]
/// * [`project_zo`](fn.project_zo.html) /// * [`project_zo()`]
/// * [`unproject`](fn.unproject.html) /// * [`unproject()`]
/// * [`unproject_no`](fn.unproject_no.html) /// * [`unproject_no()`]
/// * [`unproject_zo`](fn.unproject_zo.html) /// * [`unproject_zo()`]
pub fn project_no<T: RealNumber>( pub fn project_no<T: RealNumber>(
obj: &TVec3<T>, obj: &TVec3<T>,
model: &TMat4<T>, model: &TMat4<T>,
@ -94,11 +94,11 @@ pub fn project_no<T: RealNumber>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`project`](fn.project.html) /// * [`project()`]
/// * [`project_no`](fn.project_no.html) /// * [`project_no()`]
/// * [`unproject`](fn.unproject.html) /// * [`unproject()`]
/// * [`unproject_no`](fn.unproject_no.html) /// * [`unproject_no()`]
/// * [`unproject_zo`](fn.unproject_zo.html) /// * [`unproject_zo()`]
pub fn project_zo<T: RealNumber>( pub fn project_zo<T: RealNumber>(
obj: &TVec3<T>, obj: &TVec3<T>,
model: &TMat4<T>, model: &TMat4<T>,
@ -127,11 +127,11 @@ pub fn project_zo<T: RealNumber>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`project`](fn.project.html) /// * [`project()`]
/// * [`project_no`](fn.project_no.html) /// * [`project_no()`]
/// * [`project_zo`](fn.project_zo.html) /// * [`project_zo()`]
/// * [`unproject_no`](fn.unproject_no.html) /// * [`unproject_no()`]
/// * [`unproject_zo`](fn.unproject_zo.html) /// * [`unproject_zo()`]
pub fn unproject<T: RealNumber>( pub fn unproject<T: RealNumber>(
win: &TVec3<T>, win: &TVec3<T>,
model: &TMat4<T>, model: &TMat4<T>,
@ -154,11 +154,11 @@ pub fn unproject<T: RealNumber>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`project`](fn.project.html) /// * [`project()`]
/// * [`project_no`](fn.project_no.html) /// * [`project_no()`]
/// * [`project_zo`](fn.project_zo.html) /// * [`project_zo()`]
/// * [`unproject`](fn.unproject.html) /// * [`unproject()`]
/// * [`unproject_zo`](fn.unproject_zo.html) /// * [`unproject_zo()`]
pub fn unproject_no<T: RealNumber>( pub fn unproject_no<T: RealNumber>(
win: &TVec3<T>, win: &TVec3<T>,
model: &TMat4<T>, model: &TMat4<T>,
@ -191,11 +191,11 @@ pub fn unproject_no<T: RealNumber>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`project`](fn.project.html) /// * [`project()`]
/// * [`project_no`](fn.project_no.html) /// * [`project_no()`]
/// * [`project_zo`](fn.project_zo.html) /// * [`project_zo()`]
/// * [`unproject`](fn.unproject.html) /// * [`unproject()`]
/// * [`unproject_no`](fn.unproject_no.html) /// * [`unproject_no()`]
pub fn unproject_zo<T: RealNumber>( pub fn unproject_zo<T: RealNumber>(
win: &TVec3<T>, win: &TVec3<T>,
model: &TMat4<T>, model: &TMat4<T>,

View File

@ -18,8 +18,8 @@ pub fn identity<T: Number, const D: usize>() -> TMat<T, D, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`look_at_lh`](fn.look_at_lh.html) /// * [`look_at_lh()`]
/// * [`look_at_rh`](fn.look_at_rh.html) /// * [`look_at_rh()`]
pub fn look_at<T: RealNumber>(eye: &TVec3<T>, center: &TVec3<T>, up: &TVec3<T>) -> TMat4<T> { pub fn look_at<T: RealNumber>(eye: &TVec3<T>, center: &TVec3<T>, up: &TVec3<T>) -> TMat4<T> {
look_at_rh(eye, center, up) look_at_rh(eye, center, up)
} }
@ -34,8 +34,8 @@ pub fn look_at<T: RealNumber>(eye: &TVec3<T>, center: &TVec3<T>, up: &TVec3<T>)
/// ///
/// # See also: /// # See also:
/// ///
/// * [`look_at`](fn.look_at.html) /// * [`look_at()`]
/// * [`look_at_rh`](fn.look_at_rh.html) /// * [`look_at_rh()`]
pub fn look_at_lh<T: RealNumber>(eye: &TVec3<T>, center: &TVec3<T>, up: &TVec3<T>) -> TMat4<T> { pub fn look_at_lh<T: RealNumber>(eye: &TVec3<T>, center: &TVec3<T>, up: &TVec3<T>) -> TMat4<T> {
TMat::look_at_lh(&Point3::from(*eye), &Point3::from(*center), up) TMat::look_at_lh(&Point3::from(*eye), &Point3::from(*center), up)
} }
@ -50,8 +50,8 @@ pub fn look_at_lh<T: RealNumber>(eye: &TVec3<T>, center: &TVec3<T>, up: &TVec3<T
/// ///
/// # See also: /// # See also:
/// ///
/// * [`look_at`](fn.look_at.html) /// * [`look_at()`]
/// * [`look_at_lh`](fn.look_at_lh.html) /// * [`look_at_lh()`]
pub fn look_at_rh<T: RealNumber>(eye: &TVec3<T>, center: &TVec3<T>, up: &TVec3<T>) -> TMat4<T> { pub fn look_at_rh<T: RealNumber>(eye: &TVec3<T>, center: &TVec3<T>, up: &TVec3<T>) -> TMat4<T> {
TMat::look_at_rh(&Point3::from(*eye), &Point3::from(*center), up) TMat::look_at_rh(&Point3::from(*eye), &Point3::from(*center), up)
} }
@ -66,11 +66,11 @@ pub fn look_at_rh<T: RealNumber>(eye: &TVec3<T>, center: &TVec3<T>, up: &TVec3<T
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotate_x`](fn.rotate_x.html) /// * [`rotate_x()`]
/// * [`rotate_y`](fn.rotate_y.html) /// * [`rotate_y()`]
/// * [`rotate_z`](fn.rotate_z.html) /// * [`rotate_z()`]
/// * [`scale`](fn.scale.html) /// * [`scale()`]
/// * [`translate`](fn.translate.html) /// * [`translate()`]
pub fn rotate<T: RealNumber>(m: &TMat4<T>, angle: T, axis: &TVec3<T>) -> TMat4<T> { pub fn rotate<T: RealNumber>(m: &TMat4<T>, angle: T, axis: &TVec3<T>) -> TMat4<T> {
m * Rotation3::from_axis_angle(&Unit::new_normalize(*axis), angle).to_homogeneous() m * Rotation3::from_axis_angle(&Unit::new_normalize(*axis), angle).to_homogeneous()
} }
@ -84,11 +84,11 @@ pub fn rotate<T: RealNumber>(m: &TMat4<T>, angle: T, axis: &TVec3<T>) -> TMat4<T
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotate`](fn.rotate.html) /// * [`rotate()`]
/// * [`rotate_y`](fn.rotate_y.html) /// * [`rotate_y()`]
/// * [`rotate_z`](fn.rotate_z.html) /// * [`rotate_z()`]
/// * [`scale`](fn.scale.html) /// * [`scale()`]
/// * [`translate`](fn.translate.html) /// * [`translate()`]
pub fn rotate_x<T: RealNumber>(m: &TMat4<T>, angle: T) -> TMat4<T> { pub fn rotate_x<T: RealNumber>(m: &TMat4<T>, angle: T) -> TMat4<T> {
rotate(m, angle, &TVec::x()) rotate(m, angle, &TVec::x())
} }
@ -102,11 +102,11 @@ pub fn rotate_x<T: RealNumber>(m: &TMat4<T>, angle: T) -> TMat4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotate`](fn.rotate.html) /// * [`rotate()`]
/// * [`rotate_x`](fn.rotate_x.html) /// * [`rotate_x()`]
/// * [`rotate_z`](fn.rotate_z.html) /// * [`rotate_z()`]
/// * [`scale`](fn.scale.html) /// * [`scale()`]
/// * [`translate`](fn.translate.html) /// * [`translate()`]
pub fn rotate_y<T: RealNumber>(m: &TMat4<T>, angle: T) -> TMat4<T> { pub fn rotate_y<T: RealNumber>(m: &TMat4<T>, angle: T) -> TMat4<T> {
rotate(m, angle, &TVec::y()) rotate(m, angle, &TVec::y())
} }
@ -120,11 +120,11 @@ pub fn rotate_y<T: RealNumber>(m: &TMat4<T>, angle: T) -> TMat4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotate`](fn.rotate.html) /// * [`rotate()`]
/// * [`rotate_x`](fn.rotate_x.html) /// * [`rotate_x()`]
/// * [`rotate_y`](fn.rotate_y.html) /// * [`rotate_y()`]
/// * [`scale`](fn.scale.html) /// * [`scale()`]
/// * [`translate`](fn.translate.html) /// * [`translate()`]
pub fn rotate_z<T: RealNumber>(m: &TMat4<T>, angle: T) -> TMat4<T> { pub fn rotate_z<T: RealNumber>(m: &TMat4<T>, angle: T) -> TMat4<T> {
rotate(m, angle, &TVec::z()) rotate(m, angle, &TVec::z())
} }
@ -138,11 +138,11 @@ pub fn rotate_z<T: RealNumber>(m: &TMat4<T>, angle: T) -> TMat4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotate`](fn.rotate.html) /// * [`rotate()`]
/// * [`rotate_x`](fn.rotate_x.html) /// * [`rotate_x()`]
/// * [`rotate_y`](fn.rotate_y.html) /// * [`rotate_y()`]
/// * [`rotate_z`](fn.rotate_z.html) /// * [`rotate_z()`]
/// * [`translate`](fn.translate.html) /// * [`translate()`]
pub fn scale<T: Number>(m: &TMat4<T>, v: &TVec3<T>) -> TMat4<T> { pub fn scale<T: Number>(m: &TMat4<T>, v: &TVec3<T>) -> TMat4<T> {
m.prepend_nonuniform_scaling(v) m.prepend_nonuniform_scaling(v)
} }
@ -156,11 +156,11 @@ pub fn scale<T: Number>(m: &TMat4<T>, v: &TVec3<T>) -> TMat4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotate`](fn.rotate.html) /// * [`rotate()`]
/// * [`rotate_x`](fn.rotate_x.html) /// * [`rotate_x()`]
/// * [`rotate_y`](fn.rotate_y.html) /// * [`rotate_y()`]
/// * [`rotate_z`](fn.rotate_z.html) /// * [`rotate_z()`]
/// * [`scale`](fn.scale.html) /// * [`scale()`]
pub fn translate<T: Number>(m: &TMat4<T>, v: &TVec3<T>) -> TMat4<T> { pub fn translate<T: Number>(m: &TMat4<T>, v: &TVec3<T>) -> TMat4<T> {
m.prepend_translation(v) m.prepend_translation(v)
} }

View File

@ -12,9 +12,9 @@ use crate::traits::Number;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`max4_scalar`](fn.max4_scalar.html) /// * [`max4_scalar()`]
/// * [`min3_scalar`](fn.min3_scalar.html) /// * [`min3_scalar()`]
/// * [`min4_scalar`](fn.min4_scalar.html) /// * [`min4_scalar()`]
pub fn max2_scalar<T: Number>(a: T, b: T) -> T { pub fn max2_scalar<T: Number>(a: T, b: T) -> T {
if a >= b { if a >= b {
a a
@ -35,9 +35,9 @@ pub fn max2_scalar<T: Number>(a: T, b: T) -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`max4_scalar`](fn.max4_scalar.html) /// * [`max4_scalar()`]
/// * [`min3_scalar`](fn.min3_scalar.html) /// * [`min3_scalar()`]
/// * [`min4_scalar`](fn.min4_scalar.html) /// * [`min4_scalar()`]
pub fn min2_scalar<T: Number>(a: T, b: T) -> T { pub fn min2_scalar<T: Number>(a: T, b: T) -> T {
if a <= b { if a <= b {
a a
@ -58,9 +58,9 @@ pub fn min2_scalar<T: Number>(a: T, b: T) -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`max4_scalar`](fn.max4_scalar.html) /// * [`max4_scalar()`]
/// * [`min3_scalar`](fn.min3_scalar.html) /// * [`min3_scalar()`]
/// * [`min4_scalar`](fn.min4_scalar.html) /// * [`min4_scalar()`]
pub fn max3_scalar<T: Number>(a: T, b: T, c: T) -> T { pub fn max3_scalar<T: Number>(a: T, b: T, c: T) -> T {
max2_scalar(max2_scalar(a, b), c) max2_scalar(max2_scalar(a, b), c)
} }
@ -77,9 +77,9 @@ pub fn max3_scalar<T: Number>(a: T, b: T, c: T) -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`max3_scalar`](fn.max3_scalar.html) /// * [`max3_scalar()`]
/// * [`min3_scalar`](fn.min3_scalar.html) /// * [`min3_scalar()`]
/// * [`min4_scalar`](fn.min4_scalar.html) /// * [`min4_scalar()`]
pub fn max4_scalar<T: Number>(a: T, b: T, c: T, d: T) -> T { pub fn max4_scalar<T: Number>(a: T, b: T, c: T, d: T) -> T {
max2_scalar(max2_scalar(a, b), max2_scalar(c, d)) max2_scalar(max2_scalar(a, b), max2_scalar(c, d))
} }
@ -96,9 +96,9 @@ pub fn max4_scalar<T: Number>(a: T, b: T, c: T, d: T) -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`max3_scalar`](fn.max3_scalar.html) /// * [`max3_scalar()`]
/// * [`max4_scalar`](fn.max4_scalar.html) /// * [`max4_scalar()`]
/// * [`min4_scalar`](fn.min4_scalar.html) /// * [`min4_scalar()`]
pub fn min3_scalar<T: Number>(a: T, b: T, c: T) -> T { pub fn min3_scalar<T: Number>(a: T, b: T, c: T) -> T {
min2_scalar(min2_scalar(a, b), c) min2_scalar(min2_scalar(a, b), c)
} }
@ -115,9 +115,9 @@ pub fn min3_scalar<T: Number>(a: T, b: T, c: T) -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`max3_scalar`](fn.max3_scalar.html) /// * [`max3_scalar()`]
/// * [`max4_scalar`](fn.max4_scalar.html) /// * [`max4_scalar()`]
/// * [`min3_scalar`](fn.min3_scalar.html) /// * [`min3_scalar()`]
pub fn min4_scalar<T: Number>(a: T, b: T, c: T, d: T) -> T { pub fn min4_scalar<T: Number>(a: T, b: T, c: T, d: T) -> T {
min2_scalar(min2_scalar(a, b), min2_scalar(c, d)) min2_scalar(min2_scalar(a, b), min2_scalar(c, d))
} }

View File

@ -10,18 +10,18 @@ pub fn epsilon<T: AbsDiffEq<Epsilon = T>>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`](crate::four_over_pi)
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`](crate::half_pi)
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`](crate::one_over_pi)
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`](crate::one_over_two_pi)
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`quarter_pi()`](crate::quarter_pi)
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`root_half_pi()`](crate::root_half_pi)
/// * [`root_pi`](fn.root_pi.html) /// * [`root_pi()`](crate::root_pi)
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_two_pi()`](crate::root_two_pi)
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`three_over_two_pi()`](crate::three_over_two_pi)
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`](crate::two_over_pi)
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`two_over_root_pi()`](crate::two_over_root_pi)
/// * [`two_pi`](fn.two_pi.html) /// * [`two_pi()`](crate::two_pi)
pub fn pi<T: RealNumber>() -> T { pub fn pi<T: RealNumber>() -> T {
T::pi() T::pi()
} }

View File

@ -5,15 +5,15 @@ use crate::traits::Number;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`](crate::comp_max)
/// * [`comp_min`](fn.comp_min.html) /// * [`comp_min()`](crate::comp_min)
/// * [`max2`](fn.max2.html) /// * [`max2()`]
/// * [`max3`](fn.max3.html) /// * [`max3()`]
/// * [`max4`](fn.max4.html) /// * [`max4()`]
/// * [`min`](fn.min.html) /// * [`min()`]
/// * [`min2`](fn.min2.html) /// * [`min2()`]
/// * [`min3`](fn.min3.html) /// * [`min3()`]
/// * [`min4`](fn.min4.html) /// * [`min4()`]
pub fn max<T: Number, const D: usize>(a: &TVec<T, D>, b: T) -> TVec<T, D> { pub fn max<T: Number, const D: usize>(a: &TVec<T, D>, b: T) -> TVec<T, D> {
a.map(|a| crate::max2_scalar(a, b)) a.map(|a| crate::max2_scalar(a, b))
} }
@ -22,15 +22,15 @@ pub fn max<T: Number, const D: usize>(a: &TVec<T, D>, b: T) -> TVec<T, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`](crate::comp_max)
/// * [`comp_min`](fn.comp_min.html) /// * [`comp_min()`](crate::comp_min)
/// * [`max`](fn.max.html) /// * [`max()`]
/// * [`max3`](fn.max3.html) /// * [`max3()`]
/// * [`max4`](fn.max4.html) /// * [`max4()`]
/// * [`min`](fn.min.html) /// * [`min()`]
/// * [`min2`](fn.min2.html) /// * [`min2()`]
/// * [`min3`](fn.min3.html) /// * [`min3()`]
/// * [`min4`](fn.min4.html) /// * [`min4()`]
pub fn max2<T: Number, const D: usize>(a: &TVec<T, D>, b: &TVec<T, D>) -> TVec<T, D> { pub fn max2<T: Number, const D: usize>(a: &TVec<T, D>, b: &TVec<T, D>) -> TVec<T, D> {
a.zip_map(b, |a, b| crate::max2_scalar(a, b)) a.zip_map(b, |a, b| crate::max2_scalar(a, b))
} }
@ -39,15 +39,15 @@ pub fn max2<T: Number, const D: usize>(a: &TVec<T, D>, b: &TVec<T, D>) -> TVec<T
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`](crate::comp_max)
/// * [`comp_min`](fn.comp_min.html) /// * [`comp_min()`](crate::comp_min)
/// * [`max`](fn.max.html) /// * [`max()`]
/// * [`max2`](fn.max2.html) /// * [`max2()`]
/// * [`max4`](fn.max4.html) /// * [`max4()`]
/// * [`min`](fn.min.html) /// * [`min()`]
/// * [`min2`](fn.min2.html) /// * [`min2()`]
/// * [`min3`](fn.min3.html) /// * [`min3()`]
/// * [`min4`](fn.min4.html) /// * [`min4()`]
pub fn max3<T: Number, const D: usize>( pub fn max3<T: Number, const D: usize>(
a: &TVec<T, D>, a: &TVec<T, D>,
b: &TVec<T, D>, b: &TVec<T, D>,
@ -60,15 +60,15 @@ pub fn max3<T: Number, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`](crate::comp_max)
/// * [`comp_min`](fn.comp_min.html) /// * [`comp_min()`](crate::comp_min)
/// * [`max`](fn.max.html) /// * [`max()`]
/// * [`max2`](fn.max2.html) /// * [`max2()`]
/// * [`max3`](fn.max3.html) /// * [`max3()`]
/// * [`min`](fn.min.html) /// * [`min()`]
/// * [`min2`](fn.min2.html) /// * [`min2()`]
/// * [`min3`](fn.min3.html) /// * [`min3()`]
/// * [`min4`](fn.min4.html) /// * [`min4()`]
pub fn max4<T: Number, const D: usize>( pub fn max4<T: Number, const D: usize>(
a: &TVec<T, D>, a: &TVec<T, D>,
b: &TVec<T, D>, b: &TVec<T, D>,
@ -82,15 +82,15 @@ pub fn max4<T: Number, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`](crate::comp_max)
/// * [`comp_min`](fn.comp_min.html) /// * [`comp_min()`](crate::comp_min)
/// * [`max`](fn.max.html) /// * [`max()`]
/// * [`max2`](fn.max2.html) /// * [`max2()`]
/// * [`max3`](fn.max3.html) /// * [`max3()`]
/// * [`max4`](fn.max4.html) /// * [`max4()`]
/// * [`min2`](fn.min2.html) /// * [`min2()`]
/// * [`min3`](fn.min3.html) /// * [`min3()`]
/// * [`min4`](fn.min4.html) /// * [`min4()`]
pub fn min<T: Number, const D: usize>(x: &TVec<T, D>, y: T) -> TVec<T, D> { pub fn min<T: Number, const D: usize>(x: &TVec<T, D>, y: T) -> TVec<T, D> {
x.map(|x| crate::min2_scalar(x, y)) x.map(|x| crate::min2_scalar(x, y))
} }
@ -99,15 +99,15 @@ pub fn min<T: Number, const D: usize>(x: &TVec<T, D>, y: T) -> TVec<T, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`](crate::comp_max)
/// * [`comp_min`](fn.comp_min.html) /// * [`comp_min()`](crate::comp_min)
/// * [`max`](fn.max.html) /// * [`max()`]
/// * [`max2`](fn.max2.html) /// * [`max2()`]
/// * [`max3`](fn.max3.html) /// * [`max3()`]
/// * [`max4`](fn.max4.html) /// * [`max4()`]
/// * [`min`](fn.min.html) /// * [`min()`]
/// * [`min3`](fn.min3.html) /// * [`min3()`]
/// * [`min4`](fn.min4.html) /// * [`min4()`]
pub fn min2<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<T, D> { pub fn min2<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<T, D> {
x.zip_map(y, |a, b| crate::min2_scalar(a, b)) x.zip_map(y, |a, b| crate::min2_scalar(a, b))
} }
@ -116,15 +116,15 @@ pub fn min2<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<T
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`](crate::comp_max)
/// * [`comp_min`](fn.comp_min.html) /// * [`comp_min()`](crate::comp_min)
/// * [`max`](fn.max.html) /// * [`max()`]
/// * [`max2`](fn.max2.html) /// * [`max2()`]
/// * [`max3`](fn.max3.html) /// * [`max3()`]
/// * [`max4`](fn.max4.html) /// * [`max4()`]
/// * [`min`](fn.min.html) /// * [`min()`]
/// * [`min2`](fn.min2.html) /// * [`min2()`]
/// * [`min4`](fn.min4.html) /// * [`min4()`]
pub fn min3<T: Number, const D: usize>( pub fn min3<T: Number, const D: usize>(
a: &TVec<T, D>, a: &TVec<T, D>,
b: &TVec<T, D>, b: &TVec<T, D>,
@ -137,15 +137,15 @@ pub fn min3<T: Number, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`](crate::comp_max)
/// * [`comp_min`](fn.comp_min.html) /// * [`comp_min()`](crate::comp_min)
/// * [`max`](fn.max.html) /// * [`max()`]
/// * [`max2`](fn.max2.html) /// * [`max2()`]
/// * [`max3`](fn.max3.html) /// * [`max3()`]
/// * [`max4`](fn.max4.html) /// * [`max4()`]
/// * [`min`](fn.min.html) /// * [`min()`]
/// * [`min2`](fn.min2.html) /// * [`min2()`]
/// * [`min3`](fn.min3.html) /// * [`min3()`]
pub fn min4<T: Number, const D: usize>( pub fn min4<T: Number, const D: usize>(
a: &TVec<T, D>, a: &TVec<T, D>,
b: &TVec<T, D>, b: &TVec<T, D>,

View File

@ -5,9 +5,9 @@ use crate::traits::Number;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`equal_eps_vec`](fn.equal_eps_vec.html) /// * [`equal_eps_vec()`]
/// * [`not_equal_eps`](fn.not_equal_eps.html) /// * [`not_equal_eps()`]
/// * [`not_equal_eps_vec`](fn.not_equal_eps_vec.html) /// * [`not_equal_eps_vec()`]
pub fn equal_eps<T: Number, const D: usize>( pub fn equal_eps<T: Number, const D: usize>(
x: &TVec<T, D>, x: &TVec<T, D>,
y: &TVec<T, D>, y: &TVec<T, D>,
@ -20,9 +20,9 @@ pub fn equal_eps<T: Number, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`equal_eps`](fn.equal_eps.html) /// * [`equal_eps()`]
/// * [`not_equal_eps`](fn.not_equal_eps.html) /// * [`not_equal_eps()`]
/// * [`not_equal_eps_vec`](fn.not_equal_eps_vec.html) /// * [`not_equal_eps_vec()`]
pub fn equal_eps_vec<T: Number, const D: usize>( pub fn equal_eps_vec<T: Number, const D: usize>(
x: &TVec<T, D>, x: &TVec<T, D>,
y: &TVec<T, D>, y: &TVec<T, D>,
@ -35,9 +35,9 @@ pub fn equal_eps_vec<T: Number, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`equal_eps`](fn.equal_eps.html) /// * [`equal_eps()`]
/// * [`equal_eps_vec`](fn.equal_eps_vec.html) /// * [`equal_eps_vec()`]
/// * [`not_equal_eps_vec`](fn.not_equal_eps_vec.html) /// * [`not_equal_eps_vec()`]
pub fn not_equal_eps<T: Number, const D: usize>( pub fn not_equal_eps<T: Number, const D: usize>(
x: &TVec<T, D>, x: &TVec<T, D>,
y: &TVec<T, D>, y: &TVec<T, D>,
@ -50,9 +50,9 @@ pub fn not_equal_eps<T: Number, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`equal_eps`](fn.equal_eps.html) /// * [`equal_eps()`]
/// * [`equal_eps_vec`](fn.equal_eps_vec.html) /// * [`equal_eps_vec()`]
/// * [`not_equal_eps`](fn.not_equal_eps.html) /// * [`not_equal_eps()`]
pub fn not_equal_eps_vec<T: Number, const D: usize>( pub fn not_equal_eps_vec<T: Number, const D: usize>(
x: &TVec<T, D>, x: &TVec<T, D>,
y: &TVec<T, D>, y: &TVec<T, D>,

View File

@ -12,7 +12,7 @@ pub fn cross<T: Number>(x: &TVec3<T>, y: &TVec3<T>) -> TVec3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`distance2`](fn.distance2.html) /// * [`distance2()`](crate::distance2)
pub fn distance<T: RealNumber, const D: usize>(p0: &TVec<T, D>, p1: &TVec<T, D>) -> T { pub fn distance<T: RealNumber, const D: usize>(p0: &TVec<T, D>, p1: &TVec<T, D>) -> T {
(p1 - p0).norm() (p1 - p0).norm()
} }
@ -37,13 +37,13 @@ pub fn faceforward<T: Number, const D: usize>(
/// The magnitude of a vector. /// The magnitude of a vector.
/// ///
/// A synonym for [`magnitude`](fn.magnitude.html). /// A synonym for [`magnitude()`].
/// ///
/// # See also: /// # See also:
/// ///
/// * [`length2`](fn.length2.html) /// * [`length2()`](crate::length2)
/// * [`magnitude`](fn.magnitude.html) /// * [`magnitude()`]
/// * [`magnitude2`](fn.magnitude2.html) /// * [`magnitude2()`](crate::magnitude2)
pub fn length<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T { pub fn length<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T {
x.norm() x.norm()
} }
@ -54,8 +54,8 @@ pub fn length<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`length`](fn.length.html) /// * [`length()`]
/// * [`magnitude2`](fn.magnitude2.html) /// * [`magnitude2()`](crate::magnitude2)
/// * [`nalgebra::norm`](../nalgebra/fn.norm.html) /// * [`nalgebra::norm`](../nalgebra/fn.norm.html)
pub fn magnitude<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T { pub fn magnitude<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T {
x.norm() x.norm()

View File

@ -2,7 +2,7 @@ use crate::RealNumber;
/// The Euler constant. /// The Euler constant.
/// ///
/// This is a shorthand alias for [`euler`](fn.euler.html). /// This is a shorthand alias for [`euler()`].
pub fn e<T: RealNumber>() -> T { pub fn e<T: RealNumber>() -> T {
T::e() T::e()
} }
@ -16,18 +16,18 @@ pub fn euler<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`]
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`]
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`]
/// * [`pi`](fn.pi.html) /// * [`pi()`](crate::pi)
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`quarter_pi()`]
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`root_half_pi()`]
/// * [`root_pi`](fn.root_pi.html) /// * [`root_pi()`]
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_two_pi()`]
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`three_over_two_pi()`]
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`]
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`two_over_root_pi()`]
/// * [`two_pi`](fn.two_pi.html) /// * [`two_pi()`]
pub fn four_over_pi<T: RealNumber>() -> T { pub fn four_over_pi<T: RealNumber>() -> T {
na::convert::<_, T>(4.0) / T::pi() na::convert::<_, T>(4.0) / T::pi()
} }
@ -41,18 +41,18 @@ pub fn golden_ratio<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`]
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`]
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`]
/// * [`pi`](fn.pi.html) /// * [`pi()`](crate::pi)
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`quarter_pi()`]
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`root_half_pi()`]
/// * [`root_pi`](fn.root_pi.html) /// * [`root_pi()`]
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_two_pi()`]
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`three_over_two_pi()`]
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`]
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`two_over_root_pi()`]
/// * [`two_pi`](fn.two_pi.html) /// * [`two_pi()`]
pub fn half_pi<T: RealNumber>() -> T { pub fn half_pi<T: RealNumber>() -> T {
T::frac_pi_2() T::frac_pi_2()
} }
@ -61,8 +61,8 @@ pub fn half_pi<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`ln_ten`](fn.ln_ten.html) /// * [`ln_ten()`]
/// * [`ln_two`](fn.ln_two.html) /// * [`ln_two()`]
pub fn ln_ln_two<T: RealNumber>() -> T { pub fn ln_ln_two<T: RealNumber>() -> T {
T::ln_2().ln() T::ln_2().ln()
} }
@ -71,8 +71,8 @@ pub fn ln_ln_two<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`ln_ln_two`](fn.ln_ln_two.html) /// * [`ln_ln_two()`]
/// * [`ln_two`](fn.ln_two.html) /// * [`ln_two()`]
pub fn ln_ten<T: RealNumber>() -> T { pub fn ln_ten<T: RealNumber>() -> T {
T::ln_10() T::ln_10()
} }
@ -81,8 +81,8 @@ pub fn ln_ten<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`ln_ln_two`](fn.ln_ln_two.html) /// * [`ln_ln_two()`]
/// * [`ln_ten`](fn.ln_ten.html) /// * [`ln_ten()`]
pub fn ln_two<T: RealNumber>() -> T { pub fn ln_two<T: RealNumber>() -> T {
T::ln_2() T::ln_2()
} }
@ -94,18 +94,18 @@ pub use na::one;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`]
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`]
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`]
/// * [`pi`](fn.pi.html) /// * [`pi()`](crate::pi)
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`quarter_pi()`]
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`root_half_pi()`]
/// * [`root_pi`](fn.root_pi.html) /// * [`root_pi()`]
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_two_pi()`]
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`three_over_two_pi()`]
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`]
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`two_over_root_pi()`]
/// * [`two_pi`](fn.two_pi.html) /// * [`two_pi()`]
pub fn one_over_pi<T: RealNumber>() -> T { pub fn one_over_pi<T: RealNumber>() -> T {
T::frac_1_pi() T::frac_1_pi()
} }
@ -119,18 +119,18 @@ pub fn one_over_root_two<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`]
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`]
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`]
/// * [`pi`](fn.pi.html) /// * [`pi()`](crate::pi)
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`quarter_pi()`]
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`root_half_pi()`]
/// * [`root_pi`](fn.root_pi.html) /// * [`root_pi()`]
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_two_pi()`]
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`three_over_two_pi()`]
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`]
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`two_over_root_pi()`]
/// * [`two_pi`](fn.two_pi.html) /// * [`two_pi()`]
pub fn one_over_two_pi<T: RealNumber>() -> T { pub fn one_over_two_pi<T: RealNumber>() -> T {
T::frac_1_pi() * na::convert(0.5) T::frac_1_pi() * na::convert(0.5)
} }
@ -139,18 +139,18 @@ pub fn one_over_two_pi<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`]
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`]
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`]
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`]
/// * [`pi`](fn.pi.html) /// * [`pi()`](crate::pi)
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`root_half_pi()`]
/// * [`root_pi`](fn.root_pi.html) /// * [`root_pi()`]
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_two_pi()`]
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`three_over_two_pi()`]
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`]
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`two_over_root_pi()`]
/// * [`two_pi`](fn.two_pi.html) /// * [`two_pi()`]
pub fn quarter_pi<T: RealNumber>() -> T { pub fn quarter_pi<T: RealNumber>() -> T {
T::frac_pi_4() T::frac_pi_4()
} }
@ -159,8 +159,8 @@ pub fn quarter_pi<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`root_three`](fn.root_three.html) /// * [`root_three()`]
/// * [`root_two`](fn.root_two.html) /// * [`root_two()`]
pub fn root_five<T: RealNumber>() -> T { pub fn root_five<T: RealNumber>() -> T {
na::convert::<_, T>(5.0).sqrt() na::convert::<_, T>(5.0).sqrt()
} }
@ -169,18 +169,18 @@ pub fn root_five<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`]
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`]
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`]
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`]
/// * [`pi`](fn.pi.html) /// * [`pi()`](crate::pi)
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`quarter_pi()`]
/// * [`root_pi`](fn.root_pi.html) /// * [`root_pi()`]
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_two_pi()`]
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`three_over_two_pi()`]
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`]
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`two_over_root_pi()`]
/// * [`two_pi`](fn.two_pi.html) /// * [`two_pi()`]
pub fn root_half_pi<T: RealNumber>() -> T { pub fn root_half_pi<T: RealNumber>() -> T {
(T::pi() / na::convert(2.0)).sqrt() (T::pi() / na::convert(2.0)).sqrt()
} }
@ -194,18 +194,18 @@ pub fn root_ln_four<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`]
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`]
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`]
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`]
/// * [`pi`](fn.pi.html) /// * [`pi()`](crate::pi)
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`quarter_pi()`]
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`root_half_pi()`]
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_two_pi()`]
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`three_over_two_pi()`]
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`]
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`two_over_root_pi()`]
/// * [`two_pi`](fn.two_pi.html) /// * [`two_pi()`]
pub fn root_pi<T: RealNumber>() -> T { pub fn root_pi<T: RealNumber>() -> T {
T::pi().sqrt() T::pi().sqrt()
} }
@ -214,8 +214,8 @@ pub fn root_pi<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`root_five`](fn.root_five.html) /// * [`root_five()`]
/// * [`root_two`](fn.root_two.html) /// * [`root_two()`]
pub fn root_three<T: RealNumber>() -> T { pub fn root_three<T: RealNumber>() -> T {
na::convert::<_, T>(3.0).sqrt() na::convert::<_, T>(3.0).sqrt()
} }
@ -224,8 +224,8 @@ pub fn root_three<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`root_five`](fn.root_five.html) /// * [`root_five()`]
/// * [`root_three`](fn.root_three.html) /// * [`root_three()`]
pub fn root_two<T: RealNumber>() -> T { pub fn root_two<T: RealNumber>() -> T {
// TODO: there should be a crate::sqrt_2() on the RealNumber trait. // TODO: there should be a crate::sqrt_2() on the RealNumber trait.
na::convert::<_, T>(2.0).sqrt() na::convert::<_, T>(2.0).sqrt()
@ -235,18 +235,18 @@ pub fn root_two<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`]
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`]
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`]
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`]
/// * [`pi`](fn.pi.html) /// * [`pi()`](crate::pi)
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`quarter_pi()`]
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`root_half_pi()`]
/// * [`root_pi`](fn.root_pi.html) /// * [`root_pi()`]
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`three_over_two_pi()`]
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`]
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`two_over_root_pi()`]
/// * [`two_pi`](fn.two_pi.html) /// * [`two_pi()`]
pub fn root_two_pi<T: RealNumber>() -> T { pub fn root_two_pi<T: RealNumber>() -> T {
T::two_pi().sqrt() T::two_pi().sqrt()
} }
@ -255,7 +255,7 @@ pub fn root_two_pi<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`two_thirds`](fn.two_thirds.html) /// * [`two_thirds()`]
pub fn third<T: RealNumber>() -> T { pub fn third<T: RealNumber>() -> T {
na::convert(1.0 / 3.0) na::convert(1.0 / 3.0)
} }
@ -264,18 +264,18 @@ pub fn third<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`]
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`]
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`]
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`]
/// * [`pi`](fn.pi.html) /// * [`pi()`](crate::pi)
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`quarter_pi()`]
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`root_half_pi()`]
/// * [`root_pi`](fn.root_pi.html) /// * [`root_pi()`]
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_two_pi()`]
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`]
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`two_over_root_pi()`]
/// * [`two_pi`](fn.two_pi.html) /// * [`two_pi()`]
pub fn three_over_two_pi<T: RealNumber>() -> T { pub fn three_over_two_pi<T: RealNumber>() -> T {
na::convert::<_, T>(3.0) / T::two_pi() na::convert::<_, T>(3.0) / T::two_pi()
} }
@ -284,17 +284,18 @@ pub fn three_over_two_pi<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`]
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`]
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`]
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`]
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`pi()`](crate::pi)
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`quarter_pi()`]
/// * [`root_pi`](fn.root_pi.html) /// * [`root_half_pi()`]
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_pi()`]
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`root_two_pi()`]
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`three_over_two_pi()`]
/// * [`two_pi`](fn.two_pi.html) /// * [`two_over_root_pi()`]
/// * [`two_pi()`]
pub fn two_over_pi<T: RealNumber>() -> T { pub fn two_over_pi<T: RealNumber>() -> T {
T::frac_2_pi() T::frac_2_pi()
} }
@ -303,18 +304,18 @@ pub fn two_over_pi<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`]
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`]
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`]
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`]
/// * [`pi`](fn.pi.html) /// * [`pi()`](crate::pi)
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`quarter_pi()`]
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`root_half_pi()`]
/// * [`root_pi`](fn.root_pi.html) /// * [`root_pi()`]
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_two_pi()`]
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`three_over_two_pi()`]
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`]
/// * [`two_pi`](fn.two_pi.html) /// * [`two_pi()`]
pub fn two_over_root_pi<T: RealNumber>() -> T { pub fn two_over_root_pi<T: RealNumber>() -> T {
T::frac_2_sqrt_pi() T::frac_2_sqrt_pi()
} }
@ -323,18 +324,18 @@ pub fn two_over_root_pi<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`four_over_pi`](fn.four_over_pi.html) /// * [`four_over_pi()`]
/// * [`half_pi`](fn.half_pi.html) /// * [`half_pi()`]
/// * [`one_over_pi`](fn.one_over_pi.html) /// * [`one_over_pi()`]
/// * [`one_over_two_pi`](fn.one_over_two_pi.html) /// * [`one_over_two_pi()`]
/// * [`pi`](fn.pi.html) /// * [`pi()`](crate::pi)
/// * [`quarter_pi`](fn.quarter_pi.html) /// * [`quarter_pi()`]
/// * [`root_half_pi`](fn.root_half_pi.html) /// * [`root_half_pi()`]
/// * [`root_pi`](fn.root_pi.html) /// * [`root_pi()`]
/// * [`root_two_pi`](fn.root_two_pi.html) /// * [`root_two_pi()`]
/// * [`three_over_two_pi`](fn.three_over_two_pi.html) /// * [`three_over_two_pi()`]
/// * [`two_over_pi`](fn.two_over_pi.html) /// * [`two_over_pi()`]
/// * [`two_over_root_pi`](fn.two_over_root_pi.html) /// * [`two_over_root_pi()`]
pub fn two_pi<T: RealNumber>() -> T { pub fn two_pi<T: RealNumber>() -> T {
T::two_pi() T::two_pi()
} }
@ -343,7 +344,7 @@ pub fn two_pi<T: RealNumber>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`third`](fn.third.html) /// * [`third()`]
pub fn two_thirds<T: RealNumber>() -> T { pub fn two_thirds<T: RealNumber>() -> T {
na::convert(2.0 / 3.0) na::convert(2.0 / 3.0)
} }

View File

@ -6,9 +6,9 @@ use crate::aliases::{TMat, TVec};
/// ///
/// # See also: /// # See also:
/// ///
/// * [`row`](fn.row.html) /// * [`row()`]
/// * [`set_column`](fn.set_column.html) /// * [`set_column()`]
/// * [`set_row`](fn.set_row.html) /// * [`set_row()`]
pub fn column<T: Scalar, const R: usize, const C: usize>( pub fn column<T: Scalar, const R: usize, const C: usize>(
m: &TMat<T, R, C>, m: &TMat<T, R, C>,
index: usize, index: usize,
@ -20,9 +20,9 @@ pub fn column<T: Scalar, const R: usize, const C: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`column`](fn.column.html) /// * [`column()`]
/// * [`row`](fn.row.html) /// * [`row()`]
/// * [`set_row`](fn.set_row.html) /// * [`set_row()`]
pub fn set_column<T: Scalar, const R: usize, const C: usize>( pub fn set_column<T: Scalar, const R: usize, const C: usize>(
m: &TMat<T, R, C>, m: &TMat<T, R, C>,
index: usize, index: usize,
@ -37,9 +37,9 @@ pub fn set_column<T: Scalar, const R: usize, const C: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`column`](fn.column.html) /// * [`column()`]
/// * [`set_column`](fn.set_column.html) /// * [`set_column()`]
/// * [`set_row`](fn.set_row.html) /// * [`set_row()`]
pub fn row<T: Scalar, const R: usize, const C: usize>( pub fn row<T: Scalar, const R: usize, const C: usize>(
m: &TMat<T, R, C>, m: &TMat<T, R, C>,
index: usize, index: usize,
@ -51,9 +51,9 @@ pub fn row<T: Scalar, const R: usize, const C: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`column`](fn.column.html) /// * [`column()`]
/// * [`row`](fn.row.html) /// * [`row()`]
/// * [`set_column`](fn.set_column.html) /// * [`set_column()`]
pub fn set_row<T: Scalar, const R: usize, const C: usize>( pub fn set_row<T: Scalar, const R: usize, const C: usize>(
m: &TMat<T, R, C>, m: &TMat<T, R, C>,
index: usize, index: usize,

View File

@ -128,9 +128,9 @@ pub fn make_quat<T: RealNumber>(ptr: &[T]) -> Qua<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`make_vec2`](fn.make_vec2.html) /// * [`make_vec2()`]
/// * [`make_vec3`](fn.make_vec3.html) /// * [`make_vec3()`]
/// * [`make_vec4`](fn.make_vec4.html) /// * [`make_vec4()`]
pub fn make_vec1<T: Scalar>(v: &TVec1<T>) -> TVec1<T> { pub fn make_vec1<T: Scalar>(v: &TVec1<T>) -> TVec1<T> {
v.clone() v.clone()
} }
@ -139,12 +139,11 @@ pub fn make_vec1<T: Scalar>(v: &TVec1<T>) -> TVec1<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec1`](fn.vec1_to_vec1.html) /// * [`vec3_to_vec1()`]
/// * [`vec3_to_vec1`](fn.vec3_to_vec1.html) /// * [`vec4_to_vec1()`]
/// * [`vec4_to_vec1`](fn.vec4_to_vec1.html) /// * [`vec1_to_vec2()`]
/// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec3()`]
/// * [`vec1_to_vec3`](fn.vec1_to_vec3.html) /// * [`vec1_to_vec4()`]
/// * [`vec1_to_vec4`](fn.vec1_to_vec4.html)
pub fn vec2_to_vec1<T: Scalar>(v: &TVec2<T>) -> TVec1<T> { pub fn vec2_to_vec1<T: Scalar>(v: &TVec2<T>) -> TVec1<T> {
TVec1::new(v.x.clone()) TVec1::new(v.x.clone())
} }
@ -153,12 +152,11 @@ pub fn vec2_to_vec1<T: Scalar>(v: &TVec2<T>) -> TVec1<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec1`](fn.vec1_to_vec1.html) /// * [`vec2_to_vec1()`]
/// * [`vec2_to_vec1`](fn.vec2_to_vec1.html) /// * [`vec4_to_vec1()`]
/// * [`vec4_to_vec1`](fn.vec4_to_vec1.html) /// * [`vec1_to_vec2()`]
/// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec3()`]
/// * [`vec1_to_vec3`](fn.vec1_to_vec3.html) /// * [`vec1_to_vec4()`]
/// * [`vec1_to_vec4`](fn.vec1_to_vec4.html)
pub fn vec3_to_vec1<T: Scalar>(v: &TVec3<T>) -> TVec1<T> { pub fn vec3_to_vec1<T: Scalar>(v: &TVec3<T>) -> TVec1<T> {
TVec1::new(v.x.clone()) TVec1::new(v.x.clone())
} }
@ -167,12 +165,11 @@ pub fn vec3_to_vec1<T: Scalar>(v: &TVec3<T>) -> TVec1<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec1`](fn.vec1_to_vec1.html) /// * [`vec2_to_vec1()`]
/// * [`vec2_to_vec1`](fn.vec2_to_vec1.html) /// * [`vec3_to_vec1()`]
/// * [`vec3_to_vec1`](fn.vec3_to_vec1.html) /// * [`vec1_to_vec2()`]
/// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec3()`]
/// * [`vec1_to_vec3`](fn.vec1_to_vec3.html) /// * [`vec1_to_vec4()`]
/// * [`vec1_to_vec4`](fn.vec1_to_vec4.html)
pub fn vec4_to_vec1<T: Scalar>(v: &TVec4<T>) -> TVec1<T> { pub fn vec4_to_vec1<T: Scalar>(v: &TVec4<T>) -> TVec1<T> {
TVec1::new(v.x.clone()) TVec1::new(v.x.clone())
} }
@ -183,12 +180,12 @@ pub fn vec4_to_vec1<T: Scalar>(v: &TVec4<T>) -> TVec1<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec3_to_vec2`](fn.vec3_to_vec2.html) /// * [`vec3_to_vec2()`]
/// * [`vec4_to_vec2`](fn.vec4_to_vec2.html) /// * [`vec4_to_vec2()`]
/// * [`vec2_to_vec1`](fn.vec2_to_vec1.html) /// * [`vec2_to_vec1()`]
/// * [`vec2_to_vec2`](fn.vec2_to_vec2.html) /// * [`vec2_to_vec2()`]
/// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec3()`]
/// * [`vec2_to_vec4`](fn.vec2_to_vec4.html) /// * [`vec2_to_vec4()`]
pub fn vec1_to_vec2<T: Number>(v: &TVec1<T>) -> TVec2<T> { pub fn vec1_to_vec2<T: Number>(v: &TVec1<T>) -> TVec2<T> {
TVec2::new(v.x.clone(), T::zero()) TVec2::new(v.x.clone(), T::zero())
} }
@ -197,13 +194,13 @@ pub fn vec1_to_vec2<T: Number>(v: &TVec1<T>) -> TVec2<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec2()`]
/// * [`vec3_to_vec2`](fn.vec3_to_vec2.html) /// * [`vec3_to_vec2()`]
/// * [`vec4_to_vec2`](fn.vec4_to_vec2.html) /// * [`vec4_to_vec2()`]
/// * [`vec2_to_vec1`](fn.vec2_to_vec1.html) /// * [`vec2_to_vec1()`]
/// * [`vec2_to_vec2`](fn.vec2_to_vec2.html) /// * [`vec2_to_vec2()`]
/// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec3()`]
/// * [`vec2_to_vec4`](fn.vec2_to_vec4.html) /// * [`vec2_to_vec4()`]
pub fn vec2_to_vec2<T: Scalar>(v: &TVec2<T>) -> TVec2<T> { pub fn vec2_to_vec2<T: Scalar>(v: &TVec2<T>) -> TVec2<T> {
v.clone() v.clone()
} }
@ -212,12 +209,12 @@ pub fn vec2_to_vec2<T: Scalar>(v: &TVec2<T>) -> TVec2<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec2()`]
/// * [`vec4_to_vec2`](fn.vec4_to_vec2.html) /// * [`vec4_to_vec2()`]
/// * [`vec2_to_vec1`](fn.vec2_to_vec1.html) /// * [`vec2_to_vec1()`]
/// * [`vec2_to_vec2`](fn.vec2_to_vec2.html) /// * [`vec2_to_vec2()`]
/// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec3()`]
/// * [`vec2_to_vec4`](fn.vec2_to_vec4.html) /// * [`vec2_to_vec4()`]
pub fn vec3_to_vec2<T: Scalar>(v: &TVec3<T>) -> TVec2<T> { pub fn vec3_to_vec2<T: Scalar>(v: &TVec3<T>) -> TVec2<T> {
TVec2::new(v.x.clone(), v.y.clone()) TVec2::new(v.x.clone(), v.y.clone())
} }
@ -226,12 +223,12 @@ pub fn vec3_to_vec2<T: Scalar>(v: &TVec3<T>) -> TVec2<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec2()`]
/// * [`vec3_to_vec2`](fn.vec4_to_vec2.html) /// * [`vec3_to_vec2()`]
/// * [`vec2_to_vec1`](fn.vec2_to_vec1.html) /// * [`vec2_to_vec1()`]
/// * [`vec2_to_vec2`](fn.vec2_to_vec2.html) /// * [`vec2_to_vec2()`]
/// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec3()`]
/// * [`vec2_to_vec4`](fn.vec2_to_vec4.html) /// * [`vec2_to_vec4()`]
pub fn vec4_to_vec2<T: Scalar>(v: &TVec4<T>) -> TVec2<T> { pub fn vec4_to_vec2<T: Scalar>(v: &TVec4<T>) -> TVec2<T> {
TVec2::new(v.x.clone(), v.y.clone()) TVec2::new(v.x.clone(), v.y.clone())
} }
@ -240,9 +237,9 @@ pub fn vec4_to_vec2<T: Scalar>(v: &TVec4<T>) -> TVec2<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`make_vec1`](fn.make_vec1.html) /// * [`make_vec1()`]
/// * [`make_vec3`](fn.make_vec3.html) /// * [`make_vec3()`]
/// * [`make_vec4`](fn.make_vec4.html) /// * [`make_vec4()`]
pub fn make_vec2<T: Scalar>(ptr: &[T]) -> TVec2<T> { pub fn make_vec2<T: Scalar>(ptr: &[T]) -> TVec2<T> {
TVec2::from_column_slice(ptr) TVec2::from_column_slice(ptr)
} }
@ -253,11 +250,11 @@ pub fn make_vec2<T: Scalar>(ptr: &[T]) -> TVec2<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec3()`]
/// * [`vec3_to_vec3`](fn.vec3_to_vec3.html) /// * [`vec3_to_vec3()`]
/// * [`vec4_to_vec3`](fn.vec4_to_vec3.html) /// * [`vec4_to_vec3()`]
/// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec2()`]
/// * [`vec1_to_vec4`](fn.vec1_to_vec4.html) /// * [`vec1_to_vec4()`]
pub fn vec1_to_vec3<T: Number>(v: &TVec1<T>) -> TVec3<T> { pub fn vec1_to_vec3<T: Number>(v: &TVec1<T>) -> TVec3<T> {
TVec3::new(v.x.clone(), T::zero(), T::zero()) TVec3::new(v.x.clone(), T::zero(), T::zero())
} }
@ -268,12 +265,12 @@ pub fn vec1_to_vec3<T: Number>(v: &TVec1<T>) -> TVec3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec3`](fn.vec1_to_vec3.html) /// * [`vec1_to_vec3()`]
/// * [`vec3_to_vec3`](fn.vec3_to_vec3.html) /// * [`vec3_to_vec3()`]
/// * [`vec4_to_vec3`](fn.vec4_to_vec3.html) /// * [`vec4_to_vec3()`]
/// * [`vec3_to_vec1`](fn.vec3_to_vec1.html) /// * [`vec3_to_vec1()`]
/// * [`vec3_to_vec2`](fn.vec3_to_vec2.html) /// * [`vec3_to_vec2()`]
/// * [`vec3_to_vec4`](fn.vec3_to_vec4.html) /// * [`vec3_to_vec4()`]
pub fn vec2_to_vec3<T: Number>(v: &TVec2<T>) -> TVec3<T> { pub fn vec2_to_vec3<T: Number>(v: &TVec2<T>) -> TVec3<T> {
TVec3::new(v.x.clone(), v.y.clone(), T::zero()) TVec3::new(v.x.clone(), v.y.clone(), T::zero())
} }
@ -282,12 +279,12 @@ pub fn vec2_to_vec3<T: Number>(v: &TVec2<T>) -> TVec3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec3`](fn.vec1_to_vec3.html) /// * [`vec1_to_vec3()`]
/// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec3()`]
/// * [`vec4_to_vec3`](fn.vec4_to_vec3.html) /// * [`vec4_to_vec3()`]
/// * [`vec3_to_vec1`](fn.vec3_to_vec1.html) /// * [`vec3_to_vec1()`]
/// * [`vec3_to_vec2`](fn.vec3_to_vec2.html) /// * [`vec3_to_vec2()`]
/// * [`vec3_to_vec4`](fn.vec3_to_vec4.html) /// * [`vec3_to_vec4()`]
pub fn vec3_to_vec3<T: Scalar>(v: &TVec3<T>) -> TVec3<T> { pub fn vec3_to_vec3<T: Scalar>(v: &TVec3<T>) -> TVec3<T> {
v.clone() v.clone()
} }
@ -296,12 +293,12 @@ pub fn vec3_to_vec3<T: Scalar>(v: &TVec3<T>) -> TVec3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec3`](fn.vec1_to_vec3.html) /// * [`vec1_to_vec3()`]
/// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec3()`]
/// * [`vec3_to_vec3`](fn.vec3_to_vec3.html) /// * [`vec3_to_vec3()`]
/// * [`vec3_to_vec1`](fn.vec3_to_vec1.html) /// * [`vec3_to_vec1()`]
/// * [`vec3_to_vec2`](fn.vec3_to_vec2.html) /// * [`vec3_to_vec2()`]
/// * [`vec3_to_vec4`](fn.vec3_to_vec4.html) /// * [`vec3_to_vec4()`]
pub fn vec4_to_vec3<T: Scalar>(v: &TVec4<T>) -> TVec3<T> { pub fn vec4_to_vec3<T: Scalar>(v: &TVec4<T>) -> TVec3<T> {
TVec3::new(v.x.clone(), v.y.clone(), v.z.clone()) TVec3::new(v.x.clone(), v.y.clone(), v.z.clone())
} }
@ -310,9 +307,9 @@ pub fn vec4_to_vec3<T: Scalar>(v: &TVec4<T>) -> TVec3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`make_vec1`](fn.make_vec1.html) /// * [`make_vec1()`]
/// * [`make_vec2`](fn.make_vec2.html) /// * [`make_vec2()`]
/// * [`make_vec4`](fn.make_vec4.html) /// * [`make_vec4()`]
pub fn make_vec3<T: Scalar>(ptr: &[T]) -> TVec3<T> { pub fn make_vec3<T: Scalar>(ptr: &[T]) -> TVec3<T> {
TVec3::from_column_slice(ptr) TVec3::from_column_slice(ptr)
} }
@ -323,12 +320,12 @@ pub fn make_vec3<T: Scalar>(ptr: &[T]) -> TVec3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec2_to_vec4`](fn.vec2_to_vec4.html) /// * [`vec2_to_vec4()`]
/// * [`vec3_to_vec4`](fn.vec3_to_vec4.html) /// * [`vec3_to_vec4()`]
/// * [`vec4_to_vec4`](fn.vec4_to_vec4.html) /// * [`vec4_to_vec4()`]
/// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec2()`]
/// * [`vec1_to_vec3`](fn.vec1_to_vec3.html) /// * [`vec1_to_vec3()`]
/// * [`vec1_to_vec4`](fn.vec1_to_vec4.html) /// * [`vec1_to_vec4()`]
pub fn vec1_to_vec4<T: Number>(v: &TVec1<T>) -> TVec4<T> { pub fn vec1_to_vec4<T: Number>(v: &TVec1<T>) -> TVec4<T> {
TVec4::new(v.x, T::zero(), T::zero(), T::zero()) TVec4::new(v.x, T::zero(), T::zero(), T::zero())
} }
@ -339,12 +336,12 @@ pub fn vec1_to_vec4<T: Number>(v: &TVec1<T>) -> TVec4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec4`](fn.vec1_to_vec4.html) /// * [`vec1_to_vec4()`]
/// * [`vec3_to_vec4`](fn.vec3_to_vec4.html) /// * [`vec3_to_vec4()`]
/// * [`vec4_to_vec4`](fn.vec4_to_vec4.html) /// * [`vec4_to_vec4()`]
/// * [`vec2_to_vec1`](fn.vec2_to_vec1.html) /// * [`vec2_to_vec1()`]
/// * [`vec2_to_vec2`](fn.vec2_to_vec2.html) /// * [`vec2_to_vec2()`]
/// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec3()`]
pub fn vec2_to_vec4<T: Number>(v: &TVec2<T>) -> TVec4<T> { pub fn vec2_to_vec4<T: Number>(v: &TVec2<T>) -> TVec4<T> {
TVec4::new(v.x, v.y, T::zero(), T::zero()) TVec4::new(v.x, v.y, T::zero(), T::zero())
} }
@ -355,12 +352,12 @@ pub fn vec2_to_vec4<T: Number>(v: &TVec2<T>) -> TVec4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec4`](fn.vec1_to_vec4.html) /// * [`vec1_to_vec4()`]
/// * [`vec2_to_vec4`](fn.vec2_to_vec4.html) /// * [`vec2_to_vec4()`]
/// * [`vec4_to_vec4`](fn.vec4_to_vec4.html) /// * [`vec4_to_vec4()`]
/// * [`vec3_to_vec1`](fn.vec3_to_vec1.html) /// * [`vec3_to_vec1()`]
/// * [`vec3_to_vec2`](fn.vec3_to_vec2.html) /// * [`vec3_to_vec2()`]
/// * [`vec3_to_vec3`](fn.vec3_to_vec3.html) /// * [`vec3_to_vec3()`]
pub fn vec3_to_vec4<T: Number>(v: &TVec3<T>) -> TVec4<T> { pub fn vec3_to_vec4<T: Number>(v: &TVec3<T>) -> TVec4<T> {
TVec4::new(v.x, v.y, v.z, T::zero()) TVec4::new(v.x, v.y, v.z, T::zero())
} }
@ -369,12 +366,12 @@ pub fn vec3_to_vec4<T: Number>(v: &TVec3<T>) -> TVec4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`vec1_to_vec4`](fn.vec1_to_vec4.html) /// * [`vec1_to_vec4()`]
/// * [`vec2_to_vec4`](fn.vec2_to_vec4.html) /// * [`vec2_to_vec4()`]
/// * [`vec3_to_vec4`](fn.vec3_to_vec4.html) /// * [`vec3_to_vec4()`]
/// * [`vec4_to_vec1`](fn.vec4_to_vec1.html) /// * [`vec4_to_vec1()`]
/// * [`vec4_to_vec2`](fn.vec4_to_vec2.html) /// * [`vec4_to_vec2()`]
/// * [`vec4_to_vec3`](fn.vec4_to_vec3.html) /// * [`vec4_to_vec3()`]
pub fn vec4_to_vec4<T: Scalar>(v: &TVec4<T>) -> TVec4<T> { pub fn vec4_to_vec4<T: Scalar>(v: &TVec4<T>) -> TVec4<T> {
v.clone() v.clone()
} }
@ -383,9 +380,9 @@ pub fn vec4_to_vec4<T: Scalar>(v: &TVec4<T>) -> TVec4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`make_vec1`](fn.make_vec1.html) /// * [`make_vec1()`]
/// * [`make_vec2`](fn.make_vec2.html) /// * [`make_vec2()`]
/// * [`make_vec3`](fn.make_vec3.html) /// * [`make_vec3()`]
pub fn make_vec4<T: Scalar>(ptr: &[T]) -> TVec4<T> { pub fn make_vec4<T: Scalar>(ptr: &[T]) -> TVec4<T> {
TVec4::from_column_slice(ptr) TVec4::from_column_slice(ptr)
} }

View File

@ -16,9 +16,9 @@ use crate::traits::Number;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`]
/// * [`comp_min`](fn.comp_min.html) /// * [`comp_min()`]
/// * [`comp_mul`](fn.comp_mul.html) /// * [`comp_mul()`]
pub fn comp_add<T: Number, const R: usize, const C: usize>(m: &TMat<T, R, C>) -> T { pub fn comp_add<T: Number, const R: usize, const C: usize>(m: &TMat<T, R, C>) -> T {
m.iter().fold(T::zero(), |x, y| x + *y) m.iter().fold(T::zero(), |x, y| x + *y)
} }
@ -38,13 +38,13 @@ pub fn comp_add<T: Number, const R: usize, const C: usize>(m: &TMat<T, R, C>) ->
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_add`](fn.comp_add.html) /// * [`comp_add()`]
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`]
/// * [`comp_min`](fn.comp_min.html) /// * [`comp_min()`]
/// * [`max`](fn.max.html) /// * [`max()`](crate::max)
/// * [`max2`](fn.max2.html) /// * [`max2()`](crate::max2)
/// * [`max3`](fn.max3.html) /// * [`max3()`](crate::max3)
/// * [`max4`](fn.max4.html) /// * [`max4()`](crate::max4)
pub fn comp_max<T: Number, const R: usize, const C: usize>(m: &TMat<T, R, C>) -> T { pub fn comp_max<T: Number, const R: usize, const C: usize>(m: &TMat<T, R, C>) -> T {
m.iter() m.iter()
.fold(T::min_value(), |x, y| crate::max2_scalar(x, *y)) .fold(T::min_value(), |x, y| crate::max2_scalar(x, *y))
@ -65,13 +65,13 @@ pub fn comp_max<T: Number, const R: usize, const C: usize>(m: &TMat<T, R, C>) ->
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_add`](fn.comp_add.html) /// * [`comp_add()`]
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`]
/// * [`comp_mul`](fn.comp_mul.html) /// * [`comp_mul()`]
/// * [`min`](fn.min.html) /// * [`min()`](crate::min)
/// * [`min2`](fn.min2.html) /// * [`min2()`](crate::min2)
/// * [`min3`](fn.min3.html) /// * [`min3()`](crate::min3)
/// * [`min4`](fn.min4.html) /// * [`min4()`](crate::min4)
pub fn comp_min<T: Number, const R: usize, const C: usize>(m: &TMat<T, R, C>) -> T { pub fn comp_min<T: Number, const R: usize, const C: usize>(m: &TMat<T, R, C>) -> T {
m.iter() m.iter()
.fold(T::max_value(), |x, y| crate::min2_scalar(x, *y)) .fold(T::max_value(), |x, y| crate::min2_scalar(x, *y))
@ -92,9 +92,9 @@ pub fn comp_min<T: Number, const R: usize, const C: usize>(m: &TMat<T, R, C>) ->
/// ///
/// # See also: /// # See also:
/// ///
/// * [`comp_add`](fn.comp_add.html) /// * [`comp_add()`]
/// * [`comp_max`](fn.comp_max.html) /// * [`comp_max()`]
/// * [`comp_min`](fn.comp_min.html) /// * [`comp_min()`]
pub fn comp_mul<T: Number, const R: usize, const C: usize>(m: &TMat<T, R, C>) -> T { pub fn comp_mul<T: Number, const R: usize, const C: usize>(m: &TMat<T, R, C>) -> T {
m.iter().fold(T::one(), |x, y| x * *y) m.iter().fold(T::one(), |x, y| x * *y)
} }

View File

@ -5,7 +5,7 @@ use crate::traits::Number;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`right_handed`](fn.right_handed.html) /// * [`right_handed()`]
pub fn left_handed<T: Number>(a: &TVec3<T>, b: &TVec3<T>, c: &TVec3<T>) -> bool { pub fn left_handed<T: Number>(a: &TVec3<T>, b: &TVec3<T>, c: &TVec3<T>) -> bool {
a.cross(b).dot(c) < T::zero() a.cross(b).dot(c) < T::zero()
} }
@ -14,7 +14,7 @@ pub fn left_handed<T: Number>(a: &TVec3<T>, b: &TVec3<T>, c: &TVec3<T>) -> bool
/// ///
/// # See also: /// # See also:
/// ///
/// * [`left_handed`](fn.left_handed.html) /// * [`left_handed()`]
pub fn right_handed<T: Number>(a: &TVec3<T>, b: &TVec3<T>, c: &TVec3<T>) -> bool { pub fn right_handed<T: Number>(a: &TVec3<T>, b: &TVec3<T>, c: &TVec3<T>) -> bool {
a.cross(b).dot(c) > T::zero() a.cross(b).dot(c) > T::zero()
} }

View File

@ -5,7 +5,7 @@ use crate::RealNumber;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`matrix_cross`](fn.matrix_cross.html) /// * [`matrix_cross()`]
pub fn matrix_cross3<T: RealNumber>(x: &TVec3<T>) -> TMat3<T> { pub fn matrix_cross3<T: RealNumber>(x: &TVec3<T>) -> TMat3<T> {
x.cross_matrix() x.cross_matrix()
} }
@ -14,7 +14,7 @@ pub fn matrix_cross3<T: RealNumber>(x: &TVec3<T>) -> TMat3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`matrix_cross3`](fn.matrix_cross3.html) /// * [`matrix_cross3()`]
pub fn matrix_cross<T: RealNumber>(x: &TVec3<T>) -> TMat4<T> { pub fn matrix_cross<T: RealNumber>(x: &TVec3<T>) -> TMat4<T> {
crate::mat3_to_mat4(&x.cross_matrix()) crate::mat3_to_mat4(&x.cross_matrix())
} }

View File

@ -7,14 +7,14 @@ use crate::traits::Number;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`diagonal2x3`](fn.diagonal2x3.html) /// * [`diagonal2x3()`]
/// * [`diagonal2x4`](fn.diagonal2x4.html) /// * [`diagonal2x4()`]
/// * [`diagonal3x2`](fn.diagonal3x2.html) /// * [`diagonal3x2()`]
/// * [`diagonal3x3`](fn.diagonal3x3.html) /// * [`diagonal3x3()`]
/// * [`diagonal3x4`](fn.diagonal3x4.html) /// * [`diagonal3x4()`]
/// * [`diagonal4x2`](fn.diagonal4x2.html) /// * [`diagonal4x2()`]
/// * [`diagonal4x3`](fn.diagonal4x3.html) /// * [`diagonal4x3()`]
/// * [`diagonal4x4`](fn.diagonal4x4.html) /// * [`diagonal4x4()`]
pub fn diagonal2x2<T: Number>(v: &TVec2<T>) -> TMat2<T> { pub fn diagonal2x2<T: Number>(v: &TVec2<T>) -> TMat2<T> {
TMat2::from_diagonal(v) TMat2::from_diagonal(v)
} }
@ -23,14 +23,14 @@ pub fn diagonal2x2<T: Number>(v: &TVec2<T>) -> TMat2<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`diagonal2x2`](fn.diagonal2x2.html) /// * [`diagonal2x2()`]
/// * [`diagonal2x4`](fn.diagonal2x4.html) /// * [`diagonal2x4()`]
/// * [`diagonal3x2`](fn.diagonal3x2.html) /// * [`diagonal3x2()`]
/// * [`diagonal3x3`](fn.diagonal3x3.html) /// * [`diagonal3x3()`]
/// * [`diagonal3x4`](fn.diagonal3x4.html) /// * [`diagonal3x4()`]
/// * [`diagonal4x2`](fn.diagonal4x2.html) /// * [`diagonal4x2()`]
/// * [`diagonal4x3`](fn.diagonal4x3.html) /// * [`diagonal4x3()`]
/// * [`diagonal4x4`](fn.diagonal4x4.html) /// * [`diagonal4x4()`]
pub fn diagonal2x3<T: Number>(v: &TVec2<T>) -> TMat2x3<T> { pub fn diagonal2x3<T: Number>(v: &TVec2<T>) -> TMat2x3<T> {
TMat2x3::from_partial_diagonal(v.as_slice()) TMat2x3::from_partial_diagonal(v.as_slice())
} }
@ -39,14 +39,14 @@ pub fn diagonal2x3<T: Number>(v: &TVec2<T>) -> TMat2x3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`diagonal2x2`](fn.diagonal2x2.html) /// * [`diagonal2x2()`]
/// * [`diagonal2x3`](fn.diagonal2x3.html) /// * [`diagonal2x3()`]
/// * [`diagonal3x2`](fn.diagonal3x2.html) /// * [`diagonal3x2()`]
/// * [`diagonal3x3`](fn.diagonal3x3.html) /// * [`diagonal3x3()`]
/// * [`diagonal3x4`](fn.diagonal3x4.html) /// * [`diagonal3x4()`]
/// * [`diagonal4x2`](fn.diagonal4x2.html) /// * [`diagonal4x2()`]
/// * [`diagonal4x3`](fn.diagonal4x3.html) /// * [`diagonal4x3()`]
/// * [`diagonal4x4`](fn.diagonal4x4.html) /// * [`diagonal4x4()`]
pub fn diagonal2x4<T: Number>(v: &TVec2<T>) -> TMat2x4<T> { pub fn diagonal2x4<T: Number>(v: &TVec2<T>) -> TMat2x4<T> {
TMat2x4::from_partial_diagonal(v.as_slice()) TMat2x4::from_partial_diagonal(v.as_slice())
} }
@ -55,14 +55,14 @@ pub fn diagonal2x4<T: Number>(v: &TVec2<T>) -> TMat2x4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`diagonal2x2`](fn.diagonal2x2.html) /// * [`diagonal2x2()`]
/// * [`diagonal2x3`](fn.diagonal2x3.html) /// * [`diagonal2x3()`]
/// * [`diagonal2x4`](fn.diagonal2x4.html) /// * [`diagonal2x4()`]
/// * [`diagonal3x3`](fn.diagonal3x3.html) /// * [`diagonal3x3()`]
/// * [`diagonal3x4`](fn.diagonal3x4.html) /// * [`diagonal3x4()`]
/// * [`diagonal4x2`](fn.diagonal4x2.html) /// * [`diagonal4x2()`]
/// * [`diagonal4x3`](fn.diagonal4x3.html) /// * [`diagonal4x3()`]
/// * [`diagonal4x4`](fn.diagonal4x4.html) /// * [`diagonal4x4()`]
pub fn diagonal3x2<T: Number>(v: &TVec2<T>) -> TMat3x2<T> { pub fn diagonal3x2<T: Number>(v: &TVec2<T>) -> TMat3x2<T> {
TMat3x2::from_partial_diagonal(v.as_slice()) TMat3x2::from_partial_diagonal(v.as_slice())
} }
@ -71,14 +71,14 @@ pub fn diagonal3x2<T: Number>(v: &TVec2<T>) -> TMat3x2<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`diagonal2x2`](fn.diagonal2x2.html) /// * [`diagonal2x2()`]
/// * [`diagonal2x3`](fn.diagonal2x3.html) /// * [`diagonal2x3()`]
/// * [`diagonal2x4`](fn.diagonal2x4.html) /// * [`diagonal2x4()`]
/// * [`diagonal3x2`](fn.diagonal3x2.html) /// * [`diagonal3x2()`]
/// * [`diagonal3x4`](fn.diagonal3x4.html) /// * [`diagonal3x4()`]
/// * [`diagonal4x2`](fn.diagonal4x2.html) /// * [`diagonal4x2()`]
/// * [`diagonal4x3`](fn.diagonal4x3.html) /// * [`diagonal4x3()`]
/// * [`diagonal4x4`](fn.diagonal4x4.html) /// * [`diagonal4x4()`]
pub fn diagonal3x3<T: Number>(v: &TVec3<T>) -> TMat3<T> { pub fn diagonal3x3<T: Number>(v: &TVec3<T>) -> TMat3<T> {
TMat3::from_diagonal(v) TMat3::from_diagonal(v)
} }
@ -87,14 +87,14 @@ pub fn diagonal3x3<T: Number>(v: &TVec3<T>) -> TMat3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`diagonal2x2`](fn.diagonal2x2.html) /// * [`diagonal2x2()`]
/// * [`diagonal2x3`](fn.diagonal2x3.html) /// * [`diagonal2x3()`]
/// * [`diagonal2x4`](fn.diagonal2x4.html) /// * [`diagonal2x4()`]
/// * [`diagonal3x2`](fn.diagonal3x2.html) /// * [`diagonal3x2()`]
/// * [`diagonal3x3`](fn.diagonal3x3.html) /// * [`diagonal3x3()`]
/// * [`diagonal4x2`](fn.diagonal4x2.html) /// * [`diagonal4x2()`]
/// * [`diagonal4x3`](fn.diagonal4x3.html) /// * [`diagonal4x3()`]
/// * [`diagonal4x4`](fn.diagonal4x4.html) /// * [`diagonal4x4()`]
pub fn diagonal3x4<T: Number>(v: &TVec3<T>) -> TMat3x4<T> { pub fn diagonal3x4<T: Number>(v: &TVec3<T>) -> TMat3x4<T> {
TMat3x4::from_partial_diagonal(v.as_slice()) TMat3x4::from_partial_diagonal(v.as_slice())
} }
@ -103,14 +103,14 @@ pub fn diagonal3x4<T: Number>(v: &TVec3<T>) -> TMat3x4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`diagonal2x2`](fn.diagonal2x2.html) /// * [`diagonal2x2()`]
/// * [`diagonal2x3`](fn.diagonal2x3.html) /// * [`diagonal2x3()`]
/// * [`diagonal2x4`](fn.diagonal2x4.html) /// * [`diagonal2x4()`]
/// * [`diagonal3x2`](fn.diagonal3x2.html) /// * [`diagonal3x2()`]
/// * [`diagonal3x3`](fn.diagonal3x3.html) /// * [`diagonal3x3()`]
/// * [`diagonal3x4`](fn.diagonal3x4.html) /// * [`diagonal3x4()`]
/// * [`diagonal4x3`](fn.diagonal4x3.html) /// * [`diagonal4x3()`]
/// * [`diagonal4x4`](fn.diagonal4x4.html) /// * [`diagonal4x4()`]
pub fn diagonal4x2<T: Number>(v: &TVec2<T>) -> TMat4x2<T> { pub fn diagonal4x2<T: Number>(v: &TVec2<T>) -> TMat4x2<T> {
TMat4x2::from_partial_diagonal(v.as_slice()) TMat4x2::from_partial_diagonal(v.as_slice())
} }
@ -119,14 +119,14 @@ pub fn diagonal4x2<T: Number>(v: &TVec2<T>) -> TMat4x2<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`diagonal2x2`](fn.diagonal2x2.html) /// * [`diagonal2x2()`]
/// * [`diagonal2x3`](fn.diagonal2x3.html) /// * [`diagonal2x3()`]
/// * [`diagonal2x4`](fn.diagonal2x4.html) /// * [`diagonal2x4()`]
/// * [`diagonal3x2`](fn.diagonal3x2.html) /// * [`diagonal3x2()`]
/// * [`diagonal3x3`](fn.diagonal3x3.html) /// * [`diagonal3x3()`]
/// * [`diagonal3x4`](fn.diagonal3x4.html) /// * [`diagonal3x4()`]
/// * [`diagonal4x2`](fn.diagonal4x2.html) /// * [`diagonal4x2()`]
/// * [`diagonal4x4`](fn.diagonal4x4.html) /// * [`diagonal4x4()`]
pub fn diagonal4x3<T: Number>(v: &TVec3<T>) -> TMat4x3<T> { pub fn diagonal4x3<T: Number>(v: &TVec3<T>) -> TMat4x3<T> {
TMat4x3::from_partial_diagonal(v.as_slice()) TMat4x3::from_partial_diagonal(v.as_slice())
} }
@ -135,14 +135,14 @@ pub fn diagonal4x3<T: Number>(v: &TVec3<T>) -> TMat4x3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`diagonal2x2`](fn.diagonal2x2.html) /// * [`diagonal2x2()`]
/// * [`diagonal2x3`](fn.diagonal2x3.html) /// * [`diagonal2x3()`]
/// * [`diagonal2x4`](fn.diagonal2x4.html) /// * [`diagonal2x4()`]
/// * [`diagonal3x2`](fn.diagonal3x2.html) /// * [`diagonal3x2()`]
/// * [`diagonal3x3`](fn.diagonal3x3.html) /// * [`diagonal3x3()`]
/// * [`diagonal3x4`](fn.diagonal3x4.html) /// * [`diagonal3x4()`]
/// * [`diagonal4x2`](fn.diagonal4x2.html) /// * [`diagonal4x2()`]
/// * [`diagonal4x3`](fn.diagonal4x3.html) /// * [`diagonal4x3()`]
pub fn diagonal4x4<T: Number>(v: &TVec4<T>) -> TMat4<T> { pub fn diagonal4x4<T: Number>(v: &TVec4<T>) -> TMat4<T> {
TMat4::from_diagonal(v) TMat4::from_diagonal(v)
} }

View File

@ -5,7 +5,7 @@ use crate::RealNumber;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`distance`](fn.distance.html) /// * [`distance()`](crate::distance)
pub fn distance2<T: RealNumber, const D: usize>(p0: &TVec<T, D>, p1: &TVec<T, D>) -> T { pub fn distance2<T: RealNumber, const D: usize>(p0: &TVec<T, D>, p1: &TVec<T, D>) -> T {
(p1 - p0).norm_squared() (p1 - p0).norm_squared()
} }
@ -14,9 +14,9 @@ pub fn distance2<T: RealNumber, const D: usize>(p0: &TVec<T, D>, p1: &TVec<T, D>
/// ///
/// # See also: /// # See also:
/// ///
/// * [`l1_norm`](fn.l1_norm.html) /// * [`l1_norm()`]
/// * [`l2_distance`](fn.l2_distance.html) /// * [`l2_distance()`]
/// * [`l2_norm`](fn.l2_norm.html) /// * [`l2_norm()`]
pub fn l1_distance<T: RealNumber, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> T { pub fn l1_distance<T: RealNumber, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> T {
l1_norm(&(y - x)) l1_norm(&(y - x))
} }
@ -28,27 +28,27 @@ pub fn l1_distance<T: RealNumber, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>
/// ///
/// # See also: /// # See also:
/// ///
/// * [`l1_distance`](fn.l1_distance.html) /// * [`l1_distance()`]
/// * [`l2_distance`](fn.l2_distance.html) /// * [`l2_distance()`]
/// * [`l2_norm`](fn.l2_norm.html) /// * [`l2_norm()`]
pub fn l1_norm<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> T { pub fn l1_norm<T: RealNumber, const D: usize>(v: &TVec<T, D>) -> T {
crate::comp_add(&v.abs()) crate::comp_add(&v.abs())
} }
/// The l2-norm of `x - y`. /// The l2-norm of `x - y`.
/// ///
/// This is the same value as returned by [`length2`](fn.length2.html) and /// This is the same value as returned by [`length2()`] and
/// [`magnitude2`](fn.magnitude2.html). /// [`magnitude2()`].
/// ///
/// # See also: /// # See also:
/// ///
/// * [`l1_distance`](fn.l1_distance.html) /// * [`l1_distance()`]
/// * [`l1_norm`](fn.l1_norm.html) /// * [`l1_norm()`]
/// * [`l2_norm`](fn.l2_norm.html) /// * [`l2_norm()`]
/// * [`length`](fn.length.html) /// * [`length()`](crate::length)
/// * [`length2`](fn.length2.html) /// * [`length2()`]
/// * [`magnitude`](fn.magnitude.html) /// * [`magnitude()`](crate::magnitude)
/// * [`magnitude2`](fn.magnitude2.html) /// * [`magnitude2()`]
pub fn l2_distance<T: RealNumber, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> T { pub fn l2_distance<T: RealNumber, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> T {
l2_norm(&(y - x)) l2_norm(&(y - x))
} }
@ -57,33 +57,33 @@ pub fn l2_distance<T: RealNumber, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>
/// ///
/// This is also known as the Euclidean norm. /// This is also known as the Euclidean norm.
/// ///
/// This is the same value as returned by [`length`](fn.length.html) and /// This is the same value as returned by [`length()`](crate::length) and
/// [`magnitude`](fn.magnitude.html). /// [`magnitude()`](crate::magnitude).
/// ///
/// # See also: /// # See also:
/// ///
/// * [`l1_distance`](fn.l1_distance.html) /// * [`l1_distance()`]
/// * [`l1_norm`](fn.l1_norm.html) /// * [`l1_norm()`]
/// * [`l2_distance`](fn.l2_distance.html) /// * [`l2_distance()`]
/// * [`length`](fn.length.html) /// * [`length()`](crate::length)
/// * [`length2`](fn.length2.html) /// * [`length2()`]
/// * [`magnitude`](fn.magnitude.html) /// * [`magnitude()`](crate::magnitude)
/// * [`magnitude2`](fn.magnitude2.html) /// * [`magnitude2()`]
pub fn l2_norm<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T { pub fn l2_norm<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T {
x.norm() x.norm()
} }
/// The squared magnitude of `x`. /// The squared magnitude of `x`.
/// ///
/// A synonym for [`magnitude2`](fn.magnitude2.html). /// A synonym for [`magnitude2()`].
/// ///
/// # See also: /// # See also:
/// ///
/// * [`distance`](fn.distance.html) /// * [`distance()`](crate::distance)
/// * [`distance2`](fn.distance2.html) /// * [`distance2()`]
/// * [`length`](fn.length.html) /// * [`length()`](crate::length)
/// * [`magnitude`](fn.magnitude.html) /// * [`magnitude()`](crate::magnitude)
/// * [`magnitude2`](fn.magnitude2.html) /// * [`magnitude2()`]
pub fn length2<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T { pub fn length2<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T {
x.norm_squared() x.norm_squared()
} }
@ -94,10 +94,10 @@ pub fn length2<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`distance`](fn.distance.html) /// * [`distance()`](crate::distance)
/// * [`distance2`](fn.distance2.html) /// * [`distance2()`]
/// * [`length2`](fn.length2.html) /// * [`length2()`]
/// * [`magnitude`](fn.magnitude.html) /// * [`magnitude()`](crate::magnitude)
/// * [`nalgebra::norm_squared`](../nalgebra/fn.norm_squared.html) /// * [`nalgebra::norm_squared`](../nalgebra/fn.norm_squared.html)
pub fn magnitude2<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T { pub fn magnitude2<T: RealNumber, const D: usize>(x: &TVec<T, D>) -> T {
x.norm_squared() x.norm_squared()

View File

@ -4,11 +4,11 @@ use crate::aliases::TVec;
/// The dot product of the normalized version of `x` and `y`. /// The dot product of the normalized version of `x` and `y`.
/// ///
/// This is currently the same as [`normalize_dot`](fn.normalize_dot.html). /// This is currently the same as [`normalize_dot()`]
/// ///
/// # See also: /// # See also:
/// ///
/// * [`normalize_dot`](fn.normalize_dot.html`) /// * [`normalize_dot()`]
pub fn fast_normalize_dot<T: RealNumber, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> T { pub fn fast_normalize_dot<T: RealNumber, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> T {
// XXX: improve those. // XXX: improve those.
x.normalize().dot(&y.normalize()) x.normalize().dot(&y.normalize())
@ -18,7 +18,7 @@ pub fn fast_normalize_dot<T: RealNumber, const D: usize>(x: &TVec<T, D>, y: &TVe
/// ///
/// # See also: /// # See also:
/// ///
/// * [`fast_normalize_dot`](fn.fast_normalize_dot.html`) /// * [`fast_normalize_dot()`]
pub fn normalize_dot<T: RealNumber, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> T { pub fn normalize_dot<T: RealNumber, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> T {
// XXX: improve those. // XXX: improve those.
x.normalize().dot(&y.normalize()) x.normalize().dot(&y.normalize())

View File

@ -7,11 +7,11 @@ use crate::traits::{Number, RealNumber};
/// ///
/// # See also: /// # See also:
/// ///
/// * [`scaling`](fn.scaling.html) /// * [`scaling()`]
/// * [`translation`](fn.translation.html) /// * [`translation()`]
/// * [`rotation2d`](fn.rotation2d.html) /// * [`rotation2d()`]
/// * [`scaling2d`](fn.scaling2d.html) /// * [`scaling2d()`]
/// * [`translation2d`](fn.translation2d.html) /// * [`translation2d()`]
pub fn rotation<T: RealNumber>(angle: T, v: &TVec3<T>) -> TMat4<T> { pub fn rotation<T: RealNumber>(angle: T, v: &TVec3<T>) -> TMat4<T> {
Rotation3::from_axis_angle(&Unit::new_normalize(*v), angle).to_homogeneous() Rotation3::from_axis_angle(&Unit::new_normalize(*v), angle).to_homogeneous()
} }
@ -20,11 +20,11 @@ pub fn rotation<T: RealNumber>(angle: T, v: &TVec3<T>) -> TMat4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotation`](fn.rotation.html) /// * [`rotation()`]
/// * [`translation`](fn.translation.html) /// * [`translation()`]
/// * [`rotation2d`](fn.rotation2d.html) /// * [`rotation2d()`]
/// * [`scaling2d`](fn.scaling2d.html) /// * [`scaling2d()`]
/// * [`translation2d`](fn.translation2d.html) /// * [`translation2d()`]
pub fn scaling<T: Number>(v: &TVec3<T>) -> TMat4<T> { pub fn scaling<T: Number>(v: &TVec3<T>) -> TMat4<T> {
TMat4::new_nonuniform_scaling(v) TMat4::new_nonuniform_scaling(v)
} }
@ -33,11 +33,11 @@ pub fn scaling<T: Number>(v: &TVec3<T>) -> TMat4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotation`](fn.rotation.html) /// * [`rotation()`]
/// * [`scaling`](fn.scaling.html) /// * [`scaling()`]
/// * [`rotation2d`](fn.rotation2d.html) /// * [`rotation2d()`]
/// * [`scaling2d`](fn.scaling2d.html) /// * [`scaling2d()`]
/// * [`translation2d`](fn.translation2d.html) /// * [`translation2d()`]
pub fn translation<T: Number>(v: &TVec3<T>) -> TMat4<T> { pub fn translation<T: Number>(v: &TVec3<T>) -> TMat4<T> {
TMat4::new_translation(v) TMat4::new_translation(v)
} }
@ -46,11 +46,11 @@ pub fn translation<T: Number>(v: &TVec3<T>) -> TMat4<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotation`](fn.rotation.html) /// * [`rotation()`]
/// * [`scaling`](fn.scaling.html) /// * [`scaling()`]
/// * [`translation`](fn.translation.html) /// * [`translation()`]
/// * [`scaling2d`](fn.scaling2d.html) /// * [`scaling2d()`]
/// * [`translation2d`](fn.translation2d.html) /// * [`translation2d()`]
pub fn rotation2d<T: RealNumber>(angle: T) -> TMat3<T> { pub fn rotation2d<T: RealNumber>(angle: T) -> TMat3<T> {
Rotation2::new(angle).to_homogeneous() Rotation2::new(angle).to_homogeneous()
} }
@ -59,11 +59,11 @@ pub fn rotation2d<T: RealNumber>(angle: T) -> TMat3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotation`](fn.rotation.html) /// * [`rotation()`]
/// * [`scaling`](fn.scaling.html) /// * [`scaling()`]
/// * [`translation`](fn.translation.html) /// * [`translation()`]
/// * [`rotation2d`](fn.rotation2d.html) /// * [`rotation2d()`]
/// * [`translation2d`](fn.translation2d.html) /// * [`translation2d()`]
pub fn scaling2d<T: Number>(v: &TVec2<T>) -> TMat3<T> { pub fn scaling2d<T: Number>(v: &TVec2<T>) -> TMat3<T> {
TMat3::new_nonuniform_scaling(v) TMat3::new_nonuniform_scaling(v)
} }
@ -72,11 +72,11 @@ pub fn scaling2d<T: Number>(v: &TVec2<T>) -> TMat3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotation`](fn.rotation.html) /// * [`rotation()`]
/// * [`scaling`](fn.scaling.html) /// * [`scaling()`]
/// * [`translation`](fn.translation.html) /// * [`translation()`]
/// * [`rotation2d`](fn.rotation2d.html) /// * [`rotation2d()`]
/// * [`scaling2d`](fn.scaling2d.html) /// * [`scaling2d()`]
pub fn translation2d<T: Number>(v: &TVec2<T>) -> TMat3<T> { pub fn translation2d<T: Number>(v: &TVec2<T>) -> TMat3<T> {
TMat3::new_translation(v) TMat3::new_translation(v)
} }

View File

@ -7,11 +7,11 @@ use crate::traits::{Number, RealNumber};
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotation2d`](fn.rotation2d.html) /// * [`rotation2d()`](crate::rotation2d)
/// * [`scale2d`](fn.scale2d.html) /// * [`scale2d()`]
/// * [`scaling2d`](fn.scaling2d.html) /// * [`scaling2d()`](crate::scaling2d)
/// * [`translate2d`](fn.translate2d.html) /// * [`translate2d()`]
/// * [`translation2d`](fn.translation2d.html) /// * [`translation2d()`](crate::translation2d)
pub fn rotate2d<T: RealNumber>(m: &TMat3<T>, angle: T) -> TMat3<T> { pub fn rotate2d<T: RealNumber>(m: &TMat3<T>, angle: T) -> TMat3<T> {
m * UnitComplex::new(angle).to_homogeneous() m * UnitComplex::new(angle).to_homogeneous()
} }
@ -20,11 +20,11 @@ pub fn rotate2d<T: RealNumber>(m: &TMat3<T>, angle: T) -> TMat3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotate2d`](fn.rotate2d.html) /// * [`rotate2d()`]
/// * [`rotation2d`](fn.rotation2d.html) /// * [`rotation2d()`](crate::rotation2d)
/// * [`scaling2d`](fn.scaling2d.html) /// * [`scaling2d()`](crate::scaling2d)
/// * [`translate2d`](fn.translate2d.html) /// * [`translate2d()`]
/// * [`translation2d`](fn.translation2d.html) /// * [`translation2d()`](crate::translation2d)
pub fn scale2d<T: Number>(m: &TMat3<T>, v: &TVec2<T>) -> TMat3<T> { pub fn scale2d<T: Number>(m: &TMat3<T>, v: &TVec2<T>) -> TMat3<T> {
m.prepend_nonuniform_scaling(v) m.prepend_nonuniform_scaling(v)
} }
@ -33,11 +33,11 @@ pub fn scale2d<T: Number>(m: &TMat3<T>, v: &TVec2<T>) -> TMat3<T> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`rotate2d`](fn.rotate2d.html) /// * [`rotate2d()`]
/// * [`rotation2d`](fn.rotation2d.html) /// * [`rotation2d()`](crate::rotation2d)
/// * [`scale2d`](fn.scale2d.html) /// * [`scale2d()`]
/// * [`scaling2d`](fn.scaling2d.html) /// * [`scaling2d()`](crate::scaling2d)
/// * [`translation2d`](fn.translation2d.html) /// * [`translation2d()`](crate::translation2d)
pub fn translate2d<T: Number>(m: &TMat3<T>, v: &TVec2<T>) -> TMat3<T> { pub fn translate2d<T: Number>(m: &TMat3<T>, v: &TVec2<T>) -> TMat3<T> {
m.prepend_translation(v) m.prepend_translation(v)
} }

View File

@ -7,7 +7,7 @@ use crate::traits::Number;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`are_collinear2d`](fn.are_collinear2d.html) /// * [`are_collinear2d()`]
pub fn are_collinear<T: Number>(v0: &TVec3<T>, v1: &TVec3<T>, epsilon: T) -> bool { pub fn are_collinear<T: Number>(v0: &TVec3<T>, v1: &TVec3<T>, epsilon: T) -> bool {
is_null(&v0.cross(v1), epsilon) is_null(&v0.cross(v1), epsilon)
} }
@ -16,7 +16,7 @@ pub fn are_collinear<T: Number>(v0: &TVec3<T>, v1: &TVec3<T>, epsilon: T) -> boo
/// ///
/// # See also: /// # See also:
/// ///
/// * [`are_collinear`](fn.are_collinear.html) /// * [`are_collinear()`]
pub fn are_collinear2d<T: Number>(v0: &TVec2<T>, v1: &TVec2<T>, epsilon: T) -> bool { pub fn are_collinear2d<T: Number>(v0: &TVec2<T>, v1: &TVec2<T>, epsilon: T) -> bool {
abs_diff_eq!(v0.perp(v1), T::zero(), epsilon = epsilon) abs_diff_eq!(v0.perp(v1), T::zero(), epsilon = epsilon)
} }

View File

@ -38,7 +38,7 @@
* All function names use `snake_case`, which is the Rust convention. * All function names use `snake_case`, which is the Rust convention.
* All type names use `CamelCase`, which is the Rust convention. * All type names use `CamelCase`, which is the Rust convention.
* All function arguments, except for scalars, are all passed by-reference. * All function arguments, except for scalars, are all passed by-reference.
* The most generic vector and matrix types are [`TMat`](type.TMat.html) and [`TVec`](type.TVec.html) instead of `mat` and `vec`. * The most generic vector and matrix types are [`TMat`] and [`TVec`] instead of `mat` and `vec`.
* Some feature are not yet implemented and should be added in the future. In particular, no packing * Some feature are not yet implemented and should be added in the future. In particular, no packing
functions are available. functions are available.
* A few features are not implemented and will never be. This includes functions related to color * A few features are not implemented and will never be. This includes functions related to color
@ -47,17 +47,17 @@
In addition, because Rust does not allows function overloading, all functions must be given a unique name. In addition, because Rust does not allows function overloading, all functions must be given a unique name.
Here are a few rules chosen arbitrarily for **nalgebra-glm**: Here are a few rules chosen arbitrarily for **nalgebra-glm**:
* Functions operating in 2d will usually end with the `2d` suffix, e.g., [`glm::rotate2d`](fn.rotate2d.html) is for 2D while [`glm::rotate`](fn.rotate.html) is for 3D. * Functions operating in 2d will usually end with the `2d` suffix, e.g., [`glm::rotate2d()`](crate::rotate2d) is for 2D while [`glm::rotate()`](crate::rotate) is for 3D.
* Functions operating on vectors will often end with the `_vec` suffix, possibly followed by the dimension of vector, e.g., [`glm::rotate_vec2`](fn.rotate_vec2.html). * Functions operating on vectors will often end with the `_vec` suffix, possibly followed by the dimension of vector, e.g., [`glm::rotate_vec2()`](crate::rotate_vec2).
* Every function related to quaternions start with the `quat_` prefix, e.g., [`glm::quat_dot(q1, q2)`](fn.quat_dot.html). * Every function related to quaternions start with the `quat_` prefix, e.g., [`glm::quat_dot(q1, q2)`](crate::quat_dot).
* All the conversion functions have unique names as described [below](#conversions). * All the conversion functions have unique names as described [below](#conversions).
### Vector and matrix construction ### Vector and matrix construction
Vectors, matrices, and quaternions can be constructed using several approaches: Vectors, matrices, and quaternions can be constructed using several approaches:
* Using functions with the same name as their type in lower-case. For example [`glm::vec3(x, y, z)`](fn.vec3.html) will create a 3D vector. * Using functions with the same name as their type in lower-case. For example [`glm::vec3(x, y, z)`](crate::vec3) will create a 3D vector.
* Using the `::new` constructor. For example [`Vec3::new(x, y, z)`](../nalgebra/base/type.OMatrix.html#method.new-27) will create a 3D vector. * Using the `::new` constructor. For example [`Vec3::new(x, y, z)`](../nalgebra/base/type.OMatrix.html#method.new-27) will create a 3D vector.
* Using the functions prefixed by `make_` to build a vector a matrix from a slice. For example [`glm::make_vec3(&[x, y, z])`](fn.make_vec3.html) will create a 3D vector. * Using the functions prefixed by `make_` to build a vector a matrix from a slice. For example [`glm::make_vec3(&[x, y, z])`](crate::make_vec3) will create a 3D vector.
Keep in mind that constructing a matrix using this type of functions require its components to be arranged in column-major order on the slice. Keep in mind that constructing a matrix using this type of functions require its components to be arranged in column-major order on the slice.
* Using a geometric construction function. For example [`glm::rotation(angle, axis)`](fn.rotation.html) will build a 4x4 homogeneous rotation matrix from an angle (in radians) and an axis. * Using a geometric construction function. For example [`glm::rotation(angle, axis)`](crate::rotation) will build a 4x4 homogeneous rotation matrix from an angle (in radians) and an axis.
* Using swizzling and conversions as described in the next sections. * Using swizzling and conversions as described in the next sections.
### Swizzling ### Swizzling
Vector swizzling is a native feature of **nalgebra** itself. Therefore, you can use it with all Vector swizzling is a native feature of **nalgebra** itself. Therefore, you can use it with all
@ -75,9 +75,9 @@
It is often useful to convert one algebraic type to another. There are two main approaches for converting It is often useful to convert one algebraic type to another. There are two main approaches for converting
between types in `nalgebra-glm`: between types in `nalgebra-glm`:
* Using function with the form `type1_to_type2` in order to convert an instance of `type1` into an instance of `type2`. * Using function with the form `type1_to_type2` in order to convert an instance of `type1` into an instance of `type2`.
For example [`glm::mat3_to_mat4(m)`](fn.mat3_to_mat4.html) will convert the 3x3 matrix `m` to a 4x4 matrix by appending one column on the right For example [`glm::mat3_to_mat4(m)`](crate::mat3_to_mat4) will convert the 3x3 matrix `m` to a 4x4 matrix by appending one column on the right
and one row on the left. Those now row and columns are filled with 0 except for the diagonal element which is set to 1. and one row on the left. Those now row and columns are filled with 0 except for the diagonal element which is set to 1.
* Using one of the [`convert`](fn.convert.html), [`try_convert`](fn.try_convert.html), or [`convert_unchecked`](fn.convert_unchecked.html) functions. * Using one of the [`convert`](crate::convert), [`try_convert`](crate::try_convert), or [`convert_unchecked`](crate::convert_unchecked) functions.
These functions are directly re-exported from nalgebra and are extremely versatile: These functions are directly re-exported from nalgebra and are extremely versatile:
1. The `convert` function can convert any type (especially geometric types from nalgebra like `Isometry3`) into another algebraic type which is equivalent but more general. For example, 1. The `convert` function can convert any type (especially geometric types from nalgebra like `Isometry3`) into another algebraic type which is equivalent but more general. For example,
`let sim: Similarity3<_> = na::convert(isometry)` will convert an `Isometry3` into a `Similarity3`. `let sim: Similarity3<_> = na::convert(isometry)` will convert an `Isometry3` into a `Similarity3`.

View File

@ -16,8 +16,8 @@ use crate::traits::Number;
/// ///
/// # See also: /// # See also:
/// ///
/// * [`any`](fn.any.html) /// * [`any()`]
/// * [`not`](fn.not.html) /// * [`not()`]
pub fn all<const D: usize>(v: &TVec<bool, D>) -> bool { pub fn all<const D: usize>(v: &TVec<bool, D>) -> bool {
v.iter().all(|x| *x) v.iter().all(|x| *x)
} }
@ -40,8 +40,8 @@ pub fn all<const D: usize>(v: &TVec<bool, D>) -> bool {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`all`](fn.all.html) /// * [`all()`]
/// * [`not`](fn.not.html) /// * [`not()`]
pub fn any<const D: usize>(v: &TVec<bool, D>) -> bool { pub fn any<const D: usize>(v: &TVec<bool, D>) -> bool {
v.iter().any(|x| *x) v.iter().any(|x| *x)
} }
@ -59,12 +59,12 @@ pub fn any<const D: usize>(v: &TVec<bool, D>) -> bool {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`greater_than`](fn.greater_than.html) /// * [`greater_than()`]
/// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`greater_than_equal()`]
/// * [`less_than`](fn.less_than.html) /// * [`less_than()`]
/// * [`less_than_equal`](fn.less_than_equal.html) /// * [`less_than_equal()`]
/// * [`not`](fn.not.html) /// * [`not()`]
/// * [`not_equal`](fn.not_equal.html) /// * [`not_equal()`]
pub fn equal<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<bool, D> { pub fn equal<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<bool, D> {
x.zip_map(y, |x, y| x == y) x.zip_map(y, |x, y| x == y)
} }
@ -82,12 +82,12 @@ pub fn equal<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<
/// ///
/// # See also: /// # See also:
/// ///
/// * [`equal`](fn.equal.html) /// * [`equal()`]
/// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`greater_than_equal()`]
/// * [`less_than`](fn.less_than.html) /// * [`less_than()`]
/// * [`less_than_equal`](fn.less_than_equal.html) /// * [`less_than_equal()`]
/// * [`not`](fn.not.html) /// * [`not()`]
/// * [`not_equal`](fn.not_equal.html) /// * [`not_equal()`]
pub fn greater_than<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<bool, D> { pub fn greater_than<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<bool, D> {
x.zip_map(y, |x, y| x > y) x.zip_map(y, |x, y| x > y)
} }
@ -105,12 +105,12 @@ pub fn greater_than<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -
/// ///
/// # See also: /// # See also:
/// ///
/// * [`equal`](fn.equal.html) /// * [`equal()`]
/// * [`greater_than`](fn.greater_than.html) /// * [`greater_than()`]
/// * [`less_than`](fn.less_than.html) /// * [`less_than()`]
/// * [`less_than_equal`](fn.less_than_equal.html) /// * [`less_than_equal()`]
/// * [`not`](fn.not.html) /// * [`not()`]
/// * [`not_equal`](fn.not_equal.html) /// * [`not_equal()`]
pub fn greater_than_equal<T: Number, const D: usize>( pub fn greater_than_equal<T: Number, const D: usize>(
x: &TVec<T, D>, x: &TVec<T, D>,
y: &TVec<T, D>, y: &TVec<T, D>,
@ -131,12 +131,12 @@ pub fn greater_than_equal<T: Number, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [`equal`](fn.equal.html) /// * [`equal()`]
/// * [`greater_than`](fn.greater_than.html) /// * [`greater_than()`]
/// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`greater_than_equal()`]
/// * [`less_than_equal`](fn.less_than_equal.html) /// * [`less_than_equal()`]
/// * [`not`](fn.not.html) /// * [`not()`]
/// * [`not_equal`](fn.not_equal.html) /// * [`not_equal()`]
pub fn less_than<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<bool, D> { pub fn less_than<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<bool, D> {
x.zip_map(y, |x, y| x < y) x.zip_map(y, |x, y| x < y)
} }
@ -154,12 +154,12 @@ pub fn less_than<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> T
/// ///
/// # See also: /// # See also:
/// ///
/// * [`equal`](fn.equal.html) /// * [`equal()`]
/// * [`greater_than`](fn.greater_than.html) /// * [`greater_than()`]
/// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`greater_than_equal()`]
/// * [`less_than`](fn.less_than.html) /// * [`less_than()`]
/// * [`not`](fn.not.html) /// * [`not()`]
/// * [`not_equal`](fn.not_equal.html) /// * [`not_equal()`]
pub fn less_than_equal<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<bool, D> { pub fn less_than_equal<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<bool, D> {
x.zip_map(y, |x, y| x <= y) x.zip_map(y, |x, y| x <= y)
} }
@ -176,14 +176,14 @@ pub fn less_than_equal<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>
/// ///
/// # See also: /// # See also:
/// ///
/// * [`all`](fn.all.html) /// * [`all()`]
/// * [`any`](fn.any.html) /// * [`any()`]
/// * [`equal`](fn.equal.html) /// * [`equal()`]
/// * [`greater_than`](fn.greater_than.html) /// * [`greater_than()`]
/// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`greater_than_equal()`]
/// * [`less_than`](fn.less_than.html) /// * [`less_than()`]
/// * [`less_than_equal`](fn.less_than_equal.html) /// * [`less_than_equal()`]
/// * [`not_equal`](fn.not_equal.html) /// * [`not_equal()`]
pub fn not<const D: usize>(v: &TVec<bool, D>) -> TVec<bool, D> { pub fn not<const D: usize>(v: &TVec<bool, D>) -> TVec<bool, D> {
v.map(|x| !x) v.map(|x| !x)
} }
@ -201,12 +201,12 @@ pub fn not<const D: usize>(v: &TVec<bool, D>) -> TVec<bool, D> {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`equal`](fn.equal.html) /// * [`equal()`]
/// * [`greater_than`](fn.greater_than.html) /// * [`greater_than()`]
/// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`greater_than_equal()`]
/// * [`less_than`](fn.less_than.html) /// * [`less_than()`]
/// * [`less_than_equal`](fn.less_than_equal.html) /// * [`less_than_equal()`]
/// * [`not`](fn.not.html) /// * [`not()`]
pub fn not_equal<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<bool, D> { pub fn not_equal<T: Number, const D: usize>(x: &TVec<T, D>, y: &TVec<T, D>) -> TVec<bool, D> {
x.zip_map(y, |x, y| x != y) x.zip_map(y, |x, y| x != y)
} }

View File

@ -158,7 +158,7 @@ impl<T> CscMatrix<T> {
/// an error is returned to indicate the failure. /// an error is returned to indicate the failure.
/// ///
/// An error is returned if the data given does not conform to the CSC storage format. /// An error is returned if the data given does not conform to the CSC storage format.
/// See the documentation for [CscMatrix](struct.CscMatrix.html) for more information. /// See the documentation for [`CscMatrix`] for more information.
pub fn try_from_csc_data( pub fn try_from_csc_data(
num_rows: usize, num_rows: usize,
num_cols: usize, num_cols: usize,
@ -184,7 +184,7 @@ impl<T> CscMatrix<T> {
/// ///
/// An error is returned if the data given does not conform to the CSC storage format /// An error is returned if the data given does not conform to the CSC storage format
/// with the exception of having unsorted row indices and values. /// with the exception of having unsorted row indices and values.
/// See the documentation for [CscMatrix](struct.CscMatrix.html) for more information. /// See the documentation for [`CscMatrix`] for more information.
pub fn try_from_unsorted_csc_data( pub fn try_from_unsorted_csc_data(
num_rows: usize, num_rows: usize,
num_cols: usize, num_cols: usize,
@ -748,7 +748,7 @@ impl<'a, T> CscColMut<'a, T> {
} }
} }
/// Column iterator for [CscMatrix](struct.CscMatrix.html). /// Column iterator for [`CscMatrix`].
pub struct CscColIter<'a, T> { pub struct CscColIter<'a, T> {
lane_iter: CsLaneIter<'a, T>, lane_iter: CsLaneIter<'a, T>,
} }
@ -761,7 +761,7 @@ impl<'a, T> Iterator for CscColIter<'a, T> {
} }
} }
/// Mutable column iterator for [CscMatrix](struct.CscMatrix.html). /// Mutable column iterator for [`CscMatrix`].
pub struct CscColIterMut<'a, T> { pub struct CscColIterMut<'a, T> {
lane_iter: CsLaneIterMut<'a, T>, lane_iter: CsLaneIterMut<'a, T>,
} }

View File

@ -159,7 +159,7 @@ impl<T> CsrMatrix<T> {
/// an error is returned to indicate the failure. /// an error is returned to indicate the failure.
/// ///
/// An error is returned if the data given does not conform to the CSR storage format. /// An error is returned if the data given does not conform to the CSR storage format.
/// See the documentation for [CsrMatrix](struct.CsrMatrix.html) for more information. /// See the documentation for [`CsrMatrix`] for more information.
pub fn try_from_csr_data( pub fn try_from_csr_data(
num_rows: usize, num_rows: usize,
num_cols: usize, num_cols: usize,
@ -185,7 +185,7 @@ impl<T> CsrMatrix<T> {
/// ///
/// An error is returned if the data given does not conform to the CSR storage format /// An error is returned if the data given does not conform to the CSR storage format
/// with the exception of having unsorted column indices and values. /// with the exception of having unsorted column indices and values.
/// See the documentation for [CsrMatrix](struct.CsrMatrix.html) for more information. /// See the documentation for [`CsrMatrix`] for more information.
pub fn try_from_unsorted_csr_data( pub fn try_from_unsorted_csr_data(
num_rows: usize, num_rows: usize,
num_cols: usize, num_cols: usize,
@ -753,7 +753,7 @@ impl<'a, T> CsrRowMut<'a, T> {
} }
} }
/// Row iterator for [CsrMatrix](struct.CsrMatrix.html). /// Row iterator for [`CsrMatrix`].
pub struct CsrRowIter<'a, T> { pub struct CsrRowIter<'a, T> {
lane_iter: CsLaneIter<'a, T>, lane_iter: CsLaneIter<'a, T>,
} }
@ -766,7 +766,7 @@ impl<'a, T> Iterator for CsrRowIter<'a, T> {
} }
} }
/// Mutable row iterator for [CsrMatrix](struct.CsrMatrix.html). /// Mutable row iterator for [`CsrMatrix`].
pub struct CsrRowIterMut<'a, T> { pub struct CsrRowIterMut<'a, T> {
lane_iter: CsLaneIterMut<'a, T>, lane_iter: CsLaneIterMut<'a, T>,
} }

View File

@ -199,7 +199,7 @@ impl SparseFormatError {
} }
} }
/// The type of format error described by a [SparseFormatError](struct.SparseFormatError.html). /// The type of format error described by a [`SparseFormatError`].
#[non_exhaustive] #[non_exhaustive]
#[derive(Debug, Copy, Clone, PartialEq, Eq)] #[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum SparseFormatErrorKind { pub enum SparseFormatErrorKind {

View File

@ -173,8 +173,8 @@ pub use simba::simd::{SimdBool, SimdComplexField, SimdPartialOrd, SimdRealField,
/// ///
/// # See also: /// # See also:
/// ///
/// * [`origin`](../nalgebra/fn.origin.html) /// * [`origin()`](crate::OPoint::origin)
/// * [`zero`](fn.zero.html) /// * [`zero()`]
#[inline] #[inline]
pub fn one<T: One>() -> T { pub fn one<T: One>() -> T {
T::one() T::one()
@ -184,8 +184,8 @@ pub fn one<T: One>() -> T {
/// ///
/// # See also: /// # See also:
/// ///
/// * [`one`](fn.one.html) /// * [`one()`]
/// * [`origin`](../nalgebra/fn.origin.html) /// * [`origin()`](crate::OPoint::origin)
#[inline] #[inline]
pub fn zero<T: Zero>() -> T { pub fn zero<T: Zero>() -> T {
T::zero() T::zero()
@ -262,7 +262,7 @@ pub fn min<T: Ord>(a: T, b: T) -> T {
/// The absolute value of `a`. /// The absolute value of `a`.
/// ///
/// Deprecated: Use [`Matrix::abs`] or [`ComplexField::abs`] instead. /// Deprecated: Use [`Matrix::abs()`] or [`ComplexField::abs()`] instead.
#[deprecated(note = "use the inherent method `Matrix::abs` or `ComplexField::abs` instead")] #[deprecated(note = "use the inherent method `Matrix::abs` or `ComplexField::abs` instead")]
#[inline] #[inline]
pub fn abs<T: Signed>(a: &T) -> T { pub fn abs<T: Signed>(a: &T) -> T {
@ -400,8 +400,8 @@ pub fn partial_sort2<'a, T: PartialOrd>(a: &'a T, b: &'a T) -> Option<(&'a T, &'
/// ///
/// # See also: /// # See also:
/// ///
/// * [distance](fn.distance.html) /// * [`distance()`]
/// * [`distance_squared`](fn.distance_squared.html) /// * [`distance_squared()`]
#[inline] #[inline]
pub fn center<T: SimdComplexField, const D: usize>( pub fn center<T: SimdComplexField, const D: usize>(
p1: &Point<T, D>, p1: &Point<T, D>,
@ -414,8 +414,8 @@ pub fn center<T: SimdComplexField, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [center](fn.center.html) /// * [`center()`]
/// * [`distance_squared`](fn.distance_squared.html) /// * [`distance_squared()`]
#[inline] #[inline]
pub fn distance<T: SimdComplexField, const D: usize>( pub fn distance<T: SimdComplexField, const D: usize>(
p1: &Point<T, D>, p1: &Point<T, D>,
@ -428,8 +428,8 @@ pub fn distance<T: SimdComplexField, const D: usize>(
/// ///
/// # See also: /// # See also:
/// ///
/// * [center](fn.center.html) /// * [`center()`]
/// * [distance](fn.distance.html) /// * [`distance()`]
#[inline] #[inline]
pub fn distance_squared<T: SimdComplexField, const D: usize>( pub fn distance_squared<T: SimdComplexField, const D: usize>(
p1: &Point<T, D>, p1: &Point<T, D>,
@ -443,15 +443,15 @@ pub fn distance_squared<T: SimdComplexField, const D: usize>(
*/ */
/// Converts an object from one type to an equivalent or more general one. /// Converts an object from one type to an equivalent or more general one.
/// ///
/// See also [`try_convert`](fn.try_convert.html) for conversion to more specific types. /// See also [`try_convert()`] for conversion to more specific types.
/// ///
/// # See also: /// # See also:
/// ///
/// * [`convert_ref`](fn.convert_ref.html) /// * [`convert_ref()`]
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html) /// * [`convert_ref_unchecked()`]
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html) /// * [`is_convertible()`]
/// * [`try_convert`](fn.try_convert.html) /// * [`try_convert()`]
/// * [`try_convert_ref`](fn.try_convert_ref.html) /// * [`try_convert_ref()`]
#[inline] #[inline]
pub fn convert<From, To: SupersetOf<From>>(t: From) -> To { pub fn convert<From, To: SupersetOf<From>>(t: From) -> To {
To::from_subset(&t) To::from_subset(&t)
@ -459,46 +459,46 @@ pub fn convert<From, To: SupersetOf<From>>(t: From) -> To {
/// Attempts to convert an object to a more specific one. /// Attempts to convert an object to a more specific one.
/// ///
/// See also [`convert`](fn.convert.html) for conversion to more general types. /// See also [`convert()`] for conversion to more general types.
/// ///
/// # See also: /// # See also:
/// ///
/// * [convert](fn.convert.html) /// * [`convert()`]
/// * [`convert_ref`](fn.convert_ref.html) /// * [`convert_ref()`]
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html) /// * [`convert_ref_unchecked()`]
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html) /// * [`is_convertible()`]
/// * [`try_convert_ref`](fn.try_convert_ref.html) /// * [`try_convert_ref()`]
#[inline] #[inline]
pub fn try_convert<From: SupersetOf<To>, To>(t: From) -> Option<To> { pub fn try_convert<From: SupersetOf<To>, To>(t: From) -> Option<To> {
t.to_subset() t.to_subset()
} }
/// Indicates if [`try_convert`](fn.try_convert.html) will succeed without /// Indicates if [`try_convert()`] will succeed without
/// actually performing the conversion. /// actually performing the conversion.
/// ///
/// # See also: /// # See also:
/// ///
/// * [convert](fn.convert.html) /// * [`convert()`]
/// * [`convert_ref`](fn.convert_ref.html) /// * [`convert_ref()`]
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html) /// * [`convert_ref_unchecked()`]
/// * [`try_convert`](fn.try_convert.html) /// * [`try_convert()`]
/// * [`try_convert_ref`](fn.try_convert_ref.html) /// * [`try_convert_ref()`]
#[inline] #[inline]
pub fn is_convertible<From: SupersetOf<To>, To>(t: &From) -> bool { pub fn is_convertible<From: SupersetOf<To>, To>(t: &From) -> bool {
t.is_in_subset() t.is_in_subset()
} }
/// Use with care! Same as [`try_convert`](fn.try_convert.html) but /// Use with care! Same as [`try_convert()`] but
/// without any property checks. /// without any property checks.
/// ///
/// # See also: /// # See also:
/// ///
/// * [convert](fn.convert.html) /// * [`convert()`]
/// * [`convert_ref`](fn.convert_ref.html) /// * [`convert_ref()`]
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html) /// * [`convert_ref_unchecked()`]
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html) /// * [`is_convertible()`]
/// * [`try_convert`](fn.try_convert.html) /// * [`try_convert()`]
/// * [`try_convert_ref`](fn.try_convert_ref.html) /// * [`try_convert_ref()`]
#[inline] #[inline]
pub fn convert_unchecked<From: SupersetOf<To>, To>(t: From) -> To { pub fn convert_unchecked<From: SupersetOf<To>, To>(t: From) -> To {
t.to_subset_unchecked() t.to_subset_unchecked()
@ -508,11 +508,11 @@ pub fn convert_unchecked<From: SupersetOf<To>, To>(t: From) -> To {
/// ///
/// # See also: /// # See also:
/// ///
/// * [convert](fn.convert.html) /// * [`convert()`]
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html) /// * [`convert_ref_unchecked()`]
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html) /// * [`is_convertible()`]
/// * [`try_convert`](fn.try_convert.html) /// * [`try_convert()`]
/// * [`try_convert_ref`](fn.try_convert_ref.html) /// * [`try_convert_ref()`]
#[inline] #[inline]
pub fn convert_ref<From, To: SupersetOf<From>>(t: &From) -> To { pub fn convert_ref<From, To: SupersetOf<From>>(t: &From) -> To {
To::from_subset(t) To::from_subset(t)
@ -522,26 +522,26 @@ pub fn convert_ref<From, To: SupersetOf<From>>(t: &From) -> To {
/// ///
/// # See also: /// # See also:
/// ///
/// * [convert](fn.convert.html) /// * [`convert()`]
/// * [`convert_ref`](fn.convert_ref.html) /// * [`convert_ref()`]
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html) /// * [`convert_ref_unchecked()`]
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html) /// * [`is_convertible()`]
/// * [`try_convert`](fn.try_convert.html) /// * [`try_convert()`]
#[inline] #[inline]
pub fn try_convert_ref<From: SupersetOf<To>, To>(t: &From) -> Option<To> { pub fn try_convert_ref<From: SupersetOf<To>, To>(t: &From) -> Option<To> {
t.to_subset() t.to_subset()
} }
/// Use with care! Same as [`try_convert`](fn.try_convert.html) but /// Use with care! Same as [`try_convert()`] but
/// without any property checks. /// without any property checks.
/// ///
/// # See also: /// # See also:
/// ///
/// * [convert](fn.convert.html) /// * [`convert()`]
/// * [`convert_ref`](fn.convert_ref.html) /// * [`convert_ref()`]
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html) /// * [`is_convertible()`]
/// * [`try_convert`](fn.try_convert.html) /// * [`try_convert()`]
/// * [`try_convert_ref`](fn.try_convert_ref.html) /// * [`try_convert_ref()`]
#[inline] #[inline]
pub fn convert_ref_unchecked<From: SupersetOf<To>, To>(t: &From) -> To { pub fn convert_ref_unchecked<From: SupersetOf<To>, To>(t: &From) -> To {
t.to_subset_unchecked() t.to_subset_unchecked()

View File

@ -16,17 +16,17 @@
//! provides tools for generating matrices and vectors, and not any of the geometry types. //! provides tools for generating matrices and vectors, and not any of the geometry types.
//! There are essentially two ways of using this functionality: //! There are essentially two ways of using this functionality:
//! //!
//! - Using the [matrix](fn.matrix.html) function to generate matrices with constraints //! - Using the [`matrix()`] function to generate matrices with constraints
//! on dimensions and elements. //! on dimensions and elements.
//! - Relying on the `Arbitrary` implementation of `OMatrix`. //! - Relying on the [`Arbitrary`] implementation of [`OMatrix`].
//! //!
//! The first variant is almost always preferred in practice. Read on to discover why. //! The first variant is almost always preferred in practice. Read on to discover why.
//! //!
//! ### Using free function strategies //! ### Using free function strategies
//! //!
//! In `proptest`, it is usually preferable to have free functions that generate *strategies*. //! In `proptest`, it is usually preferable to have free functions that generate *strategies*.
//! Currently, the [matrix](fn.matrix.html) function fills this role. The analogous function for //! Currently, the [`matrix()`] function fills this role. The analogous function for
//! column vectors is [vector](fn.vector.html). Let's take a quick look at how it may be used: //! column vectors is [`vector()`]. Let's take a quick look at how it may be used:
//! ``` //! ```
//! use nalgebra::proptest::matrix; //! use nalgebra::proptest::matrix;
//! use proptest::prelude::*; //! use proptest::prelude::*;
@ -50,7 +50,7 @@
//! For example, let's consider a toy example where we need to generate pairs of matrices //! For example, let's consider a toy example where we need to generate pairs of matrices
//! with exactly 3 rows fixed at compile-time and the same number of columns, but we want the //! with exactly 3 rows fixed at compile-time and the same number of columns, but we want the
//! number of columns to vary. One way to do this is to use `proptest` combinators in combination //! number of columns to vary. One way to do this is to use `proptest` combinators in combination
//! with [matrix](fn.matrix.html) as follows: //! with [`matrix()`] as follows:
//! //!
//! ``` //! ```
//! use nalgebra::{Dyn, OMatrix, Const}; //! use nalgebra::{Dyn, OMatrix, Const};
@ -316,7 +316,7 @@ where
/// with length in the provided range. /// with length in the provided range.
/// ///
/// This is a convenience function for calling /// This is a convenience function for calling
/// [`matrix(value_strategy, length, U1)`](fn.matrix.html) and should /// [`matrix(value_strategy, length, U1)`](crate::matrix) and should
/// be used when you only want to generate column vectors, as it's simpler and makes the intent /// be used when you only want to generate column vectors, as it's simpler and makes the intent
/// clear. /// clear.
pub fn vector<D, ScalarStrategy>( pub fn vector<D, ScalarStrategy>(