39 lines
1 KiB
C++
39 lines
1 KiB
C++
|
#include <iostream>
|
||
|
#include "vector3f.h"
|
||
|
using namespace std;
|
||
|
|
||
|
int main() {
|
||
|
Vector3f a = {1.0, 2.0, -2.0};
|
||
|
Vector3f b = {4.0, -1.0, 3.0};
|
||
|
cout << "a = " << a << endl << "b = " << b << endl;
|
||
|
cout << "a + b = " << a + b << endl;
|
||
|
cout << "a - b = " << a - b << endl;
|
||
|
|
||
|
cout << "0.5 * a = " << 0.5 * a << endl;
|
||
|
cout << "a * 0.5 = " << a * 0.5 << endl;
|
||
|
|
||
|
cout << "(a, b) = " << a * b << endl;
|
||
|
|
||
|
cout << "a / 5 = " << a / 5 << endl;
|
||
|
|
||
|
cout << "-a = " << -a << endl;
|
||
|
cout << "+a = " << +a << endl;
|
||
|
|
||
|
cout << "a == b = " << (a == b) << endl;
|
||
|
cout << "a != b = " << (a != b) << endl;
|
||
|
|
||
|
a += b;
|
||
|
cout << "a += b: " << a << endl;
|
||
|
|
||
|
a -= b;
|
||
|
cout << "a -= b: " << a << endl;
|
||
|
|
||
|
a *= 2;
|
||
|
cout << "a *= 2: " << a << endl;
|
||
|
a /= 2;
|
||
|
cout << "a /= 2: " << a << endl;
|
||
|
|
||
|
normalize(a);
|
||
|
cout << "normalize(a): " << a << " |a| = " << norm(a) << endl;
|
||
|
}
|