From 12cde59008e15abb935a2177a2a4ed3038841c96 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 3 Feb 2019 19:46:01 +0100 Subject: Add ceil function for our Vector class --- src/utilities/vectorHelpers.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/utilities/vectorHelpers.h b/src/utilities/vectorHelpers.h index 17453dd..e4fc958 100644 --- a/src/utilities/vectorHelpers.h +++ b/src/utilities/vectorHelpers.h @@ -188,6 +188,17 @@ Vector ceil(const Vector& a) return out; } +/// applies ceil to each component of a vector +template +Vector ceil(const Vector& a) +{ + Vector out; + for (unsigned int iDim=0; iDim < Size; ++iDim) { + out[iDim] = std::ceil(a[iDim]); + } + return out; +} + /* /// algorithm by Möller–Trumbore (TODO add ref), implemented by Lucas Cruz and Mathias J. Krause /// returns true if there is an intersection of a triangle given by (point0, point1, point1) and a ray given by its origin and direction and computes the distance -- cgit v1.2.3