cangine
Loading...
Searching...
No Matches
Classes | Namespaces | Macros
vector3.hpp File Reference
#include "vector2.hpp"
Include dependency graph for vector3.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cangine::Vector3
 Three-component floating-point vector. More...
 

Namespaces

namespace  cangine
 

Macros

#define CANGINE_VECTOR3_OP(OP)
 Defines the free binary operator OP for Vector3.
 

Macro Definition Documentation

◆ CANGINE_VECTOR3_OP

#define CANGINE_VECTOR3_OP (   OP)
Value:
constexpr Vector3 operator OP(const Vector3& lhs, const Vector3& rhs) noexcept { return Vector3(lhs.x OP rhs.x, lhs.y OP rhs.y, lhs.z OP rhs.z); } \
constexpr Vector3 operator OP(const Vector3& lhs, float rhs) noexcept { return Vector3(lhs.x OP rhs, lhs.y OP rhs, lhs.z OP rhs); } \
constexpr Vector3 operator OP(float lhs, const Vector3& rhs) noexcept { return Vector3(lhs OP rhs.x, lhs OP rhs.y, lhs OP rhs.z); }

Defines the free binary operator OP for Vector3.

Expands to three overloads: vector-vector, vector-scalar and scalar-vector, each producing a new component-wise result.

Parameters
OPThe arithmetic operator token (+, -, * or /).