4#include "math/matrix_3.h"
5#include "math/vector_3.h"
11 Vec4(
float x,
float y,
float z,
float w);
14 Vec4(
float* values_array);
18 Vec4 operator+(
const Vec4& other)
const;
19 Vec4 operator+(
float value)
const;
20 void operator+=(
const Vec4& other);
21 void operator+=(
float value);
22 Vec4 operator-(
const Vec4& other)
const;
23 Vec4 operator-(
float value)
const;
24 void operator-=(
const Vec4& other);
25 void operator-=(
float value);
27 Vec4 operator*(
float value)
const;
28 void operator*=(
float value);
29 Vec4 operator/(
float value)
const;
30 void operator/=(
float value);
31 bool operator==(
const Vec4& other);
32 bool operator!=(
const Vec4& other);
33 void operator=(
const Vec4& other);
77 static const Vec4 one;
78 static const Vec4 zero;
90 float reciproca = 1.0f / this->w;
97 return sqrtf(x * x + y * y + z * z + w * w);
100inline void Vec4::Normalize() { *
this /=
Magnitude(); }
112 return x * x + y * y + z * z + w * w;
116 return (b - a).Magnitude();
120 return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
126 return (b - a) * t + a;
129inline Vec4 Vec4::operator+(
const Vec4& other)
const {
130 return Vec4(x + other.x, y + other.y, z + other.z, w + other.w);
133inline Vec4 Vec4::operator+(
float value)
const {
134 return Vec4(x + value, y + value, z + value, w + value);
137inline void Vec4::operator+=(
const Vec4& other) {
144inline void Vec4::operator+=(
float value) {
151inline Vec4 Vec4::operator-(
const Vec4& other)
const {
152 return Vec4(x - other.x, y - other.y, z - other.z, w - other.w);
155inline Vec4 Vec4::operator-(
float value)
const {
156 return Vec4(x - value, y - value, z - value, w - value);
159inline void Vec4::operator-=(
const Vec4& other) {
166inline void Vec4::operator-=(
float value) {
173inline Vec4 Vec4::operator*(
float value)
const {
174 return Vec4(x * value, y * value, z * value, w * value);
177inline void Vec4::operator*=(
float value) {
184inline Vec4 Vec4::operator/(
float value)
const {
185 return Vec4(x / value, y / value, z / value, w / value);
188inline void Vec4::operator/=(
float value) {
195inline bool Vec4::operator==(
const Vec4& other) {
196 if (x == other.x && y == other.y && z == other.z && w == other.w)
return true;
199inline bool Vec4::operator!=(
const Vec4& other) {
200 if (x == other.x && y == other.y && z == other.z && w == other.w)
204inline void Vec4::operator=(
const Vec4& other) {
represents mathematical vector with 3 components
Definition: vector_3.h:12
represents mathematical vector with 4 components
Definition: vector_4.h:8
static float DotProduct(Vec4 a, Vec4 b)
Definition: vector_4.h:119
void Scale(Vec4 scale)
Definition: vector_4.h:104
float Magnitude() const
Definition: vector_4.h:96
static float Distance(const Vec4 &a, const Vec4 &b)
Definition: vector_4.h:115
float SqrMagnitude() const
Definition: vector_4.h:111
Vec4 Homogenize()
Definition: vector_4.h:87
static Vec4 Lerp(const Vec4 &a, const Vec4 &b, float index)
Definition: vector_4.h:123
Vec4 Normalized() const
Definition: vector_4.h:102
copperdielf Math Library
Definition: buffer.hpp:5