17#include <AH/STL/cmath>
100 return this->x * rhs.
x + this->y * rhs.
y;
108 return std::hypot(
x,
y);
117 return this->x == rhs.
x && this->y == rhs.
y;
126 return {lhs * rhs.
x, lhs * rhs.
y};
166 Vec3f result = *
this;
177 Vec3f result = *
this;
191 Vec3f result = *
this;
205 Vec3f result = *
this;
212 return this->x * rhs.
x + this->y * rhs.
y + this->z * rhs.
z;
231 return this->x == rhs.
x && this->y == rhs.
y && this->z == rhs.
z;
240 return {lhs * rhs.
x, lhs * rhs.
y, lhs * rhs.
z};
#define BEGIN_AH_NAMESPACE
Vec2f operator*(float lhs, Vec2f rhs)
Scalar multiplication.
Print & operator<<(Print &os, Quaternion e)
Printing.
Vec3f operator*(float lhs, Vec3f rhs)
Scalar multiplication.
Type for 2D vectors of floating point numbers.
float operator*(Vec2f rhs) const
Inner product.
bool operator!=(Vec2f rhs) const
Inequality check.
Vec2f operator-() const
Negation.
Vec2f normalized() const
Normalize a copy of this vector (doesn't change the original vector).
Vec2f & normalize()
Normalize this vector.
bool operator==(Vec2f rhs) const
Equality check.
Vec2f & operator*=(float rhs)
Scalar multiplication.
float normSquared() const
Norm squared.
Vec2f operator-(Vec2f rhs) const
Subtraction.
Vec2f & operator+=(Vec2f rhs)
Addition.
Vec2f operator*(float rhs) const
Scalar multiplication.
Vec2f & operator/=(float rhs)
Scalar division.
float y
The y component of the vector.
float x
The x component of the vector.
Vec2f operator+(Vec2f rhs) const
Addition.
Vec2f operator/(float rhs) const
Scalar division.
Vec2f(float x, float y)
Create a vector with the given x and y coordinates.
Vec2f & operator-=(Vec2f rhs)
Subtraction.
Vec2f()=default
Create a vector that is initialized to the zero vector (0,0).
Print & operator<<(Print &os, Vec2f v)
Printing.
Type for 3D vectors of floating point numbers.
Vec3f operator+(Vec3f rhs) const
Addition.
float operator*(Vec3f rhs) const
Inner product.
bool operator!=(Vec3f rhs) const
Inequality check.
Vec3f(const volatile Vec3f &other)
Vec3f operator*(float rhs) const
Scalar multiplication.
Vec3f(float x, float y, float z)
Create a vector with the given x, y and z coordinates.
void operator=(const Vec3f &other) volatile
Vec3f(const Vec3f &)=default
Vec3f operator-(Vec3f rhs) const
Subtraction.
float normSquared() const
Norm squared.
Vec3f & operator/=(float rhs)
Scalar division.
Vec3f & operator-=(Vec3f rhs)
Subtraction.
Vec3f & normalize()
Normalize this vector.
float y
The y component of the vector.
Vec3f & operator*=(float rhs)
Scalar multiplication.
Vec3f()=default
Create a vector that is initialized to the zero vector (0,0,0).
Vec3f & operator+=(Vec3f rhs)
Addition.
Vec3f operator-() const
Negation.
float x
The x component of the vector.
Vec3f operator/(float rhs) const
Scalar division.
bool operator==(Vec3f rhs) const
Equality check.
Vec3f normalized() const
Normalize a copy of this vector (doesn't change the original vector).
float z
The z component of the vector.
Print & operator<<(Print &os, Vec3f v)
Printing.