Contains Vector class. More...
#include "helpers.h"#include <iostream>#include <algorithm>#include <cmath>#include <type_traits>#include <assert.h>Go to the source code of this file.
Classes | |
| struct | Vector< t_Type, t_Size > |
| Vector class. More... | |
Macros | |
| #define | VECTOR_H |
| #define | RESULT_TYPE(ee) typename std::decay< decltype( ee ) >::type |
Finds the type of ee, and removes reference, const and volatile. | |
| #define | VECTOR_VECTOR_ASSIGNMENT_OPERATOR(op) |
Generates code for the assignment operator op (=,+=,*=,etc) taking a Vector argument. | |
| #define | VECTOR_SCALAR_ASSIGNMENT_OPERATOR(op) |
Generates code for the assignment operator op (=,+=,*=,etc) taking a scalar argument. | |
| #define | VECTOR_OPERATOR(op) |
Generates code for the unary operator op (-,~). | |
| #define | VECTOR_VECTOR_OPERATOR(op) |
Generates code for the binary operator op (+,*,<<,etc) taking two Vector arguments. | |
| #define | VECTOR_SCALAR_OPERATOR(op) |
Generates code for the binary operator op (+,*,<<,etc) taking a Vector argument on the left, and scalar on the right. | |
| #define | SCALAR_VECTOR_OPERATOR(op) |
Generates code for the binary operator op (+,*,<<,etc) taking a scalar argument on the left, and Vector on the right. | |
| #define | VECTOR_COMPARISON_OPERATOR(op) |
Generates code for the binary comparison operator op (==,<,etc) taking two Vector arguments. The resulting code simply calls the Compare() function, which orders lexicographically. | |
| #define | VECTOR_FUNCTION(fun) |
Generates code for the unary function fun taking a Vector argument. The resulting code simply calls the scalar version of fun for each element. | |
| #define | VECTOR_VECTOR_FUNCTION(fun) |
Generates code for the binary function fun taking two Vector arguments. The resulting code simply calls the scalar version of fun for each element. | |
| #define | VECTOR_SCALAR_FUNCTION(fun) |
Generates code for the binary function fun taking a Vector argument on the left, and scalar on the right. The resulting code simply calls the scalar version of fun for each element. | |
| #define | SCALAR_VECTOR_FUNCTION(fun) |
Generates code for the binary function fun taking a scalar argument on the left, and Vector on the right. The resulting code simply calls the scalar version of fun for each element. | |
Functions | |
| template<typename t_Type , size_t t_Size> | |
| RESULT_TYPE (std::sqrt(*static_cast< t_Type const * >(NULL))) Vector< t_Type | |
| template<typename t_LeftType , typename t_RightType , size_t t_Size> | |
| int | Compare (Vector< t_LeftType, t_Size > const &left, Vector< t_RightType, t_Size > const &right) |
Compares its arguments lexicographically, returning -1 if left is smaller than right, 1 if it is larger, and 0 if they are equal. | |
| template<typename t_LeftType , typename t_RightType , size_t t_Size> | |
| auto | Dot (Vector< t_LeftType, t_Size > const &left, Vector< t_RightType, t_Size > const &right)-> RESULT_TYPE(left.data[0]*right.data[0]) |
| Returns the dot product of its arguments. | |
| template<typename t_LeftType , typename t_RightType > | |
| auto | Cross (Vector< t_LeftType, 3 > const &left, Vector< t_RightType, 3 > const &right)-> Vector< RESULT_TYPE(left.data[0]*right.data[0]) |
| Returns the cross product of its (3D) arguments. | |
| size_t t_Size std::ostream & | operator<< (std::ostream &out, Vector< t_Type, t_Size > const &vector) |
Contains Vector class.
In addition to the Vector class itself, this file also defines a large number of operators and functions acting on vectors.
Definition in file vector.h.
| #define SCALAR_VECTOR_FUNCTION | ( | fun | ) |
Generates code for the binary function fun taking a scalar argument on the left, and Vector on the right. The resulting code simply calls the scalar version of fun for each element.
| #define SCALAR_VECTOR_OPERATOR | ( | op | ) |
Generates code for the binary operator op (+,*,<<,etc) taking a scalar argument on the left, and Vector on the right.
| #define VECTOR_COMPARISON_OPERATOR | ( | op | ) |
Generates code for the binary comparison operator op (==,<,etc) taking two Vector arguments. The resulting code simply calls the Compare() function, which orders lexicographically.
| #define VECTOR_FUNCTION | ( | fun | ) |
Generates code for the unary function fun taking a Vector argument. The resulting code simply calls the scalar version of fun for each element.
| #define VECTOR_OPERATOR | ( | op | ) |
Generates code for the unary operator op (-,~).
| #define VECTOR_SCALAR_ASSIGNMENT_OPERATOR | ( | op | ) |
Generates code for the assignment operator op (=,+=,*=,etc) taking a scalar argument.
| #define VECTOR_SCALAR_FUNCTION | ( | fun | ) |
Generates code for the binary function fun taking a Vector argument on the left, and scalar on the right. The resulting code simply calls the scalar version of fun for each element.
| #define VECTOR_SCALAR_OPERATOR | ( | op | ) |
Generates code for the binary operator op (+,*,<<,etc) taking a Vector argument on the left, and scalar on the right.
| #define VECTOR_VECTOR_ASSIGNMENT_OPERATOR | ( | op | ) |
Generates code for the assignment operator op (=,+=,*=,etc) taking a Vector argument.
| #define VECTOR_VECTOR_FUNCTION | ( | fun | ) |
Generates code for the binary function fun taking two Vector arguments. The resulting code simply calls the scalar version of fun for each element.
| #define VECTOR_VECTOR_OPERATOR | ( | op | ) |
Generates code for the binary operator op (+,*,<<,etc) taking two Vector arguments.
1.8.1.2