From 9014e3e2593abd77af1d57c9d44d4c38204023ce Mon Sep 17 00:00:00 2001
From: Vitali Fedulov <fedulov.vitali@gmail.com>
Date: Tue, 30 Jan 2024 01:18:45 +0100
Subject: [PATCH] Added new func: CustomSimilar (3)

---
 custom.go      |  8 ++++----
 custom_test.go | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/custom.go b/custom.go
index 762eaf3..175e9fe 100644
--- a/custom.go
+++ b/custom.go
@@ -19,7 +19,7 @@ type CustomCoefficients struct {
 // if necessary. All coefficients set to 0 correspond to identical images,
 // for example an image file copy. All coefficients equal to 1 make func
 // CustomSimilar equivalent to func Similar.
-func CustomSimilar(iconA, iconB IconT, coeff *CustomCoefficients) bool {
+func CustomSimilar(iconA, iconB IconT, coeff CustomCoefficients) bool {
 
 	if !customPropSimilar(iconA, iconB, coeff) {
 		return false
@@ -30,11 +30,11 @@ func CustomSimilar(iconA, iconB IconT, coeff *CustomCoefficients) bool {
 	return true
 }
 
-func customPropSimilar(iconA, iconB IconT, coeff *CustomCoefficients) bool {
+func customPropSimilar(iconA, iconB IconT, coeff CustomCoefficients) bool {
 	return PropMetric(iconA, iconB) <= thProp*coeff.Prop
 }
 
-func customEucSimilar(iconA, iconB IconT, coeff *CustomCoefficients) bool {
+func customEucSimilar(iconA, iconB IconT, coeff CustomCoefficients) bool {
 
 	m1, m2, m3 := EucMetric(iconA, iconB)
 
@@ -45,7 +45,7 @@ func customEucSimilar(iconA, iconB IconT, coeff *CustomCoefficients) bool {
 
 // Similar90270 works like Similar, but also considers rotations of ±90°.
 // Those are rotations users might reasonably often do.
-func CustomSimilar90270(iconA, iconB IconT, coeff *CustomCoefficients) bool {
+func CustomSimilar90270(iconA, iconB IconT, coeff CustomCoefficients) bool {
 
 	if CustomSimilar(iconA, iconB, coeff) {
 		return true
diff --git a/custom_test.go b/custom_test.go
index 55be3d3..17e3455 100644
--- a/custom_test.go
+++ b/custom_test.go
@@ -19,7 +19,7 @@ func TestCustomSimilar(t *testing.T) {
 		t.Errorf("distorted.jpg is NOT similar to large.jpg")
 	}
 
-	if !CustomSimilar(icon1, icon2, &CustomCoefficients{1, 1, 1, 10}) {
+	if !CustomSimilar(icon1, icon2, CustomCoefficients{1, 1, 1, 10}) {
 		t.Errorf("distorted.jpg IS similar to large.jpg, assuming proportion differences are widely tolerated.")
 	}
 
@@ -36,36 +36,36 @@ func TestCustomSimilar(t *testing.T) {
 	}
 
 	// Luma.
-	if CustomSimilar(icon1, icon2, &CustomCoefficients{0, 1, 1, 1}) {
+	if CustomSimilar(icon1, icon2, CustomCoefficients{0, 1, 1, 1}) {
 		t.Errorf("1.jpg is NOT IDENTICAL to 2.jpg")
 	}
 
 	// Luma.
-	if CustomSimilar(icon1, icon2, &CustomCoefficients{0.4, 1, 1, 1}) {
+	if CustomSimilar(icon1, icon2, CustomCoefficients{0.4, 1, 1, 1}) {
 		t.Errorf("1.jpg is similar to 2.jpg, BUT NOT VERY SIMILAR")
 	}
 
 	// Chrominance b.
-	if CustomSimilar(icon1, icon2, &CustomCoefficients{1, 0.1, 1, 1}) {
+	if CustomSimilar(icon1, icon2, CustomCoefficients{1, 0.1, 1, 1}) {
 		t.Errorf("1.jpg is similar to 2.jpg, BUT NOT VERY SIMILAR")
 	}
 
 	// Chrominance c.
-	if CustomSimilar(icon1, icon2, &CustomCoefficients{1, 1, 0.1, 1}) {
+	if CustomSimilar(icon1, icon2, CustomCoefficients{1, 1, 0.1, 1}) {
 		t.Errorf("1.jpg is similar to 2.jpg, BUT NOT VERY SIMILAR")
 	}
 
 	// Image comparison to itself (or its own copy).
 
-	if !CustomSimilar(icon1, icon1, &CustomCoefficients{0, 0, 0, 0}) {
+	if !CustomSimilar(icon1, icon1, CustomCoefficients{0, 0, 0, 0}) {
 		t.Errorf("1.jpg IS IDENTICAL to itself")
 	}
 
-	if !CustomSimilar(icon1, icon1, &CustomCoefficients{0.5, 0.5, 0.5, 0.5}) {
+	if !CustomSimilar(icon1, icon1, CustomCoefficients{0.5, 0.5, 0.5, 0.5}) {
 		t.Errorf("1.jpg IS IDENTICAL to itself")
 	}
 
-	if !CustomSimilar(icon1, icon1, &CustomCoefficients{1, 1, 1, 1}) {
+	if !CustomSimilar(icon1, icon1, CustomCoefficients{1, 1, 1, 1}) {
 		t.Errorf("1.jpg IS IDENTICAL to itself")
 	}