/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dataBase.search.distance;

import data.bins.Bins;
import dataBase.subPicture.Pixel;
import dataBase.subPicture.SubPicture;

/**
 *
 * @author Niklas
 */
public class Distance_L1 extends 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(aBins[i],bBins[i]);
			}
		}
		return sum;
	}

	@Override
	public float getDistance(float a, float b) {
		return  Math.abs(b - a);
	}

}
