vector4 vector4::Transform(const vector2& v, const matrix& m) { vector4 result = vector4( (v.x() * m(0,0)) + (v.y() * m(1,0)) + m(3,0), (v.x() * m(0,1)) + (v.y() * m(1,1)) + m(3,1), (v.x() * m(0,2)) + (v.y() * m(1,2)) + m(3,2), (v.x() * m(0,3)) + (v.y() * m(1,3)) + m(3,3)); return result; }
const vector2 vector2::operator / (const vector2 &v2) const { vector2 r; r.x() = x() / v2.x(); r.y() = y() / v2.y(); return r; }
static vector2 trunk(const vector2& v, number smallestVal) { vector2 t; t.x() = smallestVal * round(v.x() / smallestVal); t.y() = smallestVal * round(v.y() / smallestVal); return t; }
vector2 vector2::Transform(const vector2& v, const matrix& m) { vector2 result = vector2( (v.x() * m(0,0)) + (v.y() * m(0,1)) + m(3,0), (v.x() * m(1,0)) + (v.y() * m(1,1)) + m(3,1)); return result; }
bool QtWindowSystem::init(const vector2<int>& r, int /*bpp*/, bool /*fullscreen*/) { if (view_ == nullptr) { // check for Qt Application class instance if (QApplication::instance() == nullptr) { int argc = 0; static QApplication application(argc, nullptr); } view_ = new QtView; view_->setGeometry(0, 0, r.x(), r.y()); set_format(WindowContextFormat()); } return true; }
// Equality operations bool vector2::operator == (const vector2 &v) const { return ((x() == v.x()) && (y() == v.y())); }
// Returns the dot product of two vectors float vector2::Dot(const vector2 &v2) const { return ((x() * v2.x()) + (y() * v2.y())); }
vector3::vector3(const vector2& source, float z) { v[0] = source.x(), v[1] = source.y(), v[2] = z; }