added color check
This commit is contained in:
		@@ -12,6 +12,7 @@ set(SOURCE_FILES
 | 
				
			|||||||
        functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp
 | 
					        functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp
 | 
				
			||||||
        functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition.cpp
 | 
					        functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition.cpp
 | 
				
			||||||
        functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.cpp
 | 
					        functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.cpp
 | 
				
			||||||
 | 
					        functions/AbstractionLayers/Layer_ColorMatching/AbstractionLayer_ColorMatching.cpp
 | 
				
			||||||
        functions/AbstractionLayers/DestructionPower/DestructionPower.cpp
 | 
					        functions/AbstractionLayers/DestructionPower/DestructionPower.cpp
 | 
				
			||||||
        header/solve.h
 | 
					        header/solve.h
 | 
				
			||||||
        header/input.h
 | 
					        header/input.h
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,134 @@
 | 
				
			|||||||
 | 
					#include "AbstractionLayer_ColorMatching.h"
 | 
				
			||||||
 | 
					#include "../../../header.h"
 | 
				
			||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <bitset>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool AbstractionLayer_ColorMatching::PreProcessing(coor mySize, const vector<Part*>* partArray) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    InitialiseConstraintMatrixSize(mySize.col, mySize.row); //col row switched in this function
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //**Get color for constraint matrix**//
 | 
				
			||||||
 | 
					    Mat puzzle = imread("puzzle1.jpg", IMREAD_COLOR); // Read the picture of the puzzle
 | 
				
			||||||
 | 
					    if (puzzle.empty())                      // Check for invalid input
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        cout << "Could not open or find the image" << std::endl;
 | 
				
			||||||
 | 
					        return -1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    int width = puzzle.size().width;
 | 
				
			||||||
 | 
					    int height = puzzle.size().height;
 | 
				
			||||||
 | 
					    int X = width / mySize.col;
 | 
				
			||||||
 | 
					    int Y = height / mySize.row;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (int r = 0; r < mySize.row; r++) {
 | 
				
			||||||
 | 
					        for (int c = 0; c < mySize.col; c++) {
 | 
				
			||||||
 | 
					            Mat ExtPart = puzzle(CvRect(c*X, r*Y, X, Y));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // crop image to ROI
 | 
				
			||||||
 | 
					            Mat ExtPartCropped = ExtPart(
 | 
				
			||||||
 | 
					                    Rect(ExtPart.size().width / 3, ExtPart.size().height / 3, ExtPart.size().width / 3,
 | 
				
			||||||
 | 
					                         ExtPart.size().height / 3));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Create a new matrix to hold the HSV image
 | 
				
			||||||
 | 
					            Mat HSVExtPart;
 | 
				
			||||||
 | 
					            // convert RGB image to HSV
 | 
				
			||||||
 | 
					            cvtColor(ExtPartCropped, HSVExtPart, CV_BGR2HSV);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //namedWindow("ExtPartCropped", WINDOW_AUTOSIZE); // Create a window for display.
 | 
				
			||||||
 | 
					            //imshow("ExtPartCropped", ExtPartCropped);
 | 
				
			||||||
 | 
					            //waitKey(0); // Wait for a keystroke in the window
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            vector<Mat> hsv_planes_ext;
 | 
				
			||||||
 | 
					            split(HSVExtPart, hsv_planes_ext);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Scalar tempHue_ext = mean(hsv_planes_ext[0]);
 | 
				
			||||||
 | 
					            Scalar tempSaturation_ext = mean(hsv_planes_ext[1]);
 | 
				
			||||||
 | 
					            Scalar tempValue_ext = mean(hsv_planes_ext[2]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //cout << "Hue: " << tempHue_ext.val[0] << endl;
 | 
				
			||||||
 | 
					            //cout << "Saturation: " << tempSaturation_ext.val[0] << endl;
 | 
				
			||||||
 | 
					            //cout << "Value: " << tempValue_ext.val[0] << endl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            m_constraintMatrix[c][r].m_centerColor.h = tempHue_ext.val[0];
 | 
				
			||||||
 | 
					            m_constraintMatrix[c][r].m_centerColor.s = tempSaturation_ext.val[0];
 | 
				
			||||||
 | 
					            m_constraintMatrix[c][r].m_centerColor.v = tempSaturation_ext.val[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //**********************************************************//
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					            //**Get color of all parts**//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const vector<Part *> &ref_partArray = *partArray;
 | 
				
			||||||
 | 
					    int iterator = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for(int count =0;count< mySize.row*mySize.col*4;count++)// multiplied by 4 for all rotations
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Scalar tempHue, tempSaturation, tempValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(count%4) {
 | 
				
			||||||
 | 
					            char name[100];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            sprintf(name, PATH, count);
 | 
				
			||||||
 | 
					            Mat Part = imread(name, 1);
 | 
				
			||||||
 | 
					            if (!Part.data) {
 | 
				
			||||||
 | 
					                cerr << "Could not open or find the image" << endl;
 | 
				
			||||||
 | 
					                return -1;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Mat PartCropped = Part(Rect(Part.size().width / 3, Part.size().height / 3, Part.size().width / 3,
 | 
				
			||||||
 | 
					                                        Part.size().height / 3));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //namedWindow("PartCropped", WINDOW_AUTOSIZE); // Create a window for display.
 | 
				
			||||||
 | 
					            //imshow("PartCropped", PartCropped);
 | 
				
			||||||
 | 
					            //waitKey(0); // Wait for a keystroke in the window
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Create a new matrix to hold the HSV image
 | 
				
			||||||
 | 
					            Mat HSVPart;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // convert RGB image to HSV
 | 
				
			||||||
 | 
					            cvtColor(PartCropped, HSVPart, CV_BGR2HSV);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            vector<Mat> hsv_planes;
 | 
				
			||||||
 | 
					            split(HSVPart, hsv_planes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            tempHue = mean(hsv_planes[0]);
 | 
				
			||||||
 | 
					            tempSaturation = mean(hsv_planes[1]);
 | 
				
			||||||
 | 
					            tempValue = mean(hsv_planes[2]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //cout << "Hue: " << tempHue.val[0] << endl;
 | 
				
			||||||
 | 
					            //cout << "Saturation: " << tempSaturation.val[0] << endl;
 | 
				
			||||||
 | 
					            //cout << "Value: " << tempValue.val[0] << endl;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ref_partArray[iterator]->m_acm.m_centerColor.h = tempHue.val[0];
 | 
				
			||||||
 | 
					        ref_partArray[iterator]->m_acm.m_centerColor.s = tempSaturation.val[1];
 | 
				
			||||||
 | 
					        ref_partArray[iterator]->m_acm.m_centerColor.v = tempValue.val[2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        iterator ++;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool AbstractionLayer_ColorMatching::EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    for(int i = 0;i<qVector.size();i++)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        float value = PlaceOfPartGood(constraintCoordinate, qVector[i].second->m_acm.m_partColor);
 | 
				
			||||||
 | 
					        qVector[i].first = value;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					float AbstractionLayer_ColorMatching::PlaceOfPartGood(coor myCoor, HSV myPart)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    //Hue max 360°
 | 
				
			||||||
 | 
					    if(m_constraintMatrix[myCoor.col][myCoor.row].m_partColor.h >= 180)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return 1-abs((m_constraintMatrix[myCoor.col][myCoor.row].m_centerColor.h-myPart.h)
 | 
				
			||||||
 | 
					                     /m_constraintMatrix[myCoor.col][myCoor.row].m_centerColor.h);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else if(m_constraintMatrix[myCoor.col][myCoor.row].m_partColor.h < 180)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return 1-((myPart.h-m_constraintMatrix[myCoor.col][myCoor.row].m_centerColor.h)
 | 
				
			||||||
 | 
					                  /(360-m_constraintMatrix[myCoor.col][myCoor.row].m_centerColor.h));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef SOURCE_ABSTRACTIONLAYER_ColorMatching_H
 | 
				
			||||||
 | 
					#define SOURCE_ABSTRACTIONLAYER_ColorMatching_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "AbstractionLayer_ColorMatching_Properties.h"
 | 
				
			||||||
 | 
					#include "../AbstraktionLayer_Base.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//#include <utility>
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					//#include <bitset>
 | 
				
			||||||
 | 
					//#include <random>
 | 
				
			||||||
 | 
					#include "opencv2/highgui/highgui.hpp"
 | 
				
			||||||
 | 
					#include "opencv2/imgproc/imgproc.hpp"
 | 
				
			||||||
 | 
					//#include <cstdio>
 | 
				
			||||||
 | 
					//#include <cstdlib>
 | 
				
			||||||
 | 
					#include <cmath>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					//#define PATH "..\\..\\..\\pieces\\%04d.jpg"
 | 
				
			||||||
 | 
					#elif defined __unix__
 | 
				
			||||||
 | 
					#define PATH "..//..//..//pieces//%04d.jpg"
 | 
				
			||||||
 | 
					#elif defined __APPLE__
 | 
				
			||||||
 | 
					    #define PATH "..//..//..//pieces//%04d.jpg"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					using namespace std;
 | 
				
			||||||
 | 
					using namespace cv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class AbstractionLayer_ColorMatching : public AbstractionLayer_Base<AbstractionLayer_ColorMatching_Properties>
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    bool PreProcessing(coor mySize, const vector<Part*>* partArray) ;
 | 
				
			||||||
 | 
					    bool EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector);
 | 
				
			||||||
 | 
					    bool SetConstraintOnPosition(const coor constraintCoordinate,const AbstractionLayer_ColorMatching_Properties constraint){}
 | 
				
			||||||
 | 
					    bool RemoveConstraintOnPosition(const coor constraintCoordinate){}
 | 
				
			||||||
 | 
					   float PlaceOfPartGood(coor myCoor, HSV myPart);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    qualityVector returnInBox(vector<Part>& PuzzleBox);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif //SOURCE_ABSTRACTIONLAYER_ColorMatching_H
 | 
				
			||||||
@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef SOURCE_ABSTRACTIONLAYER_COLORMATCHING_H
 | 
				
			||||||
 | 
					#define SOURCE_ABSTRACTIONLAYER_COLORMATCHING_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <stdint.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class HSV
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    HSV(): h(0.0), s(0.0), v(0.0){}
 | 
				
			||||||
 | 
					    double h, s,v;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class AbstractionLayer_ColorMatching_Properties
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    AbstractionLayer_ColorMatching_Properties() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					    HSV m_centerColor;
 | 
				
			||||||
 | 
					    HSV m_partColor;
 | 
				
			||||||
 | 
					    friend class AbstractionLayer_ColorMatching;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif //SOURCE_ABSTRACTIONLAYER_COLORMATCHING_H
 | 
				
			||||||
@@ -68,6 +68,7 @@ void Puzzle::removeConstrains(coor removeCoordinates)
 | 
				
			|||||||
    this->a1.RemoveConstraintOnPosition(removeCoordinates);
 | 
					    this->a1.RemoveConstraintOnPosition(removeCoordinates);
 | 
				
			||||||
    this->a3.RemoveConstraintOnPosition(removeCoordinates);
 | 
					    this->a3.RemoveConstraintOnPosition(removeCoordinates);
 | 
				
			||||||
    this->a4.RemoveConstraintOnPosition(removeCoordinates);
 | 
					    this->a4.RemoveConstraintOnPosition(removeCoordinates);
 | 
				
			||||||
 | 
					    this->acm.RemoveConstraintOnPosition(removeCoordinates);
 | 
				
			||||||
    //TODO!! Add other layer remove here
 | 
					    //TODO!! Add other layer remove here
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece)
 | 
					void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece)
 | 
				
			||||||
@@ -85,6 +86,9 @@ void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    //a4
 | 
					    //a4
 | 
				
			||||||
    this->a4.SetConstraintOnPosition(setConstraints,constraintPiece->m_a4);
 | 
					    this->a4.SetConstraintOnPosition(setConstraints,constraintPiece->m_a4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //a2
 | 
				
			||||||
 | 
					    this->acm.SetConstraintOnPosition(setConstraints,constraintPiece->m_acm);
 | 
				
			||||||
    //TODO!! Add other layer remove here
 | 
					    //TODO!! Add other layer remove here
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,13 +80,17 @@ void solve(vector<LogEntry>& log,Puzzle& puzzleMat)
 | 
				
			|||||||
            puzzleMat.a1.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
 | 
					            puzzleMat.a1.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
 | 
				
			||||||
            //puzzleMat.a1.EvaluateQuality(log.back().myCoor, log.back().PieceCollector);
 | 
					            //puzzleMat.a1.EvaluateQuality(log.back().myCoor, log.back().PieceCollector);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
        case 1://SURFFeature
 | 
					        case 2://SURFFeature
 | 
				
			||||||
//            return;
 | 
					//            return;
 | 
				
			||||||
            puzzleMat.a4.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
 | 
					            puzzleMat.a4.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case 2://poempelposition
 | 
					        case 3://poempelposition
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
            puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
 | 
					            puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					        case 1://color
 | 
				
			||||||
 | 
					            puzzleMat.a4.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
        case -1://random
 | 
					        case -1://random
 | 
				
			||||||
            setsolution(log,puzzleMat);
 | 
					            setsolution(log,puzzleMat);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
@@ -116,11 +120,6 @@ void setsolution(vector<LogEntry>& log, Puzzle& puzzleMat)
 | 
				
			|||||||
    puzzleMat.setConstraints(log.back().myCoor,log.back().PieceCollector.begin()->second);
 | 
					    puzzleMat.setConstraints(log.back().myCoor,log.back().PieceCollector.begin()->second);
 | 
				
			||||||
    cout << "set:" << log.back().myCoor.col << "," << log.back().myCoor.row << endl;
 | 
					    cout << "set:" << log.back().myCoor.col << "," << log.back().myCoor.row << endl;
 | 
				
			||||||
    //cout << "ID: " << log.back().PieceCollector[0].second->GetPartID() << endl;
 | 
					    //cout << "ID: " << log.back().PieceCollector[0].second->GetPartID() << endl;
 | 
				
			||||||
    if(log.back().myCoor.col==32 && log.back().myCoor.row==16)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        puzzleMat.resultImage(log);
 | 
					 | 
				
			||||||
        waitKey(0);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool backtrack(vector<LogEntry>& log, Puzzle& puzzleMat)
 | 
					bool backtrack(vector<LogEntry>& log, Puzzle& puzzleMat)
 | 
				
			||||||
@@ -141,9 +140,9 @@ bool backtrack(vector<LogEntry>& log, Puzzle& puzzleMat)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //remove similar in log
 | 
					        //remove similar in log
 | 
				
			||||||
         //Part myPart = *log.back().PieceCollector[0].second;//tmpsaves bad part
 | 
					         Part myPart = *log.back().PieceCollector[0].second;//tmpsaves bad part
 | 
				
			||||||
          log.back().PieceCollector.erase(log.back().PieceCollector.begin());//removes bad part from log
 | 
					          log.back().PieceCollector.erase(log.back().PieceCollector.begin());//removes bad part from log
 | 
				
			||||||
          //puzzleMat.removeSimilar(log.back().PieceCollector,myPart); //removes all pieces from log that are similar to bad part
 | 
					          puzzleMat.removeSimilar(log.back().PieceCollector,myPart); //removes all pieces from log that are similar to bad part
 | 
				
			||||||
        //TODO reprogram similar removal to allow multilayer tracking
 | 
					        //TODO reprogram similar removal to allow multilayer tracking
 | 
				
			||||||
        if(log.back().PieceCollector.size()) // this checks if 'removeSimilar' has cleared entire LogElement
 | 
					        if(log.back().PieceCollector.size()) // this checks if 'removeSimilar' has cleared entire LogElement
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -224,13 +223,11 @@ float capLogElements(vector<LogEntry>& log)
 | 
				
			|||||||
            newid = id;
 | 
					            newid = id;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
//    if(log.back().abstractionLevel==0)
 | 
					    if(log.back().abstractionLevel==0)
 | 
				
			||||||
        cut(log,newid);
 | 
					        cut(log,newid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    vectorsizeAfter = log.back().PieceCollector.size();
 | 
					    vectorsizeAfter = log.back().PieceCollector.size();
 | 
				
			||||||
    destroyed = ((double)vectorsizeBefore - (double)vectorsizeAfter) / (double)vectorsizeBefore;
 | 
					    destroyed = ((double)vectorsizeBefore - (double)vectorsizeAfter) / (double)vectorsizeBefore;
 | 
				
			||||||
    if(log.back().abstractionLevel==1 && destroyed)
 | 
					 | 
				
			||||||
        cerr << "destroyed something!" << endl;
 | 
					 | 
				
			||||||
    return (float)sqrt(destroyed*maxdiff);
 | 
					    return (float)sqrt(destroyed*maxdiff);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@
 | 
				
			|||||||
#include "../functions/AbstractionLayers/Layer1/AbstractionLayer_1_Properties.h"
 | 
					#include "../functions/AbstractionLayers/Layer1/AbstractionLayer_1_Properties.h"
 | 
				
			||||||
#include "../functions/AbstractionLayers/DestructionPower/DestructionPower_Properties.h"
 | 
					#include "../functions/AbstractionLayers/DestructionPower/DestructionPower_Properties.h"
 | 
				
			||||||
#include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition_Properties.h"
 | 
					#include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition_Properties.h"
 | 
				
			||||||
 | 
					#include "../functions/AbstractionLayers/Layer_ColorMatching/AbstractionLayer_ColorMatching_Properties.h"
 | 
				
			||||||
#include "../functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures_Properties.h"
 | 
					#include "../functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures_Properties.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class LayerContainer;
 | 
					class LayerContainer;
 | 
				
			||||||
@@ -45,6 +46,7 @@ public:
 | 
				
			|||||||
    AbstractionLayer_1_Properties m_a1;
 | 
					    AbstractionLayer_1_Properties m_a1;
 | 
				
			||||||
    AbstractionLayer_PoempelPosition_Properties m_a3;
 | 
					    AbstractionLayer_PoempelPosition_Properties m_a3;
 | 
				
			||||||
    AbstractionLayer_SURFFeatures_Properties m_a4;
 | 
					    AbstractionLayer_SURFFeatures_Properties m_a4;
 | 
				
			||||||
 | 
					    AbstractionLayer_ColorMatching_Properties m_acm;
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    int32_t m_partID;
 | 
					    int32_t m_partID;
 | 
				
			||||||
    uint8_t m_numOfRotations;
 | 
					    uint8_t m_numOfRotations;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@
 | 
				
			|||||||
#include "../functions/AbstractionLayers/Layer1/AbstractionLayer_1.h"
 | 
					#include "../functions/AbstractionLayers/Layer1/AbstractionLayer_1.h"
 | 
				
			||||||
#include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition.h"
 | 
					#include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition.h"
 | 
				
			||||||
#include "../functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h"
 | 
					#include "../functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h"
 | 
				
			||||||
 | 
					#include "../functions/AbstractionLayers/Layer_ColorMatching/AbstractionLayer_ColorMatching.h"
 | 
				
			||||||
#include "../functions/AbstractionLayers/DestructionPower/DestructionPower.h"
 | 
					#include "../functions/AbstractionLayers/DestructionPower/DestructionPower.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using namespace std;
 | 
					using namespace std;
 | 
				
			||||||
@@ -58,6 +59,7 @@ public:
 | 
				
			|||||||
    AbstractionLayer_1 a1;
 | 
					    AbstractionLayer_1 a1;
 | 
				
			||||||
    AbstractionLayer_PoempelPosition a3;
 | 
					    AbstractionLayer_PoempelPosition a3;
 | 
				
			||||||
    AbstractionLayer_SURFFeatures a4;
 | 
					    AbstractionLayer_SURFFeatures a4;
 | 
				
			||||||
 | 
					    AbstractionLayer_ColorMatching acm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void removeConstrains(coor removeCoordinates);
 | 
					    void removeConstrains(coor removeCoordinates);
 | 
				
			||||||
    void setConstraints(coor setConstraints, Part *constraintPiece);
 | 
					    void setConstraints(coor setConstraints, Part *constraintPiece);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user