Skip to content

Commit

Permalink
Make matrix abs_diff_eq method take other by value.
Browse files Browse the repository at this point in the history
This is consistent with other types.
  • Loading branch information
bitshifter committed Jun 13, 2022
1 parent eb349af commit 0e49a54
Show file tree
Hide file tree
Showing 21 changed files with 30 additions and 26 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ The format is based on [Keep a Changelog], and this project adheres to
* Minimum Supported Version of Rust bumped to 1.57.0 to allow panicking in
constant evaluation.

### Removed

* Deleted deprecated `TransformRT` and `TransformSRT` types.

## [0.20.5] - 2022-04-12

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion codegen/templates/affine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ impl {{ self_t }} {
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline]
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: {{ scalar_t }}) -> bool {
self.matrix{{ dim }}.abs_diff_eq(&other.matrix{{ dim }}, max_abs_diff)
self.matrix{{ dim }}.abs_diff_eq(other.matrix{{ dim }}, max_abs_diff)
&& self
.translation
.abs_diff_eq(other.translation, max_abs_diff)
Expand Down
2 changes: 1 addition & 1 deletion codegen/templates/mat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ impl {{ self_t }} {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: {{ scalar_t }}) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: {{ scalar_t }}) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f32/affine2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl Affine2 {
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline]
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.matrix2.abs_diff_eq(&other.matrix2, max_abs_diff)
self.matrix2.abs_diff_eq(other.matrix2, max_abs_diff)
&& self
.translation
.abs_diff_eq(other.translation, max_abs_diff)
Expand Down
2 changes: 1 addition & 1 deletion src/f32/affine3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ impl Affine3A {
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline]
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.matrix3.abs_diff_eq(&other.matrix3, max_abs_diff)
self.matrix3.abs_diff_eq(other.matrix3, max_abs_diff)
&& self
.translation
.abs_diff_eq(other.translation, max_abs_diff)
Expand Down
2 changes: 1 addition & 1 deletion src/f32/mat3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl Mat3 {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f32/scalar/mat2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ impl Mat2 {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f32/scalar/mat3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl Mat3A {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f32/scalar/mat4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ impl Mat4 {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f32/sse2/mat2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl Mat2 {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f32/sse2/mat3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ impl Mat3A {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f32/sse2/mat4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ impl Mat4 {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f32/wasm32/mat2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl Mat2 {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f32/wasm32/mat3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ impl Mat3A {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f32/wasm32/mat4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ impl Mat4 {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f32) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f64/daffine2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl DAffine2 {
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline]
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f64) -> bool {
self.matrix2.abs_diff_eq(&other.matrix2, max_abs_diff)
self.matrix2.abs_diff_eq(other.matrix2, max_abs_diff)
&& self
.translation
.abs_diff_eq(other.translation, max_abs_diff)
Expand Down
2 changes: 1 addition & 1 deletion src/f64/daffine3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ impl DAffine3 {
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline]
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f64) -> bool {
self.matrix3.abs_diff_eq(&other.matrix3, max_abs_diff)
self.matrix3.abs_diff_eq(other.matrix3, max_abs_diff)
&& self
.translation
.abs_diff_eq(other.translation, max_abs_diff)
Expand Down
2 changes: 1 addition & 1 deletion src/f64/dmat2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl DMat2 {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f64) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f64) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f64/dmat3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ impl DMat3 {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f64) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f64) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
2 changes: 1 addition & 1 deletion src/f64/dmat4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ impl DMat4 {
/// For more see
/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#[inline(always)]
pub fn abs_diff_eq(&self, other: &Self, max_abs_diff: f64) -> bool {
pub fn abs_diff_eq(&self, other: Self, max_abs_diff: f64) -> bool {
self.0.abs_diff_eq(&other.0, max_abs_diff)
}

Expand Down
14 changes: 7 additions & 7 deletions tests/support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl FloatCompare for f64 {
impl FloatCompare for Mat2 {
#[inline]
fn approx_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
self.abs_diff_eq(other, max_abs_diff)
self.abs_diff_eq(*other, max_abs_diff)
}
#[inline]
fn abs_diff(&self, other: &Self) -> Self {
Expand All @@ -89,7 +89,7 @@ impl FloatCompare for Mat2 {
impl FloatCompare for DMat2 {
#[inline]
fn approx_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
self.abs_diff_eq(other, max_abs_diff as f64)
self.abs_diff_eq(*other, max_abs_diff as f64)
}
#[inline]
fn abs_diff(&self, other: &Self) -> Self {
Expand All @@ -103,7 +103,7 @@ impl FloatCompare for DMat2 {
impl FloatCompare for Mat3 {
#[inline]
fn approx_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
self.abs_diff_eq(other, max_abs_diff)
self.abs_diff_eq(*other, max_abs_diff)
}
#[inline]
fn abs_diff(&self, other: &Self) -> Self {
Expand All @@ -118,7 +118,7 @@ impl FloatCompare for Mat3 {
impl FloatCompare for Mat3A {
#[inline]
fn approx_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
self.abs_diff_eq(other, max_abs_diff)
self.abs_diff_eq(*other, max_abs_diff)
}
#[inline]
fn abs_diff(&self, other: &Self) -> Self {
Expand All @@ -133,7 +133,7 @@ impl FloatCompare for Mat3A {
impl FloatCompare for DMat3 {
#[inline]
fn approx_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
self.abs_diff_eq(other, max_abs_diff as f64)
self.abs_diff_eq(*other, max_abs_diff as f64)
}
#[inline]
fn abs_diff(&self, other: &Self) -> Self {
Expand All @@ -148,7 +148,7 @@ impl FloatCompare for DMat3 {
impl FloatCompare for DMat4 {
#[inline]
fn approx_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
self.abs_diff_eq(other, max_abs_diff as f64)
self.abs_diff_eq(*other, max_abs_diff as f64)
}
#[inline]
fn abs_diff(&self, other: &Self) -> Self {
Expand All @@ -164,7 +164,7 @@ impl FloatCompare for DMat4 {
impl FloatCompare for Mat4 {
#[inline]
fn approx_eq(&self, other: &Self, max_abs_diff: f32) -> bool {
self.abs_diff_eq(other, max_abs_diff)
self.abs_diff_eq(*other, max_abs_diff)
}
#[inline]
fn abs_diff(&self, other: &Self) -> Self {
Expand Down

0 comments on commit 0e49a54

Please sign in to comment.