Layer logic done, dispatcher simplified
This commit is contained in:
@ -18,12 +18,7 @@ bool AbstractionLayer_PoempelPosition::EvaluateQuality (const coor constraintCoo
|
||||
for(int i = 0;i<qVector.size();i++)
|
||||
{
|
||||
float value = PlaceOfPartGood(constraintCoordinate, qVector[i].second->m_a3.SideLength);
|
||||
if(value > 0.8)//TODO find threshold
|
||||
{
|
||||
qVector[i].first=value;
|
||||
continue;
|
||||
}
|
||||
qVector[i].first=0;
|
||||
qVector[i].first=value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,14 +32,54 @@ bool AbstractionLayer_PoempelPosition::RemoveConstraintOnPosition(const coor con
|
||||
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SideLength={0,0,0,0,0,0,0,0};
|
||||
}
|
||||
|
||||
float AbstractionLayer_PoempelPosition::PlaceOfPartGood(coor myCoor, vector<float> myPart)
|
||||
float AbstractionLayer_PoempelPosition::PlaceOfPartGood(coor myCoor, vector<double> myPart)
|
||||
{
|
||||
//sets coordinates to correct position for layer
|
||||
|
||||
vector<double> 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]);
|
||||
|
||||
//check vector against negative part
|
||||
}
|
||||
if(myCoor.col<m_constraintMatrix.size()-1 && m_constraintMatrix[myCoor.col+1][myCoor.row].SideLength[7])// get left data from right
|
||||
{
|
||||
comparePosition[2]=m_constraintMatrix[myCoor.col+1][myCoor.row].SideLength[7];
|
||||
comparePosition[3]=m_constraintMatrix[myCoor.col+1][myCoor.row].SideLength[6];
|
||||
//sum absolute difference
|
||||
sum+=abs(comparePosition[2]-myPart[2]);
|
||||
sum+=abs(comparePosition[3]-myPart[3]);
|
||||
|
||||
}
|
||||
|
||||
if(myCoor.row<m_constraintMatrix[0].size()-1 && m_constraintMatrix[myCoor.col][myCoor.row+1].SideLength[1])//get top data from bot
|
||||
{
|
||||
comparePosition[4]=m_constraintMatrix[myCoor.col][myCoor.row+1].SideLength[1];
|
||||
comparePosition[5]=m_constraintMatrix[myCoor.col][myCoor.row+1].SideLength[0];
|
||||
//sum absolute difference
|
||||
sum+=abs(comparePosition[4]-myPart[4]);
|
||||
sum+=abs(comparePosition[5]-myPart[5]);
|
||||
|
||||
}
|
||||
if(sum>100)
|
||||
return 0;
|
||||
if(sum==0)
|
||||
return 1;
|
||||
sum/=100;
|
||||
return 1-sum;
|
||||
//check vector against negative part, use sad
|
||||
//return of well it fits within threshold
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
bool SetConstraintOnPosition( coor constraintCoordinate, AbstractionLayer_PoempelPosition_Properties constraint)final;
|
||||
bool RemoveConstraintOnPosition( coor constraintCoordinate)final;
|
||||
|
||||
float PlaceOfPartGood(coor myCoor, vector<float> myPart);
|
||||
float PlaceOfPartGood(coor myCoor, vector<double> myPart);
|
||||
|
||||
private:
|
||||
};
|
@ -10,8 +10,9 @@ public:
|
||||
void shift(int i);
|
||||
private:
|
||||
|
||||
vector<float> SideLength;
|
||||
vector<double> SideLength;
|
||||
friend class AbstractionLayer_PoempelPosition;
|
||||
friend class AbstractionLayer_1;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user