3rd year group project. Electronic and Electrical Engineering. Heriot-Watt University. This is the code for the mbed for the Automatic Little Object Organiser (ALOO).

Dependencies:   MCP23017 TCS3472_I2C WattBob_TextLCD mbed

Block.cpp

Committer:
dreamselec
Date:
2015-12-01
Revision:
29:9c0339e3c593
Parent:
26:bbcc25418ffa
Child:
30:c0bc92d009fe

File content as of revision 29:9c0339e3c593:

/*
 * Block.cpp
 *
 *  Created on: 16 Nov 2015
 *      Author: chandansiyag
 */

#include "Block.h"

Colour::Colour(){
	setRed(0);
	setBlue(0);
	setGreen(0);
	setAlpha(0);
}

Colour::~Colour(){

}

Colour::Colour(float components[4]){
	for (int i = 0; i < sizeof(components)/sizeof(*components); i++){
		this->components[i] = components[i];
	}
}

Colour::Colour(const Colour& rhs){
	setRed(rhs.getRed());
	setBlue(rhs.getBlue());
	setGreen(rhs.getGreen());
	setAlpha(rhs.getAlpha());
}

void Colour::printDescription(){
//	pc.printf("Red: %.3f, Green: %.3f, Blue: %.3f, Clear: %.3f\n", this->component[0], this->component[1], this->component[2], this->component[3]);
}

Block::Block(){
	this->size = Small;
	this->minColour = Colour();
	this->averageColour = Colour();
	this->maxColour = Colour();
	this->colour = Block::Red;
//		this->minError = {0, 0, 0, 0};
//	this->maxError = {0, 0, 0, 0};
}

Block::Block(Size size, BlockColour blockColour){
	this = Block();
	this->colour = blockColour;
	this->size = size;
}

Block::Block(Size size) {
	// TODO Auto-generated constructor stub
	this->size = size;
	this->minColour = Colour();
	this->maxColour = Colour();
	this->averageColour = Colour();
//		this->minError = {0, 0, 0, 0};
//	this->maxError = {0, 0, 0, 0};
}

Block::Block(Size size, Colour minColour, Colour maxColour, Colour averageColour){
	this->size = size;
	this->minColour = Colour(minColour);
	this->maxColour = Colour(maxColour);
	this->averageColour = Colour(averageColour);
//		this->minError = {0, 0, 0, 0};
//	this->maxError = {0, 0, 0, 0};
}

Block::Block(const Block& rhs){
	minColour = Colour(rhs.minColour);
	maxColour = Colour(rhs.maxColour);
	averageColour = Colour(rhs.averageColour);
	size = rhs.size;
//	minError = rhs.minError;
//	maxError = rhs.maxError;
}

Block::~Block() {
	// TODO Auto-generated destructor stub
}

void Block::printDescription(){
	
}