2011-m2s3-city-builder/rules/route.cpp
2011-11-29 12:06:50 +01:00

31 lines
768 B
C++

#include "route.hh"
#include "../vertex.hh"
#include "../directions.hh"
Route::Route(Vertex ne, Vertex se, Vertex sw, Vertex nw) : Chose() {
corners[NE]=ne;
corners[SE]=se;
corners[SW]=sw;
corners[NW]=nw;
triangulation();
}
bool Route::subdivide() {
// TODO
return false;
}
std::ostream& operator<<(std::ostream& os, const Route* r) {
return os << *r;
}
std::ostream& operator<<(std::ostream& os, const Route& r) {
return os << "Route " << r.corners[NE] << "-" << r.corners[SE] << "-" << r.corners[NW] << "-" << r.corners[SW];
}
void Route::triangulation() {
triangles.reserve(2);
addTriangle(new Triangle(corners[SW], corners[NW], corners[NE], 0x6c, 0x6c, 0x6c));
addTriangle(new Triangle(corners[SW], corners[SE], corners[NE], 0x6c, 0x6c, 0x6c));
}