forked from freme/raybeam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_vector3.cc
50 lines (36 loc) · 1.73 KB
/
test_vector3.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "vector3.h"
int main() {
Vector3 vec1(2.0f, 2.0f, 2.0f);
Vector3 vec2(1.0f, 2.0f, 3.0f);
Vector3 vec3(5.0f, 7.0f, 4.0f);
Vector3 temp;
float ftmp = 0.0f;
std::cout << "length = " << vec1.length() << std::endl;
std::cout << "squaredlength = " << vec1.squaredLength() << std::endl;
std::cout << "minComponent = " << vec2.minComponent() << std::endl;
std::cout << "maxComponent = " << vec2.maxComponent() << std::endl;
std::cout << "maxAbsComponent = " << vec2.maxAbsComponent() << std::endl;
std::cout << "minAbsComponent = " << vec2.minAbsComponent() << std::endl;
std::cout << "indexOfMinComponent = " << vec2.indexOfMinComponent() << std::endl;
std::cout << "indexOfMaxComponent = " << vec2.indexOfMaxComponent() << std::endl;
std::cout << "indexOfMaxAbsComponent = " << vec2.indexOfMaxAbsComponent() << std::endl;
std::cout << "indexOfMinAbsComponent = " << vec2.indexOfMinAbsComponent() << std::endl;
std::cout << "vec1 = " << vec1 << std::endl;
std::cout << "vec2 = " << vec2 << std::endl;
std::cout << "vec3 = " << vec3 << std::endl;
temp = vec1 + vec2;
std::cout << "vec1 + vec2 = " << temp << std::endl;
temp = vec1 - vec2;
std::cout << "vec1 - vec2 = " << temp << std::endl;
temp = vec1 * 2.0f;
std::cout << "vec1 * 2.0f = " << temp << std::endl;
temp = vec1 / 2.0f;
std::cout << "vec1 / 2.0f = " << temp << std::endl;
temp = cross(vec1, vec2);
std::cout << "cross(vec1, vev2) = " << temp << std::endl;
ftmp = dot(temp, vec3);
std::cout << "dot(temp, vec3) = " << ftmp << std::endl;
ftmp = tripleProduct(vec1, vec2, vec3);
std::cout << "tripleProduct(vec1, vec2, vec3) = " << ftmp << std::endl;
return 0;
}