17#include <AH/STL/cmath>
46 Vec2f(
float x,
float y) : x(x), y(y) {}
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;
148 Vec3f(
float x,
float y,
float z) : x(x), y(y), z(z) {}
212 return this->x *
rhs.x + this->y *
rhs.y + this->z *
rhs.z;
220 return std::sqrt(normSquared());
231 return this->x ==
rhs.x && this->y ==
rhs.y && this->z ==
rhs.z;
#define BEGIN_AH_NAMESPACE
Print & operator<<(Print &os, Cable c)
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
Print & operator<<(Print &os, Vec3f v)
Printing.
Vec2f operator*(float lhs, Vec2f rhs)
Scalar multiplication.
Print & operator<<(Print &os, Vec2f v)
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.
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).
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.
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.
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).