MIDI Control Surface library for Arduino
|
Go to the documentation of this file.
6 #include <AH/Arduino-Wrapper.h> // Print
7 #include <AH/STL/cmath>
50 Vec2f(
float x,
float y) : x(x), y(y) {}
104 return this->x * rhs.
x + this->y * rhs.
y;
112 return std::hypot(x, y);
121 return this->x == rhs.
x && this->y == rhs.
y;
130 return {lhs * rhs.
x, lhs * rhs.
y};
152 Vec3f(
float x,
float y,
float z) : x(x), y(y), z(z) {}
154 Vec3f(
const volatile Vec3f &other) : x(other.x), y(other.y), z(other.z) {}
170 Vec3f result = *
this;
181 Vec3f result = *
this;
195 Vec3f result = *
this;
209 Vec3f result = *
this;
216 return this->x * rhs.
x + this->y * rhs.
y + this->z * rhs.
z;
224 return std::sqrt(normSquared());
235 return this->x == rhs.
x && this->y == rhs.
y && this->z == rhs.
z;
244 return {lhs * rhs.
x, lhs * rhs.
y, lhs * rhs.
z};
float y
The y component of the vector.
Vec2f & normalize()
Normalize this vector.
float normSquared() const
Norm squared.
Vec2f operator+(Vec2f rhs) const
Addition.
Vec2f & operator/=(float rhs)
Scalar division.
float x
The x component of the vector.
float normSquared() const
Norm squared.
bool operator!=(Vec3f rhs) const
Inequality check.
Vec2f()=default
Create a vector that is initialized to the zero vector (0,0).
Vec3f & operator+=(Vec3f rhs)
Addition.
Vec3f & operator-=(Vec3f rhs)
Subtraction.
bool operator==(Vec2f rhs) const
Equality check.
Vec2f operator*(float lhs, Vec2f rhs)
Scalar multiplication.
Vec2f(float x, float y)
Create a vector with the given x and y coordinates.
Vec3f operator-() const
Negation.
Vec3f(const volatile Vec3f &other)
Vec2f & operator+=(Vec2f rhs)
Addition.
#define AH_DIAGNOSTIC_POP()
Type for 3D vectors of floating point numbers.
Print & operator<<(Print &os, Vec2f v)
Printing.
Vec3f operator/(float rhs) const
Scalar division.
Vec2f operator/(float rhs) const
Scalar division.
float x
The x component of the vector.
bool operator==(Vec3f rhs) const
Equality check.
Vec2f operator-(Vec2f rhs) const
Subtraction.
Vec3f(const Vec3f &)=default
Vec3f()=default
Create a vector that is initialized to the zero vector (0,0,0).
Vec3f & operator*=(float rhs)
Scalar multiplication.
Vec3f operator*(float lhs, Vec3f rhs)
Scalar multiplication.
Vec3f operator*(float rhs) const
Scalar multiplication.
Vec2f & operator-=(Vec2f rhs)
Subtraction.
Vec3f operator-(Vec3f rhs) const
Subtraction.
Print & operator<<(Print &os, Vec3f v)
Printing.
Vec3f operator+(Vec3f rhs) const
Addition.
Vec2f & operator*=(float rhs)
Scalar multiplication.
float operator*(Vec3f rhs) const
Inner product.
Vec2f operator*(float rhs) const
Scalar multiplication.
Vec3f & operator/=(float rhs)
Scalar division.
Vec2f normalized() const
Normalize a copy of this vector (doesn't change the original vector).
void operator=(const Vec3f &other) volatile
Type for 2D vectors of floating point numbers.
Vec3f(float x, float y, float z)
Create a vector with the given x, y and z coordinates.
#define AH_DIAGNOSTIC_WERROR()
#define BEGIN_AH_NAMESPACE
float z
The z component of the vector.
bool operator!=(Vec2f rhs) const
Inequality check.
float operator*(Vec2f rhs) const
Inner product.
float y
The y component of the vector.
Vec3f & normalize()
Normalize this vector.
Print & operator<<(Print &os, Quaternion e)
Printing.
Vec2f operator-() const
Negation.
Vec3f normalized() const
Normalize a copy of this vector (doesn't change the original vector).