package dataBase.search.distance;

import dataBase.subPicture.Pixel;
import dataBase.subPicture.SubPicture;

public abstract class AbstractDistance {

	@Override
	public float getDistance(SubPicture a, SubPicture b) {

		float sum=0;
		Pixel[][] pixelsA = a.pixels;
		Pixel[][] pixelsB = b.pixels;
		int partsX = SubPicture.partsX;
		int partsY = SubPicture.partsY;

		for(int i=0; i<partsY; i++){
			for(int j=0; j<partsX; j++){
				sum += getDistance(pixelsA[i][j],pixelsB[i][j]);
			}
		}
		return sum;
	}
	
	abstract public float getDistance(Pixel a, Pixel b);
}
