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

Go to the source code of this file.

Classes

struct  cangine::Vector2
 Two-component floating-point vector. More...
 

Namespaces

namespace  cangine
 

Macros

#define CANGINE_VECTOR2_OP(OP)
 Defines the free binary operator OP for Vector2.
 

Macro Definition Documentation

◆ CANGINE_VECTOR2_OP

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

Defines the free binary operator OP for Vector2.

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

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