#include "AbstractionLayer_KantenLaenge.h" #include "../../../header.h" bool AbstractionLayer_KantenLaenge::PreProcessing(coor mySize, const vector* partArray) { //get layer information here cout << "Abstraction Poempel Position Preprocessing... " << flush; InitialiseConstraintMatrixSize(mySize.col, mySize.row); cout << "Done" << endl; return true; } //it through qualityVector and removes all that do not trigger PlaceOfPartGood bool AbstractionLayer_KantenLaenge::EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector) { for(int i = 0;im_a2.SideLength); qVector[i].first=value; } } bool AbstractionLayer_KantenLaenge::SetConstraintOnPosition(const coor constraintCoordinate, const AbstractionLayer_KantenLaenge_Properties constraint) { m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SideLength=constraint.SideLength; } bool AbstractionLayer_KantenLaenge::RemoveConstraintOnPosition(const coor constraintCoordinate) { m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SideLength={0,0,0,0,0,0,0,0}; } float AbstractionLayer_KantenLaenge::PlaceOfPartGood(coor myCoor, vector myPart) { vector comparePosition={0,0,0,0,0,0,0,0}; float sum=0; //create negativePart, watch out for edges if(myCoor.col>0 && m_constraintMatrix[myCoor.col-1][myCoor.row].SideLength[3])//get right data from left { comparePosition[6]=m_constraintMatrix[myCoor.col-1][myCoor.row].SideLength[3]; comparePosition[7]=m_constraintMatrix[myCoor.col-1][myCoor.row].SideLength[2]; //sum absolute difference sum+=abs(comparePosition[6]-myPart[6]); sum+=abs(comparePosition[7]-myPart[7]); } if(myCoor.row>0 && m_constraintMatrix[myCoor.col][myCoor.row-1].SideLength[5])//get bot data from top { comparePosition[0]=m_constraintMatrix[myCoor.col][myCoor.row-1].SideLength[5]; comparePosition[1]=m_constraintMatrix[myCoor.col][myCoor.row-1].SideLength[4]; //sum absolute difference sum+=abs(comparePosition[0]-myPart[0]); sum+=abs(comparePosition[1]-myPart[1]); } if(myCoor.col500) return 0; if(sum==0) return 1; sum/=500; return 1-sum; //check vector against negative part, use sad //return of well it fits within threshold } //shifts vector i steps to the right (8-2i to the left) void AbstractionLayer_KantenLaenge_Properties::shift(int i) { rotate(SideLength.begin(),SideLength.begin()+(8-2*i),SideLength.end()); }