#include "quad_patch.h"


QuadPatch::QuadPatch() {}


QuadPatch::QuadPatch(const Vector5d coefficients, const Transform transform)
		:_coefficients(coefficients),
		 _transform(transform),
		 _inverse_transform(transform.inverse()) {
}


double QuadPatch::operator()(double x, double y) {
	return _coefficients[0] * x*x
		+ _coefficients[1] * x*y
		+ _coefficients[2] * y*y
		+ _coefficients[3] * x
		+ _coefficients[4] * y;
}


double QuadPatch::operator[](size_t i) {
	return _coefficients[i];
}
