From 070bcbcae99c0bac850b716f00824ae120643d46 Mon Sep 17 00:00:00 2001
From: Yoel <s73017@beuth-hochschule.de>
Date: Fri, 4 Sep 2020 15:31:08 +0200
Subject: [PATCH] Defined AABB for circle-planes, shape-interface-method bounds
 now implemented for circle-plane

---
 RayTracer/shape/CirclePlane.cpp | 4 ++++
 RayTracer/shape/CirclePlane.h   | 1 +
 2 files changed, 5 insertions(+)

diff --git a/RayTracer/shape/CirclePlane.cpp b/RayTracer/shape/CirclePlane.cpp
index 18e20b7..d8e03f0 100644
--- a/RayTracer/shape/CirclePlane.cpp
+++ b/RayTracer/shape/CirclePlane.cpp
@@ -28,4 +28,8 @@ std::shared_ptr<cam::Hit> CirclePlane::intersect(const cam::Ray& r) const {
 		}
 	}
 }
+util::AxisAlignedBoundingBox CirclePlane::bounds() const {
+	return util::AxisAlignedBoundingBox(util::Vec3(-radius, 0, -radius),
+	                                    util::Vec3(radius, 0, radius));
+}
 }  // namespace shapes
diff --git a/RayTracer/shape/CirclePlane.h b/RayTracer/shape/CirclePlane.h
index 51ddb33..f97649a 100644
--- a/RayTracer/shape/CirclePlane.h
+++ b/RayTracer/shape/CirclePlane.h
@@ -8,6 +8,7 @@ class CirclePlane : public Shape {
 	CirclePlane(float radius,
 	            const std::shared_ptr<material::Material>& material);
 	std::shared_ptr<cam::Hit> intersect(const cam::Ray& r) const override;
+	util::AxisAlignedBoundingBox bounds() const override;
 
    private:
 	std::shared_ptr<material::Material> material;
-- 
GitLab