From df7dc0f1069e6ed8ea24c152eb4c3a5a97e80b91 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Sat, 19 Jun 2021 17:54:16 +0200 Subject: Split on the largest axis on BVH generation --- src/vec3.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/vec3.cpp') diff --git a/src/vec3.cpp b/src/vec3.cpp index 8e27a98..8f7a720 100644 --- a/src/vec3.cpp +++ b/src/vec3.cpp @@ -1,4 +1,5 @@ #include +#include #include "vec3.hpp" #include "utils.hpp" @@ -40,6 +41,19 @@ vec3& vec3::operator/=(float numerator) { return *this; } +float vec3::operator[](int axis) { + switch (axis) { + case 0: + return x; + case 1: + return y; + case 2: + return z; + default: + return std::numeric_limits::infinity(); + } +} + float vec3::length() const { return sqrt(length_sq()); } -- cgit v1.3