Here is one of the subclasses:
Code:
#include "quad.h"
#include "image.h"
#include <string>
#include <sstream>
Quad::Quad(std::string str){
stringstream ss(str);
ss >> fl >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4 >> r >> g >> b;
}
Quad::~Quad(){}
void Quad::draw(Image& i){
Vec3f col(r,g,b);
int avgx = (x1+x2+x3+x4)/4;
int avgy = (y1+y2+y3+y4)/4;
i.DrawLine(x1,y1,x2,y2,col);
i.DrawLine(x2,y2,x3,y3,col);
i.DrawLine(x3,y3,x4,y4,col);
i.DrawLine(x4,y4,x1,y1,col);
if(fl.compare("fill")==0){
fill(i,col,Vec2f(avgx,avgy));
fill(i,col,Vec2f((avgx+x1)/2,(avgy+y1)/2));
fill(i,col,Vec2f((avgx+x2)/2,(avgy+y2)/2));
fill(i,col,Vec2f((avgx+x3)/2,(avgy+y3)/2));
fill(i,col,Vec2f((avgx+x4)/2,(avgy+y4)/2));
}
}