File math/vector_math.hpp¶
-
struct SequentialVectorMath¶
- #include <vector_math.hpp>
Implements basic operations for calculating with numerical arrays by applying the respective operations to each element in the arrays sequentially.
Public Static Functions
-
template<typename T>
static inline void copy(const T *from, T *to, uint32 numElements)¶ Copy all elements from one array to another.
- Template Parameters:
T – The type of the elements
- Parameters:
from – A pointer to the beginning of the array to copy from
to – A pointer to the beginning of the array to copy to
numElements – The number of elements to be copied
-
template<typename T>
static inline void add(T *a, const T *b, uint32 numElements)¶ Adds the elements in an array
bto the elements in another arraya, such thata = a + b.- Template Parameters:
T – The type of the values in the array
aandb- Parameters:
a – A pointer to the beginning of the array
ab – A pointer to the beginning of the array
bnumElements – The number of elements in the arrays
aandb
-
template<typename T, typename Weight>
static inline void addWeighted(T *a, const T *b, uint32 numElements, Weight weight)¶ Adds the elements in an array
bto the elements in another arraya. The elements in the arraybare multiplied by a given weight, such thata = a + (b * weight).- Template Parameters:
T – The type of the values in the arrays
aandbWeight – The type of the weight
- Parameters:
a – A pointer to the beginning of the array
ab – A pointer to the beginning of the array
bnumElements – The number of elements in the arrays
aandbweight – The weight, the elements in the array
bshould be multiplied by
-
template<typename T>
static inline void add(T *a, const T *b, const uint32 *indices, uint32 numElements)¶ Adds the elements in an array
bto the elements in another arraya, such thata = a + b. The indices of the elements in the arraybthat correspond to the elements in the arrayaare given as an additional array.- Template Parameters:
T – The type of the values in the arrays
aandb- Parameters:
a – A pointer to the beginning of the array
ab – A pointer to the beginning of the array
bnumElements – The number of elements in the arrays
aandbindices – A pointer to the beginning of an array that stores the indices of the elements in the array
bthat correspond to the elements in the arraya
-
template<typename T, typename Weight>
static inline void addWeighted(T *a, const T *b, const uint32 *indices, uint32 numElements, Weight weight)¶ Adds the elements in an array
bto the elements in another arraya. The elements in the arraybare multiplied by a given weight, such thata = a + (b * weight). The indices of the elements in the arraybthat correspond to the elements in the arrayaare given as an additional array.- Template Parameters:
T – The type of the values in the arrays
aandbWeight – The type of the weight
- Parameters:
a – A pointer to the beginning of the array
ab – A pointer to the beginning of the array
bnumElements – The number of elements in the arrays
aandbweight – The weight, the elements in the array
bshould be multiplied byindices – A pointer to the beginning of a array that stores the indices of the elements in the array
bthat correspond to the elements in the arraya
-
template<typename T, typename Constant>
static inline void addConstantToSubset(T *array, Constant constant, const uint32 *indices, uint32 numIndices)¶ Adds a specific constant to the elements in a given array
arraythat correspond to the indices in another arrayindices.- Template Parameters:
T – The type of the values in the array
arrayConstant – The type of the constant
- Parameters:
array – A pointer to the beginning of the array
arrayconstant – The constant
indices – A pointer to the beginning of the array
indicesnumIndices – The number of elements in the array
indices
-
template<typename T>
static inline void subtract(T *a, const T *b, uint32 numElements)¶ Removes the elements in an array
bfrom the elements in another arraya, such thata = a - b.- Template Parameters:
T – The type of the values in the arrays
aandb- Parameters:
a – A pointer to the beginning of the array
ab – A pointer to the beginning of the array
bnumElements – The number of elements in the arrays
aandb
-
template<typename T, typename Weight>
static inline void subtractWeighted(T *a, const T *b, uint32 numElements, Weight weight)¶ Removes the elements in an array
bfrom the elements in another arraya. The elements in the arraybare multiplied by a given weight, such thata = a - (b * weight).- Template Parameters:
T – The type of the values in the arrays
aandbWeight – The type of the weight
- Parameters:
a – A pointer to the beginning of the array
ab – A pointer to the beginning of the array
bnumElements – The number of elements in the arrays
aandbweight – The weight, the elements in the array
bshould be multiplied by
-
template<typename T, typename Constant>
static inline void subtractConstantFromSubset(T *array, Constant constant, const uint32 *indices, uint32 numIndices)¶ Subtracts a specific constant from the elements in a given array
arraythat correspond to the indices in another arrayindices.- Template Parameters:
T – The type of the values in the array
arrayConstant – The type of the constant
- Parameters:
array – A pointer to the beginning of the array
arrayconstant – The constant
indices – A pointer to the beginning of the array
indicesnumIndices – The number of elements in the array
indices
-
template<typename T>
static inline void difference(T *a, const T *b, const T *c, uint32 numElements)¶ Sets all elements in an array
ato the difference between the elements in two other arraysbandc, such thata = b - c.- Template Parameters:
T – The type of the values in the arrays
a,bandc- Parameters:
a – A pointer to the beginning of the array
ab – A pointer to the beginning of the array
bc – A pointer to the beginning of the array
cnumElements – The number of elements in the arrays
a,bandc
-
template<typename T>
static inline void difference(T *a, const T *b, const T *c, const uint32 *indices, uint32 numElements)¶ Sets all elements in an array
ato the difference between the elements in two other arraysbandc, such thata = b - c. The indices of elements in the arraybthat correspond to the elements in the arraysaandcare obtained from an additional array.- Template Parameters:
T – The type of the values in the arrays
a,bandc- Parameters:
a – A pointer to the beginning of the array
ab – A pointer to the beginning of the array
bc – A pointer to the beginning of the array
cindices – A pointer to the beginning of the array that provides access to the indices of the elements in the array
bthat correspond to the elements in the arraysaandcnumElements – The number of elements in the array
a,bandc
-
template<typename T>