-using namespace std;
-
-int main(int, char**) {
- // test vector implementation
-
- Vec3f bar(1, 4, 5), foo(3, 2, 1);
- cout << "Using example vector bar=" << bar << ", foo=" << foo << endl;
- cout << "bar | foo = " << (bar | foo) << ", should be 16" << endl;
- cout << "bar | bar = " << (bar | bar) << ", should be 42" << endl;
- cout << "foo | foo = " << (foo | foo) << ", should be 14" << endl;
- cout << "bar % foo = " << (bar % foo) << ", should be (-6,14,-10)" << endl;
- cout << "bar % bar = " << (bar % bar) << ", should be (0,0,0)" << endl;
- cout << "foo % foo = " << (foo % foo) << ", should be (0,0,0)" << endl;
- cout << "bar.norm() = " << bar.norm() << ", should be 6.48" << endl;
- cout << "foo.norm() = " << foo.norm() << ", should be 3.74" << endl;
- cout << "bar*5 = " << (bar * 5) << ", should be (5,20,25)" << endl;
- cout << "bar/5 = " << (bar / 5) << ", should be (0.2,0.8,1)" << endl;
- cout << "bar + foo = " << (bar + foo) << ", should be (4,6,6)" << endl;
- cout << "bar - foo = " << (bar - foo) << ", should be (-2,2,4)" << endl;
- cout << "foo - bar = " << (foo - bar) << ", should be (2,-2,-4)" << endl;
- cout << "bar * foo = " << (bar * foo) << ", should be (3,8,5)" << endl;
- cout << "bar / foo = " << (bar / foo) << ", should be (0.33,2,5)" << endl;
- cout << "foo / bar = " << (foo / bar) << ", should be (3,0.5,0.2)" << endl;
-
- cout << "bar *= 4: " << (bar *= 4) << ", should be (4,16,20)" << endl;
- cout << "bar /= 2: " << (bar /= 2) << ", should be (2,8,10)" << endl;
- cout << "bar += foo: " << (bar += foo) << ", should be (5,10,11)" << endl;
- cout << "bar -= Vec3f(5,6,3): " << (bar -= Vec3f(5, 6, 3))
- << ", should be (0,4,8)" << endl;
-
- cout << "bar[0] = " << bar[0] << ", should be 0" << endl;
- cout << "bar[1] = " << bar[1] << ", should be 4" << endl;
- cout << "bar[2] = " << bar[2] << ", should be 8" << endl;
- cout << "foo[0] = " << foo[0] << ", should be 3" << endl;
- cout << "foo[1] = " << foo[1] << ", should be 2" << endl;
- cout << "foo[2] = " << foo[2] << ", should be 1" << endl;
-
- bar.normalize();
- cout << "bar.normalize(): " << bar << ", should be (0,0.44,0.89)" << endl;
- foo.normalize();
- cout << "foo.normalize(): " << foo << ", should be (0.80,0.53,0.26)" << endl;
- bar = foo;
- cout << "bar := foo: bar = " << bar << ", should be (0.80,0.53,0.26)" << endl;
-
- /* render three images with different camera settings */
- /*
- PerspectiveCamera c1(Vec3f(0, 0, 10), Vec3f(0, 0, -1), Vec3f(0, 1, 0), 60,
- RESX, RESY);
- RenderFrame(c1, "perspective1.ppm");
-
- PerspectiveCamera c2(Vec3f(-8, 3, 8), Vec3f(1, -.1, -1), Vec3f(0, 1, 0), 45,
- RESX, RESY);
- RenderFrame(c2, "perspective2.ppm");
-
- PerspectiveCamera c3(Vec3f(-8, 3, 8), Vec3f(1, -.1, -1), Vec3f(1, 1, 0), 45,
- RESX, RESY);
- RenderFrame(c3, "perspective3.ppm");*/