21 x(0), y(0), z(0), w(0) {
24 Vec4(
float x,
float y,
float z,
float w):
25 x(x), y(y), z(z), w(w) {
31 bool equals(
const Vec4& rhs)
const {
32 return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w;
35 bool operator==(
const Vec4& rhs)
const {
36 return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w;
39 bool operator!=(
const Vec4& rhs)
const {
40 return (x != rhs.x) || (y != rhs.y) || (z != rhs.z) || (w != rhs.w);
43 Vec4 operator-(
const Vec4& rhs)
const {
44 return Vec4(x - rhs.x, y - rhs.y, z - rhs.z, w - rhs.w);
47 Vec4 operator*(
const float& rhs)
const {
56 float length()
const {
57 return sqrtf(length_squared());
60 float length_squared()
const {
61 return x * x + y * y + z * z + w * w;
65 float l = 1.0f / length();
78 Vec4 operator+(
const Vec4& rhs)
const {
79 return Vec4(x + rhs.x, y + rhs.y, z + rhs.z, w + rhs.w);
86 std::ostream& operator<<(std::ostream& stream,
const Vec4& vec);