Пример #1
0
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;
	
}
Пример #2
0
const vector2 vector2::operator / (const vector2 &v2) const
{
	vector2 r;
	r.x() = x() / v2.x();
	r.y() = y() / v2.y();
	return r;
}
Пример #3
0
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;
}
Пример #4
0
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;
	
}
Пример #5
0
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;
}
Пример #6
0
// Equality operations
bool vector2::operator == (const vector2 &v) const
{
	return ((x() == v.x()) && (y() == v.y()));
}
Пример #7
0
// Returns the dot product of two vectors
float vector2::Dot(const vector2 &v2) const
{
	return ((x() * v2.x()) + (y() * v2.y()));
}
Пример #8
0
vector3::vector3(const vector2& source, float z)
{ 
	v[0] = source.x(), v[1] = source.y(), v[2] = z; 
}