From 6c236af6962a1c85b13ac59c131a8feea1bede41 Mon Sep 17 00:00:00 2001 From: Avi Weinstock Date: Thu, 21 Nov 2019 16:43:58 -0500 Subject: [PATCH] Add Scalar + Copy bounds to code that's under feature flags. `./ci/test.sh` now passes locally. Refactoring done via the following sed commands: ```bash export RELEVANT_SOURCEFILES="$(find src -name '*.rs') $(find examples -name '*.rs')" for f in $RELEVANT_SOURCEFILES; do sed -i 's/N\([0-9]\?\): *Scalar + \(Arbitrary\)/N\1: Scalar + Copy + \2/' $f; done for f in $RELEVANT_SOURCEFILES; do sed -i 's/N\([0-9]\?\): *Scalar + \(Serialize\)/N\1: Scalar + Copy + \2/' $f; done for f in $RELEVANT_SOURCEFILES; do sed -i 's/N\([0-9]\?\): *Scalar + \(Deserialize\)/N\1: Scalar + Copy + \2/' $f; do export RELEVANT_SOURCEFILES="$(find nalgebra-glm -name '*.rs')" for f in $RELEVANT_SOURCEFILES; do sed -i 's/N\([0-9]\?\): *Scalar,/N\1: Scalar + Copy,/' $f; done for f in $RELEVANT_SOURCEFILES; do sed -i 's/N\([0-9]\?\): *Scalar>/N\1: Scalar + Copy>/' $f; done for f in algebra-glm/src/traits.rs; do sed -i 's/Scalar + Ring/Scalar + Copy + Ring>/' $f; done # Number trait definition ``` --- nalgebra-glm/src/common.rs | 6 +-- nalgebra-glm/src/constructors.rs | 32 ++++++------- nalgebra-glm/src/gtc/bitfield.rs | 10 ++-- nalgebra-glm/src/gtc/integer.rs | 4 +- nalgebra-glm/src/gtc/matrix_access.rs | 8 ++-- nalgebra-glm/src/gtc/packing.rs | 6 +-- nalgebra-glm/src/gtc/round.rs | 18 +++---- nalgebra-glm/src/gtc/type_ptr.rs | 60 ++++++++++++------------ nalgebra-glm/src/gtc/ulp.rs | 2 +- nalgebra-glm/src/integer.rs | 20 ++++---- nalgebra-glm/src/matrix.rs | 2 +- nalgebra-glm/src/packing.rs | 24 +++++----- nalgebra-glm/src/traits.rs | 8 ++-- src/base/array_storage.rs | 6 +-- src/base/construction.rs | 2 +- src/geometry/point_construction.rs | 2 +- src/geometry/translation_construction.rs | 2 +- 17 files changed, 106 insertions(+), 106 deletions(-) diff --git a/nalgebra-glm/src/common.rs b/nalgebra-glm/src/common.rs index eda9f295..5cebbc3d 100644 --- a/nalgebra-glm/src/common.rs +++ b/nalgebra-glm/src/common.rs @@ -297,13 +297,13 @@ where DefaultAllocator: Alloc { v.map(int_bits_to_float) } -//pub fn isinf(x: &TVec) -> TVec +//pub fn isinf(x: &TVec) -> TVec // where DefaultAllocator: Alloc { // unimplemented!() // //} // -//pub fn isnan(x: &TVec) -> TVec +//pub fn isnan(x: &TVec) -> TVec // where DefaultAllocator: Alloc { // unimplemented!() // @@ -504,7 +504,7 @@ where DefaultAllocator: Alloc { x.map(|x| x.round()) } -//pub fn roundEven(x: &TVec) -> TVec +//pub fn roundEven(x: &TVec) -> TVec // where DefaultAllocator: Alloc { // unimplemented!() //} diff --git a/nalgebra-glm/src/constructors.rs b/nalgebra-glm/src/constructors.rs index 949ea9e4..93d06e45 100644 --- a/nalgebra-glm/src/constructors.rs +++ b/nalgebra-glm/src/constructors.rs @@ -15,28 +15,28 @@ use crate::aliases::{TMat, Qua, TVec1, TVec2, TVec3, TVec4, TMat2, TMat2x3, TMat /// # use nalgebra_glm as glm; /// let v = glm::vec1(true); /// ``` -pub fn vec1(x: N) -> TVec1 { +pub fn vec1(x: N) -> TVec1 { TVec1::new(x) } /// Creates a new 2D vector. -pub fn vec2(x: N, y: N) -> TVec2 { +pub fn vec2(x: N, y: N) -> TVec2 { TVec2::new(x, y) } /// Creates a new 3D vector. -pub fn vec3(x: N, y: N, z: N) -> TVec3 { +pub fn vec3(x: N, y: N, z: N) -> TVec3 { TVec3::new(x, y, z) } /// Creates a new 4D vector. -pub fn vec4(x: N, y: N, z: N, w: N) -> TVec4 { +pub fn vec4(x: N, y: N, z: N, w: N) -> TVec4 { TVec4::new(x, y, z, w) } /// Create a new 2x2 matrix. -pub fn mat2(m11: N, m12: N, +pub fn mat2(m11: N, m12: N, m21: N, m22: N) -> TMat2 { TMat::::new( m11, m12, @@ -45,7 +45,7 @@ pub fn mat2(m11: N, m12: N, } /// Create a new 2x2 matrix. -pub fn mat2x2(m11: N, m12: N, +pub fn mat2x2(m11: N, m12: N, m21: N, m22: N) -> TMat2 { TMat::::new( m11, m12, @@ -54,7 +54,7 @@ pub fn mat2x2(m11: N, m12: N, } /// Create a new 2x3 matrix. -pub fn mat2x3(m11: N, m12: N, m13: N, +pub fn mat2x3(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N) -> TMat2x3 { TMat::::new( m11, m12, m13, @@ -63,7 +63,7 @@ pub fn mat2x3(m11: N, m12: N, m13: N, } /// Create a new 2x4 matrix. -pub fn mat2x4(m11: N, m12: N, m13: N, m14: N, +pub fn mat2x4(m11: N, m12: N, m13: N, m14: N, m21: N, m22: N, m23: N, m24: N) -> TMat2x4 { TMat::::new( m11, m12, m13, m14, @@ -72,7 +72,7 @@ pub fn mat2x4(m11: N, m12: N, m13: N, m14: N, } /// Create a new 3x3 matrix. -pub fn mat3(m11: N, m12: N, m13: N, +pub fn mat3(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N, m31: N, m32: N, m33: N) -> TMat3 { TMat::::new( @@ -83,7 +83,7 @@ pub fn mat3(m11: N, m12: N, m13: N, } /// Create a new 3x2 matrix. -pub fn mat3x2(m11: N, m12: N, +pub fn mat3x2(m11: N, m12: N, m21: N, m22: N, m31: N, m32: N) -> TMat3x2 { TMat::::new( @@ -94,7 +94,7 @@ pub fn mat3x2(m11: N, m12: N, } /// Create a new 3x3 matrix. -pub fn mat3x3(m11: N, m12: N, m13: N, +pub fn mat3x3(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N, m31: N, m32: N, m33: N) -> TMat3 { TMat::::new( @@ -105,7 +105,7 @@ pub fn mat3x3(m11: N, m12: N, m13: N, } /// Create a new 3x4 matrix. -pub fn mat3x4(m11: N, m12: N, m13: N, m14: N, +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 { TMat::::new( @@ -116,7 +116,7 @@ pub fn mat3x4(m11: N, m12: N, m13: N, m14: N, } /// Create a new 4x2 matrix. -pub fn mat4x2(m11: N, m12: N, +pub fn mat4x2(m11: N, m12: N, m21: N, m22: N, m31: N, m32: N, m41: N, m42: N) -> TMat4x2 { @@ -129,7 +129,7 @@ pub fn mat4x2(m11: N, m12: N, } /// Create a new 4x3 matrix. -pub fn mat4x3(m11: N, m12: N, m13: N, +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 { @@ -142,7 +142,7 @@ pub fn mat4x3(m11: N, m12: N, m13: N, } /// Create a new 4x4 matrix. -pub fn mat4x4(m11: N, m12: N, m13: N, m14: N, +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 { @@ -155,7 +155,7 @@ pub fn mat4x4(m11: N, m12: N, m13: N, m14: N, } /// Create a new 4x4 matrix. -pub fn mat4(m11: N, m12: N, m13: N, m14: N, +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 { diff --git a/nalgebra-glm/src/gtc/bitfield.rs b/nalgebra-glm/src/gtc/bitfield.rs index bdf18552..5e4f7063 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: &TVec, FirstBit: i32, BitCount: i32) -> TVec +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: &TVec, FirstBit: i32, BitCount: i32) -> TVec +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: &TVec, Shift: i32) -> TVec +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: &TVec, Shift: i32) -> TVec +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: &TVec) -> TVec +pub fn mask2(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } diff --git a/nalgebra-glm/src/gtc/integer.rs b/nalgebra-glm/src/gtc/integer.rs index a972a4ab..146b874c 100644 --- a/nalgebra-glm/src/gtc/integer.rs +++ b/nalgebra-glm/src/gtc/integer.rs @@ -3,7 +3,7 @@ //use crate::traits::{Alloc, Dimension}; //use crate::aliases::TVec; -//pub fn iround(x: &TVec) -> TVec +//pub fn iround(x: &TVec) -> TVec // where DefaultAllocator: Alloc { // x.map(|x| x.round()) //} @@ -12,7 +12,7 @@ // unimplemented!() //} // -//pub fn uround(x: &TVec) -> TVec +//pub fn uround(x: &TVec) -> TVec // where DefaultAllocator: Alloc { // unimplemented!() //} diff --git a/nalgebra-glm/src/gtc/matrix_access.rs b/nalgebra-glm/src/gtc/matrix_access.rs index f61d9782..2f9bb5fa 100644 --- a/nalgebra-glm/src/gtc/matrix_access.rs +++ b/nalgebra-glm/src/gtc/matrix_access.rs @@ -10,7 +10,7 @@ use crate::traits::{Alloc, Dimension}; /// * [`row`](fn.row.html) /// * [`set_column`](fn.set_column.html) /// * [`set_row`](fn.set_row.html) -pub fn column( +pub fn column( m: &TMat, index: usize, ) -> TVec @@ -27,7 +27,7 @@ where /// * [`column`](fn.column.html) /// * [`row`](fn.row.html) /// * [`set_row`](fn.set_row.html) -pub fn set_column( +pub fn set_column( m: &TMat, index: usize, x: &TVec, @@ -47,7 +47,7 @@ where /// * [`column`](fn.column.html) /// * [`set_column`](fn.set_column.html) /// * [`set_row`](fn.set_row.html) -pub fn row(m: &TMat, index: usize) -> TVec +pub fn row(m: &TMat, index: usize) -> TVec where DefaultAllocator: Alloc { m.row(index).into_owned().transpose() } @@ -59,7 +59,7 @@ where DefaultAllocator: Alloc { /// * [`column`](fn.column.html) /// * [`row`](fn.row.html) /// * [`set_column`](fn.set_column.html) -pub fn set_row( +pub fn set_row( m: &TMat, index: usize, x: &TVec, diff --git a/nalgebra-glm/src/gtc/packing.rs b/nalgebra-glm/src/gtc/packing.rs index ea5acac4..1306eca3 100644 --- a/nalgebra-glm/src/gtc/packing.rs +++ b/nalgebra-glm/src/gtc/packing.rs @@ -49,7 +49,7 @@ pub fn packInt4x8(v: &I8Vec4) -> i32 { unimplemented!() } -pub fn packRGBM(rgb: &TVec3) -> TVec4 { +pub fn packRGBM(rgb: &TVec3) -> TVec4 { unimplemented!() } @@ -155,7 +155,7 @@ pub fn unpackF3x9_E1x5(p: i32) -> Vec3 { unimplemented!() } -pub fn unpackHalf(p: TVec) -> TVec +pub fn unpackHalf(p: TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } @@ -192,7 +192,7 @@ pub fn unpackInt4x8(p: i32) -> I8Vec4 { unimplemented!() } -pub fn unpackRGBM(rgbm: &TVec4) -> TVec3 { +pub fn unpackRGBM(rgbm: &TVec4) -> TVec3 { unimplemented!() } diff --git a/nalgebra-glm/src/gtc/round.rs b/nalgebra-glm/src/gtc/round.rs index 5ad95780..d1ca295b 100644 --- a/nalgebra-glm/src/gtc/round.rs +++ b/nalgebra-glm/src/gtc/round.rs @@ -8,7 +8,7 @@ pub fn ceilMultiple(v: T, Multiple: T) -> T { unimplemented!() } -pub fn ceilMultiple2(v: &TVec, Multiple: &TVec) -> TVec +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: &TVec) -> TVec +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: &TVec, Multiple: &TVec) -> TVec +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: &TVec) -> TVec +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: &TVec,Multiple: N) -> TVec +pub fn isMultiple2(v: &TVec,Multiple: N) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn isMultiple3(v: &TVec, Multiple: &TVec) -> TVec +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: &TVec) -> TVec +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: &TVec, Multiple: &TVec) -> TVec +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: &TVec) -> TVec +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 4029bf01..92309e93 100644 --- a/nalgebra-glm/src/gtc/type_ptr.rs +++ b/nalgebra-glm/src/gtc/type_ptr.rs @@ -7,62 +7,62 @@ use crate::aliases::{ use crate::traits::{Alloc, Dimension, Number}; /// Creates a 2x2 matrix from a slice arranged in column-major order. -pub fn make_mat2(ptr: &[N]) -> TMat2 { +pub fn make_mat2(ptr: &[N]) -> TMat2 { TMat2::from_column_slice(ptr) } /// Creates a 2x2 matrix from a slice arranged in column-major order. -pub fn make_mat2x2(ptr: &[N]) -> TMat2 { +pub fn make_mat2x2(ptr: &[N]) -> TMat2 { TMat2::from_column_slice(ptr) } /// Creates a 2x3 matrix from a slice arranged in column-major order. -pub fn make_mat2x3(ptr: &[N]) -> TMat2x3 { +pub fn make_mat2x3(ptr: &[N]) -> TMat2x3 { TMat2x3::from_column_slice(ptr) } /// Creates a 2x4 matrix from a slice arranged in column-major order. -pub fn make_mat2x4(ptr: &[N]) -> TMat2x4 { +pub fn make_mat2x4(ptr: &[N]) -> TMat2x4 { TMat2x4::from_column_slice(ptr) } /// Creates a 3 matrix from a slice arranged in column-major order. -pub fn make_mat3(ptr: &[N]) -> TMat3 { +pub fn make_mat3(ptr: &[N]) -> TMat3 { TMat3::from_column_slice(ptr) } /// Creates a 3x2 matrix from a slice arranged in column-major order. -pub fn make_mat3x2(ptr: &[N]) -> TMat3x2 { +pub fn make_mat3x2(ptr: &[N]) -> TMat3x2 { TMat3x2::from_column_slice(ptr) } /// Creates a 3x3 matrix from a slice arranged in column-major order. -pub fn make_mat3x3(ptr: &[N]) -> TMat3 { +pub fn make_mat3x3(ptr: &[N]) -> TMat3 { TMat3::from_column_slice(ptr) } /// Creates a 3x4 matrix from a slice arranged in column-major order. -pub fn make_mat3x4(ptr: &[N]) -> TMat3x4 { +pub fn make_mat3x4(ptr: &[N]) -> TMat3x4 { TMat3x4::from_column_slice(ptr) } /// Creates a 4x4 matrix from a slice arranged in column-major order. -pub fn make_mat4(ptr: &[N]) -> TMat4 { +pub fn make_mat4(ptr: &[N]) -> TMat4 { TMat4::from_column_slice(ptr) } /// Creates a 4x2 matrix from a slice arranged in column-major order. -pub fn make_mat4x2(ptr: &[N]) -> TMat4x2 { +pub fn make_mat4x2(ptr: &[N]) -> TMat4x2 { TMat4x2::from_column_slice(ptr) } /// Creates a 4x3 matrix from a slice arranged in column-major order. -pub fn make_mat4x3(ptr: &[N]) -> TMat4x3 { +pub fn make_mat4x3(ptr: &[N]) -> TMat4x3 { TMat4x3::from_column_slice(ptr) } /// Creates a 4x4 matrix from a slice arranged in column-major order. -pub fn make_mat4x4(ptr: &[N]) -> TMat4 { +pub fn make_mat4x4(ptr: &[N]) -> TMat4 { TMat4::from_column_slice(ptr) } @@ -75,7 +75,7 @@ pub fn mat2_to_mat3(m: &TMat2) -> TMat3 { } /// Converts a 3x3 matrix to a 2x2 matrix. -pub fn mat3_to_mat2(m: &TMat3) -> TMat2 { +pub fn mat3_to_mat2(m: &TMat3) -> TMat2 { TMat2::new(m.m11, m.m12, m.m21, m.m22) } @@ -90,7 +90,7 @@ pub fn mat3_to_mat4(m: &TMat3) -> TMat4 { } /// Converts a 4x4 matrix to a 3x3 matrix. -pub fn mat4_to_mat3(m: &TMat4) -> TMat3 { +pub fn mat4_to_mat3(m: &TMat4) -> TMat3 { TMat3::new( m.m11, m.m12, m.m13, m.m21, m.m22, m.m23, m.m31, m.m32, m.m33, ) @@ -107,7 +107,7 @@ pub fn mat2_to_mat4(m: &TMat2) -> TMat4 { } /// Converts a 4x4 matrix to a 2x2 matrix. -pub fn mat4_to_mat2(m: &TMat4) -> TMat2 { +pub fn mat4_to_mat2(m: &TMat4) -> TMat2 { TMat2::new(m.m11, m.m12, m.m21, m.m22) } @@ -123,7 +123,7 @@ pub fn make_quat(ptr: &[N]) -> Qua { /// * [`make_vec2`](fn.make_vec2.html) /// * [`make_vec3`](fn.make_vec3.html) /// * [`make_vec4`](fn.make_vec4.html) -pub fn make_vec1(v: &TVec1) -> TVec1 { +pub fn make_vec1(v: &TVec1) -> TVec1 { *v } @@ -137,7 +137,7 @@ pub fn make_vec1(v: &TVec1) -> TVec1 { /// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec3`](fn.vec1_to_vec3.html) /// * [`vec1_to_vec4`](fn.vec1_to_vec4.html) -pub fn vec2_to_vec1(v: &TVec2) -> TVec1 { +pub fn vec2_to_vec1(v: &TVec2) -> TVec1 { TVec1::new(v.x) } @@ -151,7 +151,7 @@ pub fn vec2_to_vec1(v: &TVec2) -> TVec1 { /// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec3`](fn.vec1_to_vec3.html) /// * [`vec1_to_vec4`](fn.vec1_to_vec4.html) -pub fn vec3_to_vec1(v: &TVec3) -> TVec1 { +pub fn vec3_to_vec1(v: &TVec3) -> TVec1 { TVec1::new(v.x) } @@ -165,7 +165,7 @@ pub fn vec3_to_vec1(v: &TVec3) -> TVec1 { /// * [`vec1_to_vec2`](fn.vec1_to_vec2.html) /// * [`vec1_to_vec3`](fn.vec1_to_vec3.html) /// * [`vec1_to_vec4`](fn.vec1_to_vec4.html) -pub fn vec4_to_vec1(v: &TVec4) -> TVec1 { +pub fn vec4_to_vec1(v: &TVec4) -> TVec1 { TVec1::new(v.x) } @@ -196,7 +196,7 @@ pub fn vec1_to_vec2(v: &TVec1) -> TVec2 { /// * [`vec2_to_vec2`](fn.vec2_to_vec2.html) /// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec4`](fn.vec2_to_vec4.html) -pub fn vec2_to_vec2(v: &TVec2) -> TVec2 { +pub fn vec2_to_vec2(v: &TVec2) -> TVec2 { *v } @@ -210,7 +210,7 @@ pub fn vec2_to_vec2(v: &TVec2) -> TVec2 { /// * [`vec2_to_vec2`](fn.vec2_to_vec2.html) /// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec4`](fn.vec2_to_vec4.html) -pub fn vec3_to_vec2(v: &TVec3) -> TVec2 { +pub fn vec3_to_vec2(v: &TVec3) -> TVec2 { TVec2::new(v.x, v.y) } @@ -224,7 +224,7 @@ pub fn vec3_to_vec2(v: &TVec3) -> TVec2 { /// * [`vec2_to_vec2`](fn.vec2_to_vec2.html) /// * [`vec2_to_vec3`](fn.vec2_to_vec3.html) /// * [`vec2_to_vec4`](fn.vec2_to_vec4.html) -pub fn vec4_to_vec2(v: &TVec4) -> TVec2 { +pub fn vec4_to_vec2(v: &TVec4) -> TVec2 { TVec2::new(v.x, v.y) } @@ -235,7 +235,7 @@ pub fn vec4_to_vec2(v: &TVec4) -> TVec2 { /// * [`make_vec1`](fn.make_vec1.html) /// * [`make_vec3`](fn.make_vec3.html) /// * [`make_vec4`](fn.make_vec4.html) -pub fn make_vec2(ptr: &[N]) -> TVec2 { +pub fn make_vec2(ptr: &[N]) -> TVec2 { TVec2::from_column_slice(ptr) } @@ -280,7 +280,7 @@ pub fn vec2_to_vec3(v: &TVec2) -> TVec3 { /// * [`vec3_to_vec1`](fn.vec3_to_vec1.html) /// * [`vec3_to_vec2`](fn.vec3_to_vec2.html) /// * [`vec3_to_vec4`](fn.vec3_to_vec4.html) -pub fn vec3_to_vec3(v: &TVec3) -> TVec3 { +pub fn vec3_to_vec3(v: &TVec3) -> TVec3 { *v } @@ -294,7 +294,7 @@ pub fn vec3_to_vec3(v: &TVec3) -> TVec3 { /// * [`vec3_to_vec1`](fn.vec3_to_vec1.html) /// * [`vec3_to_vec2`](fn.vec3_to_vec2.html) /// * [`vec3_to_vec4`](fn.vec3_to_vec4.html) -pub fn vec4_to_vec3(v: &TVec4) -> TVec3 { +pub fn vec4_to_vec3(v: &TVec4) -> TVec3 { TVec3::new(v.x, v.y, v.z) } @@ -305,7 +305,7 @@ pub fn vec4_to_vec3(v: &TVec4) -> TVec3 { /// * [`make_vec1`](fn.make_vec1.html) /// * [`make_vec2`](fn.make_vec2.html) /// * [`make_vec4`](fn.make_vec4.html) -pub fn make_vec3(ptr: &[N]) -> TVec3 { +pub fn make_vec3(ptr: &[N]) -> TVec3 { TVec3::from_column_slice(ptr) } @@ -367,7 +367,7 @@ pub fn vec3_to_vec4(v: &TVec3) -> TVec4 { /// * [`vec4_to_vec1`](fn.vec4_to_vec1.html) /// * [`vec4_to_vec2`](fn.vec4_to_vec2.html) /// * [`vec4_to_vec3`](fn.vec4_to_vec3.html) -pub fn vec4_to_vec4(v: &TVec4) -> TVec4 { +pub fn vec4_to_vec4(v: &TVec4) -> TVec4 { *v } @@ -378,18 +378,18 @@ pub fn vec4_to_vec4(v: &TVec4) -> TVec4 { /// * [`make_vec1`](fn.make_vec1.html) /// * [`make_vec2`](fn.make_vec2.html) /// * [`make_vec3`](fn.make_vec3.html) -pub fn make_vec4(ptr: &[N]) -> TVec4 { +pub fn make_vec4(ptr: &[N]) -> TVec4 { TVec4::from_column_slice(ptr) } /// Converts a matrix or vector to a slice arranged in column-major order. -pub fn value_ptr(x: &TMat) -> &[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 TMat) -> &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 8258d0df..42ef2d05 100644 --- a/nalgebra-glm/src/gtc/ulp.rs +++ b/nalgebra-glm/src/gtc/ulp.rs @@ -7,7 +7,7 @@ pub fn float_distance(x: T, y: T) -> u64 { unimplemented!() } -pub fn float_distance2(x: &TVec2, y: &TVec2) -> TVec { +pub fn float_distance2(x: &TVec2, y: &TVec2) -> TVec { unimplemented!() } diff --git a/nalgebra-glm/src/integer.rs b/nalgebra-glm/src/integer.rs index 198d737a..3a2641e0 100644 --- a/nalgebra-glm/src/integer.rs +++ b/nalgebra-glm/src/integer.rs @@ -7,22 +7,22 @@ pub fn bitCount(v: T) -> i32 { unimplemented!() } -pub fn bitCount2(v: &TVec) -> TVec +pub fn bitCount2(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn bitfieldExtract(Value: &TVec, Offset: i32, Bits: i32) -> TVec +pub fn bitfieldExtract(Value: &TVec, Offset: i32, Bits: i32) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn bitfieldInsert(Base: &TVec, Insert: &TVec, Offset: i32, Bits: i32) -> TVec +pub fn bitfieldInsert(Base: &TVec, Insert: &TVec, Offset: i32, Bits: i32) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn bitfieldReverse(v: &TVec) -> TVec +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: &TVec) -> TVec +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: &TVec) -> TVec +pub fn findMSB2(v: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn imulExtended(x: &TVec, y: &TVec, msb: &TVec, lsb: &TVec) +pub fn imulExtended(x: &TVec, y: &TVec, msb: &TVec, lsb: &TVec) where DefaultAllocator: Alloc { unimplemented!() } -pub fn uaddCarry(x: &TVec, y: &TVec, carry: &TVec) -> TVec +pub fn uaddCarry(x: &TVec, y: &TVec, carry: &TVec) -> TVec where DefaultAllocator: Alloc { unimplemented!() } -pub fn umulExtended(x: &TVec, y: &TVec, msb: &TVec, lsb: &TVec) +pub fn umulExtended(x: &TVec, y: &TVec, msb: &TVec, lsb: &TVec) where DefaultAllocator: Alloc { unimplemented!() } -pub fn usubBorrow(x: &TVec, y: &TVec, borrow: &TVec) -> TVec +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 a4c4efe9..e83687dc 100644 --- a/nalgebra-glm/src/matrix.rs +++ b/nalgebra-glm/src/matrix.rs @@ -40,7 +40,7 @@ where } /// The transpose of the matrix `m`. -pub fn transpose(x: &TMat) -> TMat +pub fn transpose(x: &TMat) -> TMat where DefaultAllocator: Alloc { x.transpose() } diff --git a/nalgebra-glm/src/packing.rs b/nalgebra-glm/src/packing.rs index 3273fb26..641ad159 100644 --- a/nalgebra-glm/src/packing.rs +++ b/nalgebra-glm/src/packing.rs @@ -3,50 +3,50 @@ use na::Scalar; use crate::aliases::{Vec2, Vec4, UVec2}; -pub fn packDouble2x32(v: &UVec2) -> f64 { +pub fn packDouble2x32(v: &UVec2) -> f64 { unimplemented!() } -pub fn packHalf2x16(v: &Vec2) -> u32 { +pub fn packHalf2x16(v: &Vec2) -> u32 { unimplemented!() } -pub fn packSnorm2x16(v: &Vec2) -> u32 { +pub fn packSnorm2x16(v: &Vec2) -> u32 { unimplemented!() } -pub fn packSnorm4x8(v: &Vec4) -> u32 { +pub fn packSnorm4x8(v: &Vec4) -> u32 { unimplemented!() } -pub fn packUnorm2x16(v: &Vec2) -> u32 { +pub fn packUnorm2x16(v: &Vec2) -> u32 { unimplemented!() } -pub fn packUnorm4x8(v: &Vec4) -> u32 { +pub fn packUnorm4x8(v: &Vec4) -> u32 { unimplemented!() } -pub fn unpackDouble2x32(v: f64) -> UVec2 { +pub fn unpackDouble2x32(v: f64) -> UVec2 { unimplemented!() } -pub fn unpackHalf2x16(v: u32) -> Vec2 { +pub fn unpackHalf2x16(v: u32) -> Vec2 { unimplemented!() } -pub fn unpackSnorm2x16(p: u32) -> Vec2 { +pub fn unpackSnorm2x16(p: u32) -> Vec2 { unimplemented!() } -pub fn unpackSnorm4x8(p: u32) -> Vec4 { +pub fn unpackSnorm4x8(p: u32) -> Vec4 { unimplemented!() } -pub fn unpackUnorm2x16(p: u32) -> Vec2 { +pub fn unpackUnorm2x16(p: u32) -> Vec2 { unimplemented!() } -pub fn unpackUnorm4x8(p: u32) -> Vec4 { +pub fn unpackUnorm4x8(p: u32) -> Vec4 { unimplemented!() } diff --git a/nalgebra-glm/src/traits.rs b/nalgebra-glm/src/traits.rs index d338539d..ac3aa667 100644 --- a/nalgebra-glm/src/traits.rs +++ b/nalgebra-glm/src/traits.rs @@ -11,16 +11,16 @@ impl> Dimension for D {} /// A number that can either be an integer or a float. pub trait Number: - Scalar + Ring + Lattice + AbsDiffEq + Signed + FromPrimitive + Bounded + Scalar + Copy + Ring + Lattice + AbsDiffEq + Signed + FromPrimitive + Bounded { } -impl + Signed + FromPrimitive + Bounded> +impl + Signed + FromPrimitive + Bounded> Number for T {} #[doc(hidden)] -pub trait Alloc: +pub trait Alloc: Allocator + Allocator + Allocator @@ -50,7 +50,7 @@ pub trait Alloc: { } -impl Alloc for T where T: Allocator +impl Alloc for T where T: Allocator + Allocator + Allocator + Allocator diff --git a/src/base/array_storage.rs b/src/base/array_storage.rs index 38144d8a..17247356 100644 --- a/src/base/array_storage.rs +++ b/src/base/array_storage.rs @@ -253,7 +253,7 @@ where #[cfg(feature = "serde-serialize")] impl Serialize for ArrayStorage where - N: Scalar + Serialize, + N: Scalar + Copy + Serialize, R: DimName, C: DimName, R::Value: Mul, @@ -274,7 +274,7 @@ where #[cfg(feature = "serde-serialize")] impl<'a, N, R, C> Deserialize<'a> for ArrayStorage where - N: Scalar + Deserialize<'a>, + N: Scalar + Copy + Deserialize<'a>, R: DimName, C: DimName, R::Value: Mul, @@ -312,7 +312,7 @@ where #[cfg(feature = "serde-serialize")] impl<'a, N, R, C> Visitor<'a> for ArrayStorageVisitor where - N: Scalar + Deserialize<'a>, + N: Scalar + Copy + Deserialize<'a>, R: DimName, C: DimName, R::Value: Mul, diff --git a/src/base/construction.rs b/src/base/construction.rs index c28c043b..d7f1fef8 100644 --- a/src/base/construction.rs +++ b/src/base/construction.rs @@ -781,7 +781,7 @@ impl Arbitrary for MatrixMN where R: Dim, C: Dim, - N: Scalar + Arbitrary + Send, + N: Scalar + Copy + Arbitrary + Send, DefaultAllocator: Allocator, Owned: Clone + Send, { diff --git a/src/geometry/point_construction.rs b/src/geometry/point_construction.rs index 47d0e7e8..530c18a8 100644 --- a/src/geometry/point_construction.rs +++ b/src/geometry/point_construction.rs @@ -138,7 +138,7 @@ where } #[cfg(feature = "arbitrary")] -impl Arbitrary for Point +impl Arbitrary for Point where DefaultAllocator: Allocator, >::Buffer: Send, diff --git a/src/geometry/translation_construction.rs b/src/geometry/translation_construction.rs index 266b4b3b..370fbf63 100644 --- a/src/geometry/translation_construction.rs +++ b/src/geometry/translation_construction.rs @@ -59,7 +59,7 @@ where } #[cfg(feature = "arbitrary")] -impl Arbitrary for Translation +impl Arbitrary for Translation where DefaultAllocator: Allocator, Owned: Send,