From 41ea2d8f94043d49fc26aaaa8030a73dcfdc2da9 Mon Sep 17 00:00:00 2001 From: Julian T Date: Sun, 24 Jan 2021 18:13:44 +0100 Subject: Create rust project --- test/object.cpp | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 test/object.cpp (limited to 'test/object.cpp') diff --git a/test/object.cpp b/test/object.cpp deleted file mode 100644 index bbce055..0000000 --- a/test/object.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include -#include - -#include -#include - -TEST_CASE("Sphere normal at", "[sphere]") { - auto sph = Sphere(Vec3d(2, 3, 4), 2); - - auto norm = sph.norm_at(Vec3d(2, 3, 2), Vec3d()); - REQUIRE(norm.m_x == 0); - REQUIRE(norm.m_y == 0); - REQUIRE(norm.m_z == -1); -} - -TEST_CASE("Sphere intersect", "[sphere]") { - auto sph = Sphere(Vec3d(2, 3, 4), 2); - auto ray = Ray(Vec3d(1, 0, 0), Vec3d(0, 1, 1.5), true); - - auto dist = sph.intersect(ray, false); - REQUIRE(abs(dist - 3.28) < 0.01); -} - -TEST_CASE("Plane intersect", "[plane]") { - auto pln = Plane(Vec3d(3, 4, 2), Vec3d(-6, -3, -2)); - auto ray = Ray(Vec3d(0, 0, 0), Vec3d(-2, -1, 5)); - - auto dist = pln.intersect(ray, false); - REQUIRE(dist == -1); - - ray = Ray(Vec3d(-2, -2, 0), Vec3d(-2, -1, 5)); - dist = pln.intersect(ray, false); - REQUIRE(abs(dist - 20.4) < 0.1); -} -- cgit v1.2.3