From 4140375b6e4b8096a6a79fb6ee69627ae3414c1d Mon Sep 17 00:00:00 2001 From: sebcrozet Date: Sun, 23 Sep 2018 14:48:45 +0200 Subject: [PATCH] Rename the Mat and Vec aliases to TMat and TVec. --- nalgebra-glm/src/aliases.rs | 4 +- nalgebra-glm/src/common.rs | 44 +++++++++---------- nalgebra-glm/src/constructors.rs | 26 +++++------ nalgebra-glm/src/exponential.rs | 16 +++---- nalgebra-glm/src/ext/matrix_relationnal.rs | 30 ++++++------- nalgebra-glm/src/ext/matrix_transform.rs | 16 +++---- nalgebra-glm/src/ext/quaternion_common.rs | 4 +- nalgebra-glm/src/ext/quaternion_relational.rs | 10 ++--- nalgebra-glm/src/ext/vector_common.rs | 18 ++++---- nalgebra-glm/src/ext/vector_relational.rs | 10 ++--- nalgebra-glm/src/geometric.rs | 20 ++++----- nalgebra-glm/src/gtc/bitfield.rs | 10 ++--- nalgebra-glm/src/gtc/epsilon.rs | 6 +-- nalgebra-glm/src/gtc/integer.rs | 6 +-- nalgebra-glm/src/gtc/matrix_access.rs | 10 ++--- nalgebra-glm/src/gtc/matrix_inverse.rs | 10 ++--- nalgebra-glm/src/gtc/packing.rs | 12 ++--- nalgebra-glm/src/gtc/quaternion.rs | 10 ++--- nalgebra-glm/src/gtc/round.rs | 20 ++++----- nalgebra-glm/src/gtc/type_ptr.rs | 6 +-- nalgebra-glm/src/gtc/ulp.rs | 4 +- nalgebra-glm/src/gtx/component_wise.rs | 10 ++--- nalgebra-glm/src/gtx/euler_angles.rs | 2 +- nalgebra-glm/src/gtx/norm.rs | 20 ++++----- nalgebra-glm/src/gtx/normalize_dot.rs | 6 +-- nalgebra-glm/src/gtx/vector_angle.rs | 4 +- nalgebra-glm/src/gtx/vector_query.rs | 14 +++--- nalgebra-glm/src/integer.rs | 22 +++++----- nalgebra-glm/src/matrix.rs | 14 +++--- nalgebra-glm/src/trigonometric.rs | 32 +++++++------- nalgebra-glm/src/vector_relational.rs | 20 ++++----- 31 files changed, 218 insertions(+), 218 deletions(-) diff --git a/nalgebra-glm/src/aliases.rs b/nalgebra-glm/src/aliases.rs index f64651b5..66674285 100644 --- a/nalgebra-glm/src/aliases.rs +++ b/nalgebra-glm/src/aliases.rs @@ -5,9 +5,9 @@ use na::{MatrixMN, VectorN, Vector1, Vector2, Vector3, Vector4, Quaternion}; /// A matrix with components of type `N`. It has `R` rows, and `C` columns. -pub type Mat = MatrixMN; +pub type TMat = MatrixMN; /// A column vector with components of type `N`. It has `D` rows (and one column). -pub type Vec = VectorN; +pub type TVec = VectorN; /// A quaternion with components of type `N`. pub type Qua = Quaternion; diff --git a/nalgebra-glm/src/common.rs b/nalgebra-glm/src/common.rs index 7dc0e9e7..15c55990 100644 --- a/nalgebra-glm/src/common.rs +++ b/nalgebra-glm/src/common.rs @@ -2,17 +2,17 @@ use std::mem; use num::FromPrimitive; use na::{self, Real, DefaultAllocator}; -use aliases::{Vec, Mat}; +use aliases::{TVec, TMat}; use traits::{Number, Dimension, Alloc}; /// For each matrix or vector component `x` if `x >= 0`; otherwise, it returns `-x`. -pub fn abs(x: &Mat) -> Mat +pub fn abs(x: &TMat) -> TMat where DefaultAllocator: Alloc { x.abs() } /// For each matrix or vector component returns a value equal to the nearest integer that is greater than or equal to `x`. -pub fn ceil(x: &Vec) -> Vec +pub fn ceil(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|x| x.ceil()) } @@ -24,13 +24,13 @@ pub fn clamp_scalar(x: N, min_val: N, max_val: N) -> N { } /// Returns `min(max(x[i], min_val), max_val)` for each component in `x` using the floating-point values `min_val and `max_val`. -pub fn clamp(x: &Vec, min_val: N, max_val: N) -> Vec +pub fn clamp(x: &TVec, min_val: N, max_val: N) -> TVec where DefaultAllocator: Alloc { x.map(|x| na::clamp(x, min_val, max_val)) } /// Returns `min(max(x[i], min_val[i]), max_val[i])` for each component in `x` using the components of `min_val` and `max_val` as bounds. -pub fn clamp_vec(x: &Vec, min_val: &Vec, max_val: &Vec) -> Vec +pub fn clamp_vec(x: &TVec, min_val: &TVec, max_val: &TVec) -> TVec where DefaultAllocator: Alloc { na::clamp(x.clone(), min_val.clone(), max_val.clone()) } @@ -45,7 +45,7 @@ pub fn float_bits_to_int(v: f32) -> i32 { /// Returns a signed integer value representing the encoding of each component of `v`. /// /// The floating point value's bit-level representation is preserved. -pub fn float_bits_to_int_vec(v: &Vec) -> Vec +pub fn float_bits_to_int_vec(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|v| float_bits_to_int(v)) } @@ -60,30 +60,30 @@ pub fn float_bits_to_uint(v: f32) -> u32 { /// Returns an unsigned integer value representing the encoding of each component of `v`. /// /// The floating point value's bit-level representation is preserved. -pub fn float_bits_to_uint_vec(v: &Vec) -> Vec +pub fn float_bits_to_uint_vec(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|v| float_bits_to_uint(v)) } /// Returns componentwise a value equal to the nearest integer that is less then or equal to `x`. -pub fn floor(x: &Vec) -> Vec +pub fn floor(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|x| x.floor()) } -//// FIXME: should be implemented for Vec/Mat? +//// FIXME: should be implemented for TVec/TMat? //pub fn fma(a: N, b: N, c: N) -> N { // // FIXME: use an actual FMA // a * b + c //} /// Returns the fractional part of each component of `x`. -pub fn fract(x: &Vec) -> Vec +pub fn fract(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|x| x.fract()) } -//// FIXME: should be implemented for Vec/Mat? +//// FIXME: should be implemented for TVec/TMat? ///// Returns the (significant, exponent) of this float number. //pub fn frexp(x: N, exp: N) -> (N, N) { // // FIXME: is there a better approach? @@ -102,18 +102,18 @@ pub fn int_bits_to_float(v: i32) -> f32 { /// For each components of `v`, returns a floating-point value corresponding to a signed integer encoding of a floating-point value. /// /// If an inf or NaN is passed in, it will not signal, and the resulting floating point value is unspecified. Otherwise, the bit-level representation is preserved. -pub fn int_bits_to_float_vec(v: &Vec) -> Vec +pub fn int_bits_to_float_vec(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|v| int_bits_to_float(v)) } -//pub fn isinf(x: &Vec) -> Vec +//pub fn isinf(x: &TVec) -> TVec // where DefaultAllocator: Alloc { // unimplemented!() // //} // -//pub fn isnan(x: &Vec) -> Vec +//pub fn isnan(x: &TVec) -> TVec // where DefaultAllocator: Alloc { // unimplemented!() // @@ -135,7 +135,7 @@ pub fn mix(x: N, y: N, a: N) -> N { /// Component-wise modulus. /// /// Returns `x - y * floor(x / y)` for each component in `x` using the corresponding component of `y`. -pub fn modf_vec(x: &Vec, y: &Vec) -> Vec +pub fn modf_vec(x: &TVec, y: &TVec) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x % y) } @@ -148,19 +148,19 @@ pub fn modf(x: N, i: N) -> N { /// Component-wise rounding. /// /// Values equal to `0.5` are rounded away from `0.0`. -pub fn round(x: &Vec) -> Vec +pub fn round(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|x| x.round()) } -//pub fn roundEven(x: &Vec) -> Vec +//pub fn roundEven(x: &TVec) -> TVec // where DefaultAllocator: Alloc { // unimplemented!() //} /// Returns 1 if `x > 0`, 0 if `x == 0`, or -1 if `x < 0`. -pub fn sign(x: &Vec) -> Vec +pub fn sign(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|x| x.signum()) } @@ -186,19 +186,19 @@ pub fn step_scalar(edge: N, x: N) -> N { } /// Returns 0.0 if `x[i] < edge`, otherwise it returns 1.0. -pub fn step(edge: N, x: &Vec) -> Vec +pub fn step(edge: N, x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|x| step_scalar(edge, x)) } /// Returns 0.0 if `x[i] < edge[i]`, otherwise it returns 1.0. -pub fn step_vec(edge: &Vec, x: &Vec) -> Vec +pub fn step_vec(edge: &TVec, x: &TVec) -> TVec where DefaultAllocator: Alloc { edge.zip_map(x, |edge, x| step_scalar(edge, x)) } /// Returns a value equal to the nearest integer to `x` whose absolute value is not larger than the absolute value of `x`. -pub fn trunc(x: &Vec) -> Vec +pub fn trunc(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|x| x.trunc()) } @@ -214,7 +214,7 @@ pub fn uint_bits_to_float_scalar(v: u32) -> f32 { /// For each component of `v`, returns a floating-point value corresponding to a unsigned integer encoding of a floating-point value. /// /// If an inf or NaN is passed in, it will not signal, and the resulting floating point value is unspecified. Otherwise, the bit-level representation is preserved. -pub fn uint_bits_to_float(v: &Vec) -> Vec +pub fn uint_bits_to_float(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|v| uint_bits_to_float_scalar(v)) } \ No newline at end of file diff --git a/nalgebra-glm/src/constructors.rs b/nalgebra-glm/src/constructors.rs index 6af4a567..6d0463ce 100644 --- a/nalgebra-glm/src/constructors.rs +++ b/nalgebra-glm/src/constructors.rs @@ -1,5 +1,5 @@ use na::{Scalar, Real, U2, U3, U4}; -use aliases::{Mat, Qua, TVec1, TVec2, TVec3, TVec4, TMat2, TMat2x3, TMat2x4, TMat3, TMat3x2, TMat3x4, +use aliases::{TMat, Qua, TVec1, TVec2, TVec3, TVec4, TMat2, TMat2x3, TMat2x4, TMat3, TMat3x2, TMat3x4, TMat4, TMat4x2, TMat4x3}; @@ -26,7 +26,7 @@ pub fn vec4(x: N, y: N, z: N, w: N) -> TVec4 { /// Create a new 2x2 matrix. pub fn mat2(m11: N, m12: N, m21: N, m22: N) -> TMat2 { - Mat::::new( + TMat::::new( m11, m12, m21, m22, ) @@ -34,7 +34,7 @@ pub fn mat2(m11: N, m12: N, m21: N, m22: N) -> TMat2 { /// Create a new 2x2 matrix. pub fn mat2x2(m11: N, m12: N, m21: N, m22: N) -> TMat2 { - Mat::::new( + TMat::::new( m11, m12, m21, m22, ) @@ -42,7 +42,7 @@ pub fn mat2x2(m11: N, m12: N, m21: N, m22: N) -> TMat2 { /// Create a new 2x3 matrix. pub fn mat2x3(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N) -> TMat2x3 { - Mat::::new( + TMat::::new( m11, m12, m13, m21, m22, m23, ) @@ -50,7 +50,7 @@ pub fn mat2x3(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N) -> TMat /// Create a new 2x4 matrix. pub fn mat2x4(m11: N, m12: N, m13: N, m14: N, m21: N, m22: N, m23: N, m24: N) -> TMat2x4 { - Mat::::new( + TMat::::new( m11, m12, m13, m14, m21, m22, m23, m24, ) @@ -58,7 +58,7 @@ pub fn mat2x4(m11: N, m12: N, m13: N, m14: N, m21: N, m22: N, m23: N, /// Create a new 3x3 matrix. pub fn mat3(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N, m31: N, m32: N, m33: N) -> TMat3 { - Mat::::new( + TMat::::new( m11, m12, m13, m21, m22, m23, m31, m32, m33, @@ -67,7 +67,7 @@ pub fn mat3(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N, m31: N, m /// Create a new 3x2 matrix. pub fn mat3x2(m11: N, m12: N, m21: N, m22: N, m31: N, m32: N) -> TMat3x2 { - Mat::::new( + TMat::::new( m11, m12, m21, m22, m31, m32, @@ -76,7 +76,7 @@ pub fn mat3x2(m11: N, m12: N, m21: N, m22: N, m31: N, m32: N) -> TMat /// Create a new 3x3 matrix. pub fn mat3x3(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N, m31: N, m32: N, m33: N) -> TMat3 { - Mat::::new( + TMat::::new( m11, m12, m13, m31, m32, m33, m21, m22, m23, @@ -85,7 +85,7 @@ pub fn mat3x3(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N, m31: N, /// Create a new 3x4 matrix. pub fn mat3x4(m11: N, m12: N, m13: N, m14: N, m21: N, m22: N, m23: N, m24: N, m31: N, m32: N, m33: N, m34: N) -> TMat3x4 { - Mat::::new( + TMat::::new( m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, @@ -94,7 +94,7 @@ pub fn mat3x4(m11: N, m12: N, m13: N, m14: N, m21: N, m22: N, m23: N, /// Create a new 4x2 matrix. pub fn mat4x2(m11: N, m12: N, m21: N, m22: N, m31: N, m32: N, m41: N, m42: N) -> TMat4x2 { - Mat::::new( + TMat::::new( m11, m12, m21, m22, m31, m32, @@ -104,7 +104,7 @@ pub fn mat4x2(m11: N, m12: N, m21: N, m22: N, m31: N, m32: N, m41: N, /// Create a new 4x3 matrix. pub fn mat4x3(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N, m31: N, m32: N, m33: N, m41: N, m42: N, m43: N) -> TMat4x3 { - Mat::::new( + TMat::::new( m11, m12, m13, m21, m22, m23, m31, m32, m33, @@ -114,7 +114,7 @@ pub fn mat4x3(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N, m31: N, /// Create a new 4x4 matrix. pub fn mat4x4(m11: N, m12: N, m13: N, m14: N, m21: N, m22: N, m23: N, m24: N, m31: N, m32: N, m33: N, m34: N, m41: N, m42: N, m43: N, m44: N) -> TMat4 { - Mat::::new( + TMat::::new( m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, @@ -124,7 +124,7 @@ pub fn mat4x4(m11: N, m12: N, m13: N, m14: N, m21: N, m22: N, m23: N, /// Create a new 4x4 matrix. pub fn mat4(m11: N, m12: N, m13: N, m14: N, m21: N, m22: N, m23: N, m24: N, m31: N, m32: N, m33: N, m34: N, m41: N, m42: N, m43: N, m44: N) -> TMat4 { - Mat::::new( + TMat::::new( m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, diff --git a/nalgebra-glm/src/exponential.rs b/nalgebra-glm/src/exponential.rs index 70f0cdcd..0cda3268 100644 --- a/nalgebra-glm/src/exponential.rs +++ b/nalgebra-glm/src/exponential.rs @@ -1,46 +1,46 @@ use na::{Real, DefaultAllocator}; -use aliases::Vec; +use aliases::TVec; use traits::{Alloc, Dimension}; /// Component-wise exponential. -pub fn exp(v: &Vec) -> Vec +pub fn exp(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| x.exp()) } /// Component-wise base-2 exponential. -pub fn exp2(v: &Vec) -> Vec +pub fn exp2(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| x.exp2()) } /// Compute the inverse of the square root of each component of `v`. -pub fn inversesqrt(v: &Vec) -> Vec +pub fn inversesqrt(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| N::one() / x.sqrt()) } /// Component-wise logarithm. -pub fn log(v: &Vec) -> Vec +pub fn log(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| x.ln()) } /// Component-wise base-2 logarithm. -pub fn log2(v: &Vec) -> Vec +pub fn log2(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| x.log2()) } /// Component-wise power. -pub fn pow(base: &Vec, exponent: &Vec) -> Vec +pub fn pow(base: &TVec, exponent: &TVec) -> TVec where DefaultAllocator: Alloc { base.zip_map(exponent, |b, e| b.powf(e)) } /// Component-wise square root. -pub fn sqrt(v: &Vec) -> Vec +pub fn sqrt(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| x.sqrt()) } diff --git a/nalgebra-glm/src/ext/matrix_relationnal.rs b/nalgebra-glm/src/ext/matrix_relationnal.rs index 0cb05ddb..d5f34ae8 100644 --- a/nalgebra-glm/src/ext/matrix_relationnal.rs +++ b/nalgebra-glm/src/ext/matrix_relationnal.rs @@ -1,14 +1,14 @@ use na::DefaultAllocator; -use aliases::{Vec, Mat}; +use aliases::{TVec, TMat}; use traits::{Alloc, Number, Dimension}; /// Perform a component-wise equal-to comparison of two matrices. /// /// Return a boolean vector which components value is True if this expression is satisfied per column of the matrices. -pub fn equal_columns(x: &Mat, y: &Mat) -> Vec +pub fn equal_columns(x: &TMat, y: &TMat) -> TVec where DefaultAllocator: Alloc { - let mut res = Vec::<_, C>::repeat(false); + let mut res = TVec::<_, C>::repeat(false); for i in 0..C::dim() { res[i] = x.column(i) == y.column(i) @@ -20,20 +20,20 @@ pub fn equal_columns(x: &Mat, y: /// Returns the component-wise comparison of `|x - y| < epsilon`. /// /// True if this expression is satisfied. -pub fn equal_columns_eps(x: &Mat, y: &Mat, epsilon: N) -> Vec +pub fn equal_columns_eps(x: &TMat, y: &TMat, epsilon: N) -> TVec where DefaultAllocator: Alloc { - equal_columns_eps_vec(x, y, &Vec::<_, C>::repeat(epsilon)) + equal_columns_eps_vec(x, y, &TVec::<_, C>::repeat(epsilon)) } /// Returns the component-wise comparison on each matrix column `|x - y| < epsilon`. /// /// True if this expression is satisfied. -pub fn equal_columns_eps_vec(x: &Mat, y: &Mat, epsilon: &Vec) -> Vec +pub fn equal_columns_eps_vec(x: &TMat, y: &TMat, epsilon: &TVec) -> TVec where DefaultAllocator: Alloc { - let mut res = Vec::<_, C>::repeat(false); + let mut res = TVec::<_, C>::repeat(false); for i in 0..C::dim() { - res[i] = (x.column(i) - y.column(i)).abs() < Vec::<_, R>::repeat(epsilon[i]) + res[i] = (x.column(i) - y.column(i)).abs() < TVec::<_, R>::repeat(epsilon[i]) } res @@ -42,9 +42,9 @@ pub fn equal_columns_eps_vec(x: &Mat(x: &Mat, y: &Mat) -> Vec +pub fn not_equal_columns(x: &TMat, y: &TMat) -> TVec where DefaultAllocator: Alloc { - let mut res = Vec::<_, C>::repeat(false); + let mut res = TVec::<_, C>::repeat(false); for i in 0..C::dim() { res[i] = x.column(i) != y.column(i) @@ -56,20 +56,20 @@ pub fn not_equal_columns(x: &Mat /// Returns the component-wise comparison of `|x - y| < epsilon`. /// /// True if this expression is not satisfied. -pub fn not_equal_columns_eps(x: &Mat, y: &Mat, epsilon: N) -> Vec +pub fn not_equal_columns_eps(x: &TMat, y: &TMat, epsilon: N) -> TVec where DefaultAllocator: Alloc { - not_equal_columns_eps_vec(x, y, &Vec::<_, C>::repeat(epsilon)) + not_equal_columns_eps_vec(x, y, &TVec::<_, C>::repeat(epsilon)) } /// Returns the component-wise comparison of `|x - y| >= epsilon`. /// /// True if this expression is not satisfied. -pub fn not_equal_columns_eps_vec(x: &Mat, y: &Mat, epsilon: &Vec) -> Vec +pub fn not_equal_columns_eps_vec(x: &TMat, y: &TMat, epsilon: &TVec) -> TVec where DefaultAllocator: Alloc { - let mut res = Vec::<_, C>::repeat(false); + let mut res = TVec::<_, C>::repeat(false); for i in 0..C::dim() { - res[i] = (x.column(i) - y.column(i)).abs() >= Vec::<_, R>::repeat(epsilon[i]) + res[i] = (x.column(i) - y.column(i)).abs() >= TVec::<_, R>::repeat(epsilon[i]) } res diff --git a/nalgebra-glm/src/ext/matrix_transform.rs b/nalgebra-glm/src/ext/matrix_transform.rs index 4fa1d83d..47296d8b 100644 --- a/nalgebra-glm/src/ext/matrix_transform.rs +++ b/nalgebra-glm/src/ext/matrix_transform.rs @@ -1,12 +1,12 @@ use na::{DefaultAllocator, Real, Unit, Rotation3, Point3}; use traits::{Dimension, Number, Alloc}; -use aliases::{Mat, Vec, TVec3, TMat4}; +use aliases::{TMat, TVec, TVec3, TMat4}; /// The identity matrix. -pub fn identity() -> Mat +pub fn identity() -> TMat where DefaultAllocator: Alloc { - Mat::::identity() + TMat::::identity() } /// Build a look at view matrix based on the right handedness. @@ -26,7 +26,7 @@ pub fn look_at(eye: &TVec3, center: &TVec3, up: &TVec3) -> TMa /// * `center` − Position where the camera is looking at /// * `u` − Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)` pub fn look_at_lh(eye: &TVec3, center: &TVec3, up: &TVec3) -> TMat4 { - Mat::look_at_lh(&Point3::from_coordinates(*eye), &Point3::from_coordinates(*center), up) + TMat::look_at_lh(&Point3::from_coordinates(*eye), &Point3::from_coordinates(*center), up) } /// Build a right handed look at view matrix. @@ -36,7 +36,7 @@ pub fn look_at_lh(eye: &TVec3, center: &TVec3, up: &TVec3) -> /// * `center` − Position where the camera is looking at /// * `u` − Normalized up vector, how the camera is oriented. Typically `(0, 1, 0)` pub fn look_at_rh(eye: &TVec3, center: &TVec3, up: &TVec3) -> TMat4 { - Mat::look_at_rh(&Point3::from_coordinates(*eye), &Point3::from_coordinates(*center), up) + TMat::look_at_rh(&Point3::from_coordinates(*eye), &Point3::from_coordinates(*center), up) } /// Builds a rotation 4 * 4 matrix created from an axis vector and an angle and right-multiply it to `m`. @@ -55,7 +55,7 @@ pub fn rotate(m: &TMat4, angle: N, axis: &TVec3) -> TMat4 { /// * m − Input matrix multiplied by this rotation matrix. /// * angle − Rotation angle expressed in radians. pub fn rotate_x(m: &TMat4, angle: N) -> TMat4 { - rotate(m, angle, &Vec::x()) + rotate(m, angle, &TVec::x()) } /// Builds a rotation 4 * 4 matrix around the Y axis and right-multiply it to `m`. @@ -64,7 +64,7 @@ pub fn rotate_x(m: &TMat4, angle: N) -> TMat4 { /// * m − Input matrix multiplied by this rotation matrix. /// * angle − Rotation angle expressed in radians. pub fn rotate_y(m: &TMat4, angle: N) -> TMat4 { - rotate(m, angle, &Vec::y()) + rotate(m, angle, &TVec::y()) } /// Builds a rotation 4 * 4 matrix around the Z axis and right-multiply it to `m`. @@ -73,7 +73,7 @@ pub fn rotate_y(m: &TMat4, angle: N) -> TMat4 { /// * m − Input matrix multiplied by this rotation matrix. /// * angle − Rotation angle expressed in radians. pub fn rotate_z(m: &TMat4, angle: N) -> TMat4 { - rotate(m, angle, &Vec::z()) + rotate(m, angle, &TVec::z()) } /// Builds a scale 4 * 4 matrix created from 3 scalars and right-multiply it to `m`. diff --git a/nalgebra-glm/src/ext/quaternion_common.rs b/nalgebra-glm/src/ext/quaternion_common.rs index edf02b18..fec1928e 100644 --- a/nalgebra-glm/src/ext/quaternion_common.rs +++ b/nalgebra-glm/src/ext/quaternion_common.rs @@ -12,11 +12,11 @@ pub fn quat_inverse(q: &Qua) -> Qua { q.try_inverse().unwrap_or(na::zero()) } -//pub fn quat_isinf(x: &Qua) -> Vec { +//pub fn quat_isinf(x: &Qua) -> TVec { // x.coords.map(|e| e.is_inf()) //} -//pub fn quat_isnan(x: &Qua) -> Vec { +//pub fn quat_isnan(x: &Qua) -> TVec { // x.coords.map(|e| e.is_nan()) //} diff --git a/nalgebra-glm/src/ext/quaternion_relational.rs b/nalgebra-glm/src/ext/quaternion_relational.rs index 46af82d9..d493defd 100644 --- a/nalgebra-glm/src/ext/quaternion_relational.rs +++ b/nalgebra-glm/src/ext/quaternion_relational.rs @@ -1,24 +1,24 @@ use na::{Real, U4}; -use aliases::{Qua, Vec}; +use aliases::{Qua, TVec}; /// Component-wise equality comparison between two quaternions. -pub fn quat_equal(x: &Qua, y: &Qua) -> Vec { +pub fn quat_equal(x: &Qua, y: &Qua) -> TVec { ::equal(&x.coords, &y.coords) } /// Component-wise approximate equality comparison between two quaternions. -pub fn quat_equal_eps(x: &Qua, y: &Qua, epsilon: N) -> Vec { +pub fn quat_equal_eps(x: &Qua, y: &Qua, epsilon: N) -> TVec { ::equal_eps(&x.coords, &y.coords, epsilon) } /// Component-wise non-equality comparison between two quaternions. -pub fn quat_not_equal(x: &Qua, y: &Qua) -> Vec { +pub fn quat_not_equal(x: &Qua, y: &Qua) -> TVec { ::not_equal(&x.coords, &y.coords) } /// Component-wise approximate non-equality comparison between two quaternions. -pub fn quat_not_equal_eps(x: &Qua, y: &Qua, epsilon: N) -> Vec { +pub fn quat_not_equal_eps(x: &Qua, y: &Qua, epsilon: N) -> TVec { ::not_equal_eps(&x.coords, &y.coords, epsilon) } diff --git a/nalgebra-glm/src/ext/vector_common.rs b/nalgebra-glm/src/ext/vector_common.rs index 913fd119..d60ecfd6 100644 --- a/nalgebra-glm/src/ext/vector_common.rs +++ b/nalgebra-glm/src/ext/vector_common.rs @@ -1,52 +1,52 @@ use na::{self, DefaultAllocator}; use traits::{Alloc, Number, Dimension}; -use aliases::Vec; +use aliases::TVec; /// Component-wise maximum between a vector and a scalar. -pub fn max(a: &Vec, b: N) -> Vec +pub fn max(a: &TVec, b: N) -> TVec where DefaultAllocator: Alloc { a.map(|a| na::sup(&a, &b)) } /// Component-wise maximum between two vectors. -pub fn max2(a: &Vec, b: &Vec) -> Vec +pub fn max2(a: &TVec, b: &TVec) -> TVec where DefaultAllocator: Alloc { na::sup(a, b) } /// Component-wise maximum between three vectors. -pub fn max3(a: &Vec, b: &Vec, c: &Vec) -> Vec +pub fn max3(a: &TVec, b: &TVec, c: &TVec) -> TVec where DefaultAllocator: Alloc { max2(&max2(a, b), c) } /// Component-wise maximum between four vectors. -pub fn max4(a: &Vec, b: &Vec, c: &Vec, d: &Vec) -> Vec +pub fn max4(a: &TVec, b: &TVec, c: &TVec, d: &TVec) -> TVec where DefaultAllocator: Alloc { max2(&max2(a, b), &max2(c, d)) } /// Component-wise minimum between a vector and a scalar. -pub fn min(x: &Vec, y: N) -> Vec +pub fn min(x: &TVec, y: N) -> TVec where DefaultAllocator: Alloc { x.map(|x| na::inf(&x, &y)) } /// Component-wise minimum between two vectors. -pub fn min2(x: &Vec, y: &Vec) -> Vec +pub fn min2(x: &TVec, y: &TVec) -> TVec where DefaultAllocator: Alloc { na::inf(x, y) } /// Component-wise minimum between three vectors. -pub fn min3(a: &Vec, b: &Vec, c: &Vec) -> Vec +pub fn min3(a: &TVec, b: &TVec, c: &TVec) -> TVec where DefaultAllocator: Alloc { min2(&min2(a, b), c) } /// Component-wise minimum between four vectors. -pub fn min4(a: &Vec, b: &Vec, c: &Vec, d: &Vec) -> Vec +pub fn min4(a: &TVec, b: &TVec, c: &TVec, d: &TVec) -> TVec where DefaultAllocator: Alloc { min2(&min2(a, b), &min2(c, d)) } diff --git a/nalgebra-glm/src/ext/vector_relational.rs b/nalgebra-glm/src/ext/vector_relational.rs index c7eeb1a5..7312dcf4 100644 --- a/nalgebra-glm/src/ext/vector_relational.rs +++ b/nalgebra-glm/src/ext/vector_relational.rs @@ -1,28 +1,28 @@ use na::{DefaultAllocator}; use traits::{Alloc, Number, Dimension}; -use aliases::Vec; +use aliases::TVec; /// Component-wise approximate equality of two vectors, using a scalar epsilon. -pub fn equal_eps(x: &Vec, y: &Vec, epsilon: N) -> Vec +pub fn equal_eps(x: &TVec, y: &TVec, epsilon: N) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| abs_diff_eq!(x, y, epsilon = epsilon)) } /// Component-wise approximate equality of two vectors, using a per-component epsilon. -pub fn equal_eps_vec(x: &Vec, y: &Vec, epsilon: &Vec) -> Vec +pub fn equal_eps_vec(x: &TVec, y: &TVec, epsilon: &TVec) -> TVec where DefaultAllocator: Alloc { x.zip_zip_map(y, epsilon, |x, y, eps| abs_diff_eq!(x, y, epsilon = eps)) } /// Component-wise approximate non-equality of two vectors, using a scalar epsilon. -pub fn not_equal_eps(x: &Vec, y: &Vec, epsilon: N) -> Vec +pub fn not_equal_eps(x: &TVec, y: &TVec, epsilon: N) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| abs_diff_ne!(x, y, epsilon = epsilon)) } /// Component-wise approximate non-equality of two vectors, using a per-component epsilon. -pub fn not_equal_eps_vec(x: &Vec, y: &Vec, epsilon: &Vec) -> Vec +pub fn not_equal_eps_vec(x: &TVec, y: &TVec, epsilon: &TVec) -> TVec where DefaultAllocator: Alloc { x.zip_zip_map(y, epsilon, |x, y, eps| abs_diff_ne!(x, y, epsilon = eps)) } diff --git a/nalgebra-glm/src/geometric.rs b/nalgebra-glm/src/geometric.rs index c3b7e9fe..a5d8ff10 100644 --- a/nalgebra-glm/src/geometric.rs +++ b/nalgebra-glm/src/geometric.rs @@ -1,7 +1,7 @@ use na::{Real, DefaultAllocator}; use traits::{Number, Alloc, Dimension}; -use aliases::{Vec, TVec3}; +use aliases::{TVec, TVec3}; /// The cross product of two vectors. pub fn cross(x: &TVec3, y: &TVec3) -> TVec3 { @@ -9,19 +9,19 @@ pub fn cross(x: &TVec3, y: &TVec3) -> TVec3 { } /// The distance between two points. -pub fn distance(p0: &Vec, p1: &Vec) -> N +pub fn distance(p0: &TVec, p1: &TVec) -> N where DefaultAllocator: Alloc { (p1 - p0).norm() } /// The dot product of two vectors. -pub fn dot(x: &Vec, y: &Vec) -> N +pub fn dot(x: &TVec, y: &TVec) -> N where DefaultAllocator: Alloc { x.dot(y) } /// If `dot(nref, i) < 0.0`, return `n`, otherwise, return `-n`. -pub fn faceforward(n: &Vec, i: &Vec, nref: &Vec) -> Vec +pub fn faceforward(n: &TVec, i: &TVec, nref: &TVec) -> TVec where DefaultAllocator: Alloc { if nref.dot(i) < N::zero() { n.clone() @@ -31,39 +31,39 @@ pub fn faceforward(n: &Vec, i: &Vec, nref: } /// The magnitude of a vector. -pub fn length(x: &Vec) -> N +pub fn length(x: &TVec) -> N where DefaultAllocator: Alloc { x.norm() } /// The magnitude of a vector. -pub fn magnitude(x: &Vec) -> N +pub fn magnitude(x: &TVec) -> N where DefaultAllocator: Alloc { x.norm() } /// Normalizes a vector. -pub fn normalize(x: &Vec) -> Vec +pub fn normalize(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.normalize() } /// For the incident vector `i` and surface orientation `n`, returns the reflection direction : `result = i - 2.0 * dot(n, i) * n`. -pub fn reflect_vec(i: &Vec, n: &Vec) -> Vec +pub fn reflect_vec(i: &TVec, n: &TVec) -> TVec where DefaultAllocator: Alloc { let _2 = N::one() + N::one(); i - n * (n.dot(i) * _2) } /// For the incident vector `i` and surface normal `n`, and the ratio of indices of refraction `eta`, return the refraction vector. -pub fn refract_vec(i: &Vec, n: &Vec, eta: N) -> Vec +pub fn refract_vec(i: &TVec, n: &TVec, eta: N) -> TVec where DefaultAllocator: Alloc { let ni = n.dot(i); let k = N::one() - eta * eta * (N::one() - ni * ni); if k < N::zero() { - Vec::<_, D>::zeros() + TVec::<_, D>::zeros() } else { i * eta - n * (eta * dot(n, i) + k.sqrt()) diff --git a/nalgebra-glm/src/gtc/bitfield.rs b/nalgebra-glm/src/gtc/bitfield.rs index e04768ef..65fbcce0 100644 --- a/nalgebra-glm/src/gtc/bitfield.rs +++ b/nalgebra-glm/src/gtc/bitfield.rs @@ -19,7 +19,7 @@ pub fn bitfieldFillOne(Value: IU, FirstBit: i32, BitCount: i32) -> IU { unimplemented!() } -pub fn bitfieldFillOne2(Value: &Vec, FirstBit: i32, BitCount: i32) -> Vec +pub fn bitfieldFillOne2(Value: &TVec, FirstBit: i32, BitCount: i32) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -28,7 +28,7 @@ pub fn bitfieldFillZero(Value: IU, FirstBit: i32, BitCount: i32) -> IU { unimplemented!() } -pub fn bitfieldFillZero2(Value: &Vec, FirstBit: i32, BitCount: i32) -> Vec +pub fn bitfieldFillZero2(Value: &TVec, FirstBit: i32, BitCount: i32) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -113,7 +113,7 @@ pub fn bitfieldRotateLeft(In: IU, Shift: i32) -> IU { unimplemented!() } -pub fn bitfieldRotateLeft2(In: &Vec, Shift: i32) -> Vec +pub fn bitfieldRotateLeft2(In: &TVec, Shift: i32) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -122,7 +122,7 @@ pub fn bitfieldRotateRight(In: IU, Shift: i32) -> IU { unimplemented!() } -pub fn bitfieldRotateRight2(In: &Vec, Shift: i32) -> Vec +pub fn bitfieldRotateRight2(In: &TVec, Shift: i32) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -131,7 +131,7 @@ pub fn mask(Bits: IU) -> IU { unimplemented!() } -pub fn mask2(v: &Vec) -> Vec +pub fn mask2(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } diff --git a/nalgebra-glm/src/gtc/epsilon.rs b/nalgebra-glm/src/gtc/epsilon.rs index bc505b88..604ed3e4 100644 --- a/nalgebra-glm/src/gtc/epsilon.rs +++ b/nalgebra-glm/src/gtc/epsilon.rs @@ -5,10 +5,10 @@ use approx::AbsDiffEq; use na::DefaultAllocator; use traits::{Alloc, Number, Dimension}; -use aliases::Vec; +use aliases::TVec; /// Component-wise approximate equality beween two vectors. -pub fn epsilon_equal(x: &Vec, y: &Vec, epsilon: N) -> Vec +pub fn epsilon_equal(x: &TVec, y: &TVec, epsilon: N) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| abs_diff_eq!(x, y, epsilon = epsilon)) } @@ -19,7 +19,7 @@ pub fn epsilon_equal2>(x: N, y: N, epsilon: N) -> bool } /// Component-wise approximate non-equality beween two vectors. -pub fn epsilon_not_equal(x: &Vec, y: &Vec, epsilon: N) -> Vec +pub fn epsilon_not_equal(x: &TVec, y: &TVec, epsilon: N) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| abs_diff_ne!(x, y, epsilon = epsilon)) } diff --git a/nalgebra-glm/src/gtc/integer.rs b/nalgebra-glm/src/gtc/integer.rs index 383316fd..a5f1cc8f 100644 --- a/nalgebra-glm/src/gtc/integer.rs +++ b/nalgebra-glm/src/gtc/integer.rs @@ -1,9 +1,9 @@ //use na::{Scalar, DefaultAllocator}; // //use traits::{Alloc, Dimension}; -//use aliases::Vec; +//use aliases::TVec; -//pub fn iround(x: &Vec) -> Vec +//pub fn iround(x: &TVec) -> TVec // where DefaultAllocator: Alloc { // x.map(|x| x.round()) //} @@ -12,7 +12,7 @@ // unimplemented!() //} // -//pub fn uround(x: &Vec) -> Vec +//pub fn uround(x: &TVec) -> TVec // where DefaultAllocator: Alloc { // unimplemented!() //} \ No newline at end of file diff --git a/nalgebra-glm/src/gtc/matrix_access.rs b/nalgebra-glm/src/gtc/matrix_access.rs index 03b67fa5..40509b72 100644 --- a/nalgebra-glm/src/gtc/matrix_access.rs +++ b/nalgebra-glm/src/gtc/matrix_access.rs @@ -1,16 +1,16 @@ use na::{Scalar, DefaultAllocator}; use traits::{Alloc, Dimension}; -use aliases::{Vec, Mat}; +use aliases::{TVec, TMat}; /// The `index`-th column of the matrix `m`. -pub fn column(m: &Mat, index: usize) -> Vec +pub fn column(m: &TMat, index: usize) -> TVec where DefaultAllocator: Alloc { m.column(index).into_owned() } /// Sets to `x` the `index`-th column of the matrix `m`. -pub fn set_column(m: &Mat, index: usize, x: &Vec) -> Mat +pub fn set_column(m: &TMat, index: usize, x: &TVec) -> TMat where DefaultAllocator: Alloc { let mut res = m.clone(); res.set_column(index, x); @@ -18,13 +18,13 @@ pub fn set_column(m: &Mat, index } /// The `index`-th row of the matrix `m`. -pub fn row(m: &Mat, index: usize) -> Vec +pub fn row(m: &TMat, index: usize) -> TVec where DefaultAllocator: Alloc { m.row(index).into_owned().transpose() } /// Sets to `x` the `index`-th row of the matrix `m`. -pub fn set_row(m: &Mat, index: usize, x: &Vec) -> Mat +pub fn set_row(m: &TMat, index: usize, x: &TVec) -> TMat where DefaultAllocator: Alloc { let mut res = m.clone(); res.set_row(index, &x.transpose()); diff --git a/nalgebra-glm/src/gtc/matrix_inverse.rs b/nalgebra-glm/src/gtc/matrix_inverse.rs index ea5f2e06..61861729 100644 --- a/nalgebra-glm/src/gtc/matrix_inverse.rs +++ b/nalgebra-glm/src/gtc/matrix_inverse.rs @@ -1,17 +1,17 @@ use na::{Real, DefaultAllocator}; use traits::{Alloc, Dimension}; -use aliases::Mat; +use aliases::TMat; /// Fast matrix inverse for affine matrix. -pub fn affine_inverse(m: Mat) -> Mat +pub fn affine_inverse(m: TMat) -> TMat where DefaultAllocator: Alloc { // FIXME: this should be optimized. - m.try_inverse().unwrap_or(Mat::<_, D, D>::zeros()) + m.try_inverse().unwrap_or(TMat::<_, D, D>::zeros()) } /// Compute the transpose of the inverse of a matrix. -pub fn inverse_transpose(m: Mat) -> Mat +pub fn inverse_transpose(m: TMat) -> TMat where DefaultAllocator: Alloc { - m.try_inverse().unwrap_or(Mat::<_, D, D>::zeros()).transpose() + m.try_inverse().unwrap_or(TMat::<_, D, D>::zeros()).transpose() } \ No newline at end of file diff --git a/nalgebra-glm/src/gtc/packing.rs b/nalgebra-glm/src/gtc/packing.rs index ea8097e6..414afe72 100644 --- a/nalgebra-glm/src/gtc/packing.rs +++ b/nalgebra-glm/src/gtc/packing.rs @@ -12,7 +12,7 @@ pub fn packF3x9_E1x5(v: &Vec3) -> i32 { unimplemented!() } -pub fn packHalf(v: &Vec) -> Vec +pub fn packHalf(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -53,7 +53,7 @@ pub fn packRGBM(rgb: &TVec3) -> TVec4 { unimplemented!() } -pub fn packSnorm(v: Vec) -> Vec +pub fn packSnorm(v: TVec) -> TVec where DefaultAllocator: Alloc + Alloc { unimplemented!() } @@ -102,7 +102,7 @@ pub fn packUint4x8(v: &U8Vec4) -> i32 { unimplemented!() } -pub fn packUnorm(v: &Vec) -> Vec +pub fn packUnorm(v: &TVec) -> TVec where DefaultAllocator: Alloc + Alloc { unimplemented!() } @@ -155,7 +155,7 @@ pub fn unpackF3x9_E1x5(p: i32) -> Vec3 { unimplemented!() } -pub fn unpackHalf(p: Vec) -> Vec +pub fn unpackHalf(p: TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -196,7 +196,7 @@ pub fn unpackRGBM(rgbm: &TVec4) -> TVec3 { unimplemented!() } -pub fn unpackSnorm(v: &Vec) -> Vec +pub fn unpackSnorm(v: &TVec) -> TVec where DefaultAllocator: Alloc + Alloc { unimplemented!() } @@ -245,7 +245,7 @@ pub fn unpackUint4x8(p: i32) -> U8Vec4 { unimplemented!() } -pub fn unpackUnorm(v: &Vec) -> Vec +pub fn unpackUnorm(v: &TVec) -> TVec where DefaultAllocator: Alloc + Alloc { unimplemented!() } diff --git a/nalgebra-glm/src/gtc/quaternion.rs b/nalgebra-glm/src/gtc/quaternion.rs index 0fe1f62c..51bbd968 100644 --- a/nalgebra-glm/src/gtc/quaternion.rs +++ b/nalgebra-glm/src/gtc/quaternion.rs @@ -1,6 +1,6 @@ use na::{Real, U4, UnitQuaternion}; -use aliases::{Qua, Vec, TVec3, TMat4}; +use aliases::{Qua, TVec, TVec3, TMat4}; /// Euler angles of the quaternion `q` as (pitch, yaw, roll). @@ -11,22 +11,22 @@ pub fn quat_euler_angles(x: &Qua) -> TVec3 { } /// Component-wise `>` comparison between two quaternions. -pub fn quat_greater_than(x: &Qua, y: &Qua) -> Vec { +pub fn quat_greater_than(x: &Qua, y: &Qua) -> TVec { ::greater_than(&x.coords, &y.coords) } /// Component-wise `>=` comparison between two quaternions. -pub fn quat_greater_than_equal(x: &Qua, y: &Qua) -> Vec { +pub fn quat_greater_than_equal(x: &Qua, y: &Qua) -> TVec { ::greater_than_equal(&x.coords, &y.coords) } /// Component-wise `<` comparison between two quaternions. -pub fn quat_less_than(x: &Qua, y: &Qua) -> Vec { +pub fn quat_less_than(x: &Qua, y: &Qua) -> TVec { ::less_than(&x.coords, &y.coords) } /// Component-wise `<=` comparison between two quaternions. -pub fn quat_less_than_equal(x: &Qua, y: &Qua) -> Vec { +pub fn quat_less_than_equal(x: &Qua, y: &Qua) -> TVec { ::less_than_equal(&x.coords, &y.coords) } diff --git a/nalgebra-glm/src/gtc/round.rs b/nalgebra-glm/src/gtc/round.rs index 8e08afda..75bd4462 100644 --- a/nalgebra-glm/src/gtc/round.rs +++ b/nalgebra-glm/src/gtc/round.rs @@ -1,14 +1,14 @@ use na::{Scalar, Real, U3, DefaultAllocator}; use traits::{Number, Alloc, Dimension}; -use aliases::Vec; +use aliases::TVec; pub fn ceilMultiple(v: T, Multiple: T) -> T { unimplemented!() } -pub fn ceilMultiple2(v: &Vec, Multiple: &Vec) -> Vec +pub fn ceilMultiple2(v: &TVec, Multiple: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -17,7 +17,7 @@ pub fn ceilPowerOfTwo(v: IU) -> IU { unimplemented!() } -pub fn ceilPowerOfTwo2(v: &Vec) -> Vec +pub fn ceilPowerOfTwo2(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -26,7 +26,7 @@ pub fn floorMultiple(v: T, Multiple: T) -> T { unimplemented!() } -pub fn floorMultiple2(v: &Vec, Multiple: &Vec) -> Vec +pub fn floorMultiple2(v: &TVec, Multiple: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -35,7 +35,7 @@ pub fn floorPowerOfTwo(v: IU) -> IU { unimplemented!() } -pub fn floorPowerOfTwo2(v: &Vec) -> Vec +pub fn floorPowerOfTwo2(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -44,12 +44,12 @@ pub fn isMultiple(v: IU, Multiple: IU) -> bool { unimplemented!() } -pub fn isMultiple2(v: &Vec,Multiple: N) -> Vec +pub fn isMultiple2(v: &TVec,Multiple: N) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn isMultiple3(v: &Vec, Multiple: &Vec) -> Vec +pub fn isMultiple3(v: &TVec, Multiple: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -58,7 +58,7 @@ pub fn isPowerOfTwo2(v: IU) -> bool { unimplemented!() } -pub fn isPowerOfTwo(v: &Vec) -> Vec +pub fn isPowerOfTwo(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -67,7 +67,7 @@ pub fn roundMultiple(v: T, Multiple: T) -> T { unimplemented!() } -pub fn roundMultiple2(v: &Vec, Multiple: &Vec) -> Vec +pub fn roundMultiple2(v: &TVec, Multiple: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -76,7 +76,7 @@ pub fn roundPowerOfTwo(v: IU) -> IU { unimplemented!() } -pub fn roundPowerOfTwo2(v: &Vec) -> Vec +pub fn roundPowerOfTwo2(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } diff --git a/nalgebra-glm/src/gtc/type_ptr.rs b/nalgebra-glm/src/gtc/type_ptr.rs index b8fe03e8..c4beaa58 100644 --- a/nalgebra-glm/src/gtc/type_ptr.rs +++ b/nalgebra-glm/src/gtc/type_ptr.rs @@ -1,7 +1,7 @@ use na::{Scalar, Real, DefaultAllocator, Quaternion}; use traits::{Number, Alloc, Dimension}; -use aliases::{Qua, Mat, TMat2, TMat3, TMat4, TVec1, TVec2, TVec3, TVec4, +use aliases::{Qua, TMat, TMat2, TMat3, TMat4, TVec1, TVec2, TVec3, TVec4, TMat2x3, TMat2x4, TMat3x2, TMat3x4, TMat4x2, TMat4x3}; /// Creates a 2x2 matrix from a slice arranged in column-major order. @@ -240,13 +240,13 @@ pub fn make_vec4(ptr: &[N]) -> TVec4 { } /// Converts a matrix or vector to a slice arranged in column-major order. -pub fn value_ptr(x: &Mat) -> &[N] +pub fn value_ptr(x: &TMat) -> &[N] where DefaultAllocator: Alloc { x.as_slice() } /// Converts a matrix or vector to a mutable slice arranged in column-major order. -pub fn value_ptr_mut(x: &mut Mat) -> &mut [N] +pub fn value_ptr_mut(x: &mut TMat) -> &mut [N] where DefaultAllocator: Alloc { x.as_mut_slice() } diff --git a/nalgebra-glm/src/gtc/ulp.rs b/nalgebra-glm/src/gtc/ulp.rs index 179b5eb4..860d73be 100644 --- a/nalgebra-glm/src/gtc/ulp.rs +++ b/nalgebra-glm/src/gtc/ulp.rs @@ -1,13 +1,13 @@ use na::{Scalar, U2}; -use aliases::Vec; +use aliases::TVec; pub fn float_distance(x: T, y: T) -> u64 { unimplemented!() } -pub fn float_distance2(x: &TVec2, y: &TVec2) -> Vec { +pub fn float_distance2(x: &TVec2, y: &TVec2) -> TVec { unimplemented!() } diff --git a/nalgebra-glm/src/gtx/component_wise.rs b/nalgebra-glm/src/gtx/component_wise.rs index acff2a93..e10f3ba2 100644 --- a/nalgebra-glm/src/gtx/component_wise.rs +++ b/nalgebra-glm/src/gtx/component_wise.rs @@ -1,28 +1,28 @@ use na::{self, DefaultAllocator}; use traits::{Number, Alloc, Dimension}; -use aliases::Mat; +use aliases::TMat; /// The sum of every components of the given matrix or vector. -pub fn comp_add(m: &Mat) -> N +pub fn comp_add(m: &TMat) -> N where DefaultAllocator: Alloc { m.iter().fold(N::zero(), |x, y| x + *y) } /// The maximum of every components of the given matrix or vector. -pub fn comp_max(m: &Mat) -> N +pub fn comp_max(m: &TMat) -> N where DefaultAllocator: Alloc { m.iter().fold(N::min_value(), |x, y| na::sup(&x, y)) } /// The minimum of every components of the given matrix or vector. -pub fn comp_min(m: &Mat) -> N +pub fn comp_min(m: &TMat) -> N where DefaultAllocator: Alloc { m.iter().fold(N::max_value(), |x, y| na::inf(&x, y)) } /// The product of every components of the given matrix or vector. -pub fn comp_mul(m: &Mat) -> N +pub fn comp_mul(m: &TMat) -> N where DefaultAllocator: Alloc { m.iter().fold(N::one(), |x, y| x * *y) } diff --git a/nalgebra-glm/src/gtx/euler_angles.rs b/nalgebra-glm/src/gtx/euler_angles.rs index f2b779e3..2c4940a6 100644 --- a/nalgebra-glm/src/gtx/euler_angles.rs +++ b/nalgebra-glm/src/gtx/euler_angles.rs @@ -1,6 +1,6 @@ use na::{Real, U3, U4}; -use aliases::{Vec, Mat}; +use aliases::{TVec, TMat}; pub fn derivedEulerAngleX(angleX: N, angularVelocityX: N) -> TMat4 { unimplemented!() diff --git a/nalgebra-glm/src/gtx/norm.rs b/nalgebra-glm/src/gtx/norm.rs index 37b5655c..a532fc3f 100644 --- a/nalgebra-glm/src/gtx/norm.rs +++ b/nalgebra-glm/src/gtx/norm.rs @@ -1,56 +1,56 @@ use na::{Real, DefaultAllocator}; use traits::{Alloc, Dimension}; -use aliases::Vec; +use aliases::TVec; /// The squared distance between two points. -pub fn distance2(p0: &Vec, p1: &Vec) -> N +pub fn distance2(p0: &TVec, p1: &TVec) -> N where DefaultAllocator: Alloc { (p1 - p0).norm_squared() } /// The l1-norm of `x - y`. -pub fn l1_distance(x: &Vec, y: &Vec) -> N +pub fn l1_distance(x: &TVec, y: &TVec) -> N where DefaultAllocator: Alloc { l1_norm(&(x - y)) } /// The l1-norm of `v`. -pub fn l1_norm(v: &Vec) -> N +pub fn l1_norm(v: &TVec) -> N where DefaultAllocator: Alloc { ::comp_add(&v.abs()) } /// The l2-norm of `x - y`. -pub fn l2_distance(x: &Vec, y: &Vec) -> N +pub fn l2_distance(x: &TVec, y: &TVec) -> N where DefaultAllocator: Alloc { l2_norm(&(y - x)) } /// The l2-norm of `v`. -pub fn l2_norm(x: &Vec) -> N +pub fn l2_norm(x: &TVec) -> N where DefaultAllocator: Alloc { x.norm() } /// The squared magnitude of `x`. -pub fn length2(x: &Vec) -> N +pub fn length2(x: &TVec) -> N where DefaultAllocator: Alloc { x.norm_squared() } /// The squared magnitude of `x`. -pub fn magnitude2(x: &Vec) -> N +pub fn magnitude2(x: &TVec) -> N where DefaultAllocator: Alloc { x.norm_squared() } -//pub fn lxNorm(x: &Vec, y: &Vec, unsigned int Depth) -> N +//pub fn lxNorm(x: &TVec, y: &TVec, unsigned int Depth) -> N // where DefaultAllocator: Alloc { // unimplemented!() //} // -//pub fn lxNorm(x: &Vec, unsigned int Depth) -> N +//pub fn lxNorm(x: &TVec, unsigned int Depth) -> N // where DefaultAllocator: Alloc { // unimplemented!() //} diff --git a/nalgebra-glm/src/gtx/normalize_dot.rs b/nalgebra-glm/src/gtx/normalize_dot.rs index 07855b2f..1aa2f0c3 100644 --- a/nalgebra-glm/src/gtx/normalize_dot.rs +++ b/nalgebra-glm/src/gtx/normalize_dot.rs @@ -1,17 +1,17 @@ use na::{Real, DefaultAllocator}; use traits::{Dimension, Alloc}; -use aliases::Vec; +use aliases::TVec; /// The dot product of the normalized version of `x` and `y`. -pub fn fast_normalize_dot(x: &Vec, y: &Vec) -> N +pub fn fast_normalize_dot(x: &TVec, y: &TVec) -> N where DefaultAllocator: Alloc { // XXX: improve those. x.normalize().dot(&y.normalize()) } /// The dot product of the normalized version of `x` and `y`. -pub fn normalize_dot(x: &Vec, y: &Vec) -> N +pub fn normalize_dot(x: &TVec, y: &TVec) -> N where DefaultAllocator: Alloc { // XXX: improve those. x.normalize().dot(&y.normalize()) diff --git a/nalgebra-glm/src/gtx/vector_angle.rs b/nalgebra-glm/src/gtx/vector_angle.rs index 352c1707..22deaaf5 100644 --- a/nalgebra-glm/src/gtx/vector_angle.rs +++ b/nalgebra-glm/src/gtx/vector_angle.rs @@ -1,11 +1,11 @@ use na::{DefaultAllocator, Real}; use traits::{Dimension, Alloc}; -use aliases::Vec; +use aliases::TVec; /// The angle between two vectors. -pub fn angle(x: &Vec, y: &Vec) -> N +pub fn angle(x: &TVec, y: &TVec) -> N where DefaultAllocator: Alloc { x.angle(y) } diff --git a/nalgebra-glm/src/gtx/vector_query.rs b/nalgebra-glm/src/gtx/vector_query.rs index 97acd49e..f73f2a1e 100644 --- a/nalgebra-glm/src/gtx/vector_query.rs +++ b/nalgebra-glm/src/gtx/vector_query.rs @@ -1,7 +1,7 @@ use na::{Real, DefaultAllocator}; use traits::{Number, Dimension, Alloc}; -use aliases::{Vec, TVec2, TVec3}; +use aliases::{TVec, TVec2, TVec3}; /// Returns `true` if two vectors are collinear (up to an epsilon). pub fn are_collinear(v0: &TVec3, v1: &TVec3, epsilon: N) -> bool { @@ -14,30 +14,30 @@ pub fn are_collinear2d(v0: &TVec2, v1: &TVec2, epsilon: N) -> b } /// Returns `true` if two vectors are orthogonal (up to an epsilon). -pub fn are_orthogonal(v0: &Vec, v1: &Vec, epsilon: N) -> bool +pub fn are_orthogonal(v0: &TVec, v1: &TVec, epsilon: N) -> bool where DefaultAllocator: Alloc { abs_diff_eq!(v0.dot(v1), N::zero(), epsilon = epsilon) } -//pub fn are_orthonormal(v0: &Vec, v1: &Vec, epsilon: N) -> bool +//pub fn are_orthonormal(v0: &TVec, v1: &TVec, epsilon: N) -> bool // where DefaultAllocator: Alloc { // unimplemented!() //} /// Returns `true` if all the components of `v` are zero (up to an epsilon). -pub fn is_comp_null(v: &Vec, epsilon: N) -> Vec +pub fn is_comp_null(v: &TVec, epsilon: N) -> TVec where DefaultAllocator: Alloc { v.map(|x| abs_diff_eq!(x, N::zero(), epsilon = epsilon)) } /// Returns `true` if `v` has a magnitude of 1 (up to an epsilon). -pub fn is_normalized(v: &Vec, epsilon: N) -> bool +pub fn is_normalized(v: &TVec, epsilon: N) -> bool where DefaultAllocator: Alloc { abs_diff_eq!(v.norm_squared(), N::one(), epsilon = epsilon * epsilon) } /// Returns `true` if `v` is zero (up to an epsilon). -pub fn is_null(v: &Vec, epsilon: N) -> bool +pub fn is_null(v: &TVec, epsilon: N) -> bool where DefaultAllocator: Alloc { - abs_diff_eq!(*v, Vec::::zeros(), epsilon = epsilon) + abs_diff_eq!(*v, TVec::::zeros(), epsilon = epsilon) } diff --git a/nalgebra-glm/src/integer.rs b/nalgebra-glm/src/integer.rs index 0a17c08e..67a0116c 100644 --- a/nalgebra-glm/src/integer.rs +++ b/nalgebra-glm/src/integer.rs @@ -1,28 +1,28 @@ use na::{Scalar, Real, U3, DefaultAllocator}; use traits::{Number, Alloc, Dimension}; -use aliases::Vec; +use aliases::TVec; pub fn bitCount(v: T) -> i32 { unimplemented!() } -pub fn bitCount2(v: &Vec) -> Vec +pub fn bitCount2(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn bitfieldExtract(Value: &Vec, Offset: i32, Bits: i32) -> Vec +pub fn bitfieldExtract(Value: &TVec, Offset: i32, Bits: i32) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn bitfieldInsert(Base: &Vec, Insert: &Vec, Offset: i32, Bits: i32) -> Vec +pub fn bitfieldInsert(Base: &TVec, Insert: &TVec, Offset: i32, Bits: i32) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn bitfieldReverse(v: &Vec) -> Vec +pub fn bitfieldReverse(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -31,7 +31,7 @@ pub fn findLSB(x: IU) -> u32 { unimplemented!() } -pub fn findLSB2(v: &Vec) -> Vec +pub fn findLSB2(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -40,27 +40,27 @@ pub fn findMSB(x: IU) -> i32 { unimplemented!() } -pub fn findMSB2(v: &Vec) -> Vec +pub fn findMSB2(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn imulExtended(x: &Vec, y: &Vec, msb: &Vec, lsb: &Vec) +pub fn imulExtended(x: &TVec, y: &TVec, msb: &TVec, lsb: &TVec) where DefaultAllocator: Alloc { unimplemented!() } -pub fn uaddCarry(x: &Vec, y: &Vec, carry: &Vec) -> Vec +pub fn uaddCarry(x: &TVec, y: &TVec, carry: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn umulExtended(x: &Vec, y: &Vec, msb: &Vec, lsb: &Vec) +pub fn umulExtended(x: &TVec, y: &TVec, msb: &TVec, lsb: &TVec) where DefaultAllocator: Alloc { unimplemented!() } -pub fn usubBorrow(x: &Vec, y: &Vec, borrow: &Vec) -> Vec +pub fn usubBorrow(x: &TVec, y: &TVec, borrow: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } diff --git a/nalgebra-glm/src/matrix.rs b/nalgebra-glm/src/matrix.rs index 13c04f27..a247a9bf 100644 --- a/nalgebra-glm/src/matrix.rs +++ b/nalgebra-glm/src/matrix.rs @@ -1,34 +1,34 @@ use na::{Scalar, Real, DefaultAllocator}; use traits::{Alloc, Dimension, Number}; -use aliases::{Mat, Vec}; +use aliases::{TMat, TVec}; /// The determinant of the matrix `m`. -pub fn determinant(m: &Mat) -> N +pub fn determinant(m: &TMat) -> N where DefaultAllocator: Alloc { m.determinant() } /// The inverse of the matrix `m`. -pub fn inverse(m: &Mat) -> Mat +pub fn inverse(m: &TMat) -> TMat where DefaultAllocator: Alloc { - m.clone().try_inverse().unwrap_or(Mat::::zeros()) + m.clone().try_inverse().unwrap_or(TMat::::zeros()) } /// Component-wise multiplication of two matrices. -pub fn matrix_comp_mult(x: &Mat, y: &Mat) -> Mat +pub fn matrix_comp_mult(x: &TMat, y: &TMat) -> TMat where DefaultAllocator: Alloc { x.component_mul(y) } /// Treats the first parameter `c` as a column vector and the second parameter `r` as a row vector and does a linear algebraic matrix multiply `c * r`. -pub fn outer_product(c: &Vec, r: &Vec) -> Mat +pub fn outer_product(c: &TVec, r: &TVec) -> TMat where DefaultAllocator: Alloc { c * r.transpose() } /// The transpose of the matrix `m`. -pub fn transpose(x: &Mat) -> Mat +pub fn transpose(x: &TMat) -> TMat where DefaultAllocator: Alloc { x.transpose() } \ No newline at end of file diff --git a/nalgebra-glm/src/trigonometric.rs b/nalgebra-glm/src/trigonometric.rs index d6b64653..e9f69ae5 100644 --- a/nalgebra-glm/src/trigonometric.rs +++ b/nalgebra-glm/src/trigonometric.rs @@ -1,95 +1,95 @@ use na::{self, Real, DefaultAllocator}; -use aliases::Vec; +use aliases::TVec; use traits::{Alloc, Dimension}; /// Component-wise arc-cosinus. -pub fn acos(x: &Vec) -> Vec +pub fn acos(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|e| e.acos()) } /// Component-wise hyperbolic arc-cosinus. -pub fn acosh(x: &Vec) -> Vec +pub fn acosh(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|e| e.acosh()) } /// Component-wise arc-sinus. -pub fn asin(x: &Vec) -> Vec +pub fn asin(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|e| e.asin()) } /// Component-wise hyperbolic arc-sinus. -pub fn asinh(x: &Vec) -> Vec +pub fn asinh(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|e| e.asinh()) } /// Component-wise arc-tangent of `y / x`. -pub fn atan2(y: &Vec, x: &Vec) -> Vec +pub fn atan2(y: &TVec, x: &TVec) -> TVec where DefaultAllocator: Alloc { y.zip_map(x, |y, x| y.atan2(x)) } /// Component-wise arc-tangent. -pub fn atan(y_over_x: &Vec) -> Vec +pub fn atan(y_over_x: &TVec) -> TVec where DefaultAllocator: Alloc { y_over_x.map(|e| e.atan()) } /// Component-wise hyperbolic arc-tangent. -pub fn atanh(x: &Vec) -> Vec +pub fn atanh(x: &TVec) -> TVec where DefaultAllocator: Alloc { x.map(|e| e.atanh()) } /// Component-wise cosinus. -pub fn cos(angle: &Vec) -> Vec +pub fn cos(angle: &TVec) -> TVec where DefaultAllocator: Alloc { angle.map(|e| e.cos()) } /// Component-wise hyperbolic cosinus. -pub fn cosh(angle: &Vec) -> Vec +pub fn cosh(angle: &TVec) -> TVec where DefaultAllocator: Alloc { angle.map(|e| e.cosh()) } /// Component-wise conversion from radians to degrees. -pub fn degrees(radians: &Vec) -> Vec +pub fn degrees(radians: &TVec) -> TVec where DefaultAllocator: Alloc { radians.map(|e| e * na::convert(180.0) / N::pi()) } /// Component-wise conversion fro degrees to radians. -pub fn radians(degrees: &Vec) -> Vec +pub fn radians(degrees: &TVec) -> TVec where DefaultAllocator: Alloc { degrees.map(|e| e * N::pi() / na::convert(180.0)) } /// Component-wise sinus. -pub fn sin(angle: &Vec) -> Vec +pub fn sin(angle: &TVec) -> TVec where DefaultAllocator: Alloc { angle.map(|e| e.sin()) } /// Component-wise hyperbolic sinus. -pub fn sinh(angle: &Vec) -> Vec +pub fn sinh(angle: &TVec) -> TVec where DefaultAllocator: Alloc { angle.map(|e| e.sinh()) } /// Component-wise tangent. -pub fn tan(angle: &Vec) -> Vec +pub fn tan(angle: &TVec) -> TVec where DefaultAllocator: Alloc { angle.map(|e| e.tan()) } /// Component-wise hyperbolic tangent. -pub fn tanh(angle: &Vec) -> Vec +pub fn tanh(angle: &TVec) -> TVec where DefaultAllocator: Alloc { angle.map(|e| e.tanh()) } diff --git a/nalgebra-glm/src/vector_relational.rs b/nalgebra-glm/src/vector_relational.rs index 00934621..09157a10 100644 --- a/nalgebra-glm/src/vector_relational.rs +++ b/nalgebra-glm/src/vector_relational.rs @@ -1,58 +1,58 @@ use na::{DefaultAllocator}; -use aliases::Vec; +use aliases::TVec; use traits::{Number, Alloc, Dimension}; /// Checks that all the vector components are `true`. -pub fn all(v: &Vec) -> bool +pub fn all(v: &TVec) -> bool where DefaultAllocator: Alloc { v.iter().all(|x| *x) } /// Checks that at least one of the vector components is `true`. -pub fn any(v: &Vec) -> bool +pub fn any(v: &TVec) -> bool where DefaultAllocator: Alloc { v.iter().any(|x| *x) } /// Component-wise equality comparison. -pub fn equal(x: &Vec, y: &Vec) -> Vec +pub fn equal(x: &TVec, y: &TVec) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x == y) } /// Component-wise `>` comparison. -pub fn greater_than(x: &Vec, y: &Vec) -> Vec +pub fn greater_than(x: &TVec, y: &TVec) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x > y) } /// Component-wise `>=` comparison. -pub fn greater_than_equal(x: &Vec, y: &Vec) -> Vec +pub fn greater_than_equal(x: &TVec, y: &TVec) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x >= y) } /// Component-wise `<` comparison. -pub fn less_than(x: &Vec, y: &Vec) -> Vec +pub fn less_than(x: &TVec, y: &TVec) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x < y) } /// Component-wise `>=` comparison. -pub fn less_than_equal(x: &Vec, y: &Vec) -> Vec +pub fn less_than_equal(x: &TVec, y: &TVec) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x <= y) } /// Component-wise not `!`. -pub fn not(v: &Vec) -> Vec +pub fn not(v: &TVec) -> TVec where DefaultAllocator: Alloc { v.map(|x| !x) } /// Component-wise not-equality `!=`. -pub fn not_equal(x: &Vec, y: &Vec) -> Vec +pub fn not_equal(x: &TVec, y: &TVec) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x != y) }