diff --git a/cuBQL/math/box.h b/cuBQL/math/box.h index f0355de..07736c4 100644 --- a/cuBQL/math/box.h +++ b/cuBQL/math/box.h @@ -134,9 +134,16 @@ namespace cuBQL { inline __cubql_both vec_t center() const { return (this->lower+this->upper)/scalar_t(2); } + /*! return a vector that give the size of the box in x,y,...etc */ inline __cubql_both vec_t size() const { return this->upper - this->lower; } - + + /*! return a vector that give the size of the box in x,y,...etc + (also known as the 'span' of a box, due to the it being the + vector that spans the box from lower to upper) */ + inline __cubql_both vec_t span() const + { return this->upper - this->lower; } + /*! returns TWICE the center (which happens to be the SUM of lower an dupper). Note this 'conceptually' the same as 'center()', but without the nasty division that may lead to rounding diff --git a/cuBQL/math/common.h b/cuBQL/math/common.h index 998fd2b..710786e 100644 --- a/cuBQL/math/common.h +++ b/cuBQL/math/common.h @@ -25,6 +25,7 @@ # include #endif #if defined(__HIPCC__) +# include # include # include #elif defined(__CUDACC__) @@ -62,7 +63,12 @@ # define CUBQL_INTERFACE /* nothing - currently not building any special 'cubql.dll' */ #ifndef __PRETTY_FUNCTION__ +# if defined(__func__) +# define __PRETTY_FUNCTION__ __func__ +// # define __PRETTY_FUNCTION__ __FILE__##"::"##__LINE__##": "##__FUNCTION__ +# else # define __PRETTY_FUNCTION__ __FUNCTION__ +# endif #endif diff --git a/cuBQL/math/vec.h b/cuBQL/math/vec.h index 126b83a..474a110 100644 --- a/cuBQL/math/vec.h +++ b/cuBQL/math/vec.h @@ -206,6 +206,9 @@ namespace cuBQL { inline __cubql_both vec_t(const vec_t_data &o) { this->x = (o.x); this->y = (o.y); this->z = (o.z); this->w = (o.w); } + inline __cubql_both vec_t(const vec_t_data &o, T w) + { this->x = (o.x); this->y = (o.y); this->z = (o.z); this->w = w; } + template explicit __cubql_both vec_t(const vec_t_data &o) { this->x = T(o.x); this->y = T(o.y); this->z = T(o.z); this->w = T(o.w); } @@ -310,6 +313,16 @@ namespace cuBQL { vec_t operator+(vec_t v) { return v; } + template + inline __cubql_both + vec_t &operator-=(vec_t &self, vec_t v) + { self = self-v; return self; } + + template + inline __cubql_both + vec_t &operator+=(vec_t &self, vec_t v) + { self = self+v; return self; } + #if CUBQL_SUPPORT_CUDA_VECTOR_TYPES # define CUBQL_OPERATOR_CUDA_T(long_op, op) \