aboutsummaryrefslogtreecommitdiff
path: root/evc/src/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'evc/src/helpers')
-rw-r--r--evc/src/helpers/matrix.rs2
-rw-r--r--evc/src/helpers/pixel.rs9
2 files changed, 6 insertions, 5 deletions
diff --git a/evc/src/helpers/matrix.rs b/evc/src/helpers/matrix.rs
index 87c0e7d..c3c120b 100644
--- a/evc/src/helpers/matrix.rs
+++ b/evc/src/helpers/matrix.rs
@@ -1,6 +1,6 @@
use crate::helpers::vector::Vec2;
-#[derive(Debug, Clone, Copy)]
+#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Mat2<T> {
pub a: T,
pub b: T,
diff --git a/evc/src/helpers/pixel.rs b/evc/src/helpers/pixel.rs
index 816d7dc..39fe98c 100644
--- a/evc/src/helpers/pixel.rs
+++ b/evc/src/helpers/pixel.rs
@@ -1,6 +1,6 @@
use crate::format::ser::{Ser, Sink, Source};
-#[derive(Copy, Clone, Debug, Default)]
+#[derive(Copy, Clone, Debug, Default, PartialEq)]
pub struct Pixel {
pub r: u8,
pub g: u8,
@@ -24,11 +24,12 @@ impl Pixel {
pub fn distance(a: Pixel, b: Pixel) -> usize {
let (rd, gd, bd) = (
a.r.abs_diff(b.r) as usize,
- a.r.abs_diff(b.r) as usize,
- a.r.abs_diff(b.r) as usize,
+ a.g.abs_diff(b.g) as usize,
+ a.b.abs_diff(b.b) as usize,
);
// fast_sqrt(rd * rd + gd * gd + bd * bd)
- SQRT[rd + gd + bd]
+ // SQRT[rd + gd + bd]
+ rd + gd + bd
}
#[inline]