tests/vector.cc
author Radek Brich <radek.brich@devl.cz>
Tue, 26 Jul 2016 17:41:36 +0200
branchpyrit
changeset 103 3b3257a410fe
parent 91 9d66d323c354
permissions -rw-r--r--
Updated to compile: - KdTree+Octree: max_depth changed to static const (this should be configured at compile time) - wget tool replaced by curl, which is now more widespread - added CMakeLists (to eventually replace SCons) - various fixes

#include <xmmintrin.h>
#include "vector.h"

int main() {
	{
	/* Vector */
	Vector a(1, 2, 3);
	cout << "=== Vector test ===" << endl;
	cout << "a = " << a << endl;
	Vector b(2, 3, 2);
	cout << "b = " << b << endl;

	cout << "a + b = " << a + b << endl;
	cout << "b - a = " << b - a << endl;
	cout << "dot(a,b) = " << dot(a,b) << endl;
	cout << "cross(a,b) = " << cross(a,b) << endl;
	cout << "a * 2 = " << a * 2 << endl;
	cout << "3 * b = " << 3 * b << endl;
	cout << "-a = " << -a << endl;

	cout << "a.mag() = " << a.mag() << endl;
	cout << "normalize(a) = " << normalize(a) << endl;
	cout << "normalize(a).mag() = " << normalize(a).mag() << endl;
	}

	{
	/* VectorPacket */
	VectorPacket a(_mm_set_ps(4,3,2,1), _mm_set_ps(8,7,6,5), _mm_set_ps(12,11,10,9));
	VectorPacket b(_mm_set_ps(41,31,21,11), _mm_set_ps(42,32,22,12), _mm_set_ps(43,33,23,13));
	cout << "=== VectorPacket test ===" << endl;
	cout << "a = " << a << endl;
	cout << "b = " << b << endl;

	cout << "a + b = " << a + b << endl;
	cout << "b - a = " << b - a << endl;
/*	cout << "dot(a,b) = " << dot(a,b) << endl;
	cout << "cross(a,b) = " << cross(a,b) << endl;
	cout << "a * 2 = " << a * 2 << endl;
	cout << "3 * b = " << 3 * b << endl;
	cout << "-a = " << -a << endl;

	cout << "normalize(a) = " << normalize(a) << endl;*/
	}

	return 0;
}