Hermes
|
Holds 2-dimensional integer index coordinates. More...
Public Member Functions | |
HERMES_DEVICE_CALLABLE Index2< T > | operator- () const |
HERMES_DEVICE_CALLABLE | Index2 () |
Default constructor. | |
HERMES_DEVICE_CALLABLE | Index2 (T v) |
Constructor. More... | |
HERMES_DEVICE_CALLABLE | Index2 (T i, T j) |
Constructor. More... | |
template<typename S > | |
HERMES_DEVICE_CALLABLE | Index2 (const Size2< S > &size) |
Constructor from a Size2 object. More... | |
HERMES_DEVICE_CALLABLE T | operator[] (int d) const |
HERMES_DEVICE_CALLABLE T & | operator[] (int d) |
HERMES_DEVICE_CALLABLE Index2< T > | plus (T _i, T _j) const |
Generates an index with incremented values. More... | |
HERMES_DEVICE_CALLABLE Index2< T > | left (T d=T(1)) const |
Generates a copy with i decremented by d More... | |
HERMES_DEVICE_CALLABLE Index2< T > | right (T d=T(1)) const |
Generates a copy with i incremented by d More... | |
HERMES_DEVICE_CALLABLE Index2< T > | down (T d=T(1)) const |
Generates a copy with j decremented by d More... | |
HERMES_DEVICE_CALLABLE Index2< T > | up (T d=T(1)) const |
Generates a copy with j incremented by d More... | |
HERMES_DEVICE_CALLABLE void | clampTo (const size2 &s) |
Clamps to the inclusive range [0, size] More... | |
Public Attributes | |
T | i = T(0) |
0-th coordinate value | |
T | j = T(0) |
1-th coordinate value | |
Friends | |
HERMES_DEVICE_CALLABLE friend T | distance (const Index2< T > &a, const Index2< T > &b) |
Computes the manhattan distance between two indices. More... | |
Holds 2-dimensional integer index coordinates.
i
is related to the x axis in cartesian coordinates, and the field j
is related to the y axis.T | index type |
|
inlineexplicit |
Constructor.
v | - value assigned to both i and j |
|
inline |
Constructor.
i | - coordinate value for i |
j | - coordinate value for j |
|
inlineexplicit |
Constructor from a Size2 object.
i
receives size.with
and j
receives size.height
S | size type |
size | - |
|
inline |
Clamps to the inclusive range [0, size]
s | - upper bound |
|
inline |
Generates a copy with j
decremented by d
d | [in | default = 1] decrement value |
i
, j-d
)
|
inline |
Generates a copy with i
decremented by d
d | [in | default = 1] decrement value |
i-d
, j
)
|
inline |
d | coordinate index |
|
inline |
d | coordinate index |
|
inline |
Generates an index with incremented values.
_i | - value incremented to i |
_j | - value incremented to j |
|
inline |
Generates a copy with i
incremented by d
d | [in | default = 1] increment value |
i+d
, j
)
|
inline |
Generates a copy with j
incremented by d
d | [in | default = 1] increment value |
i
, j+d
)
|
friend |
Computes the manhattan distance between two indices.
\(\sum_i |a_i - b_i| \)
T |
a | - |
b | - |