Voltray Engine Docs
Loading...
Searching...
No Matches
Vec3.h
Go to the documentation of this file.
1#pragma once
2
3// Represents a 3-dimensional vector with float components and provides common vector operations.
4struct Vec3
5{
6 float x, y, z;
7
9 Vec3();
10
13 explicit Vec3(float value);
14
19 Vec3(float x, float y, float z);
20
24 Vec3 operator+(const Vec3 &other) const;
25
29 Vec3 operator-(const Vec3 &other) const;
30
34 Vec3 operator*(float scalar) const;
35
39 Vec3 operator/(float scalar) const;
40
43 Vec3 operator-() const;
44
47 float Length() const;
48
51 Vec3 Normalize() const;
52
56 float Dot(const Vec3 &other) const;
57
61 Vec3 Cross(const Vec3 &other) const;
62
64 Vec3 &operator+=(const Vec3 &other);
66 Vec3 &operator-=(const Vec3 &other);
68 Vec3 &operator*=(float scalar);
69};
Definition Vec3.h:5
Vec3 & operator*=(float scalar)
Compound multiplication assignment.
Definition vec3.cpp:76
float x
Definition Vec3.h:6
float Length() const
Definition vec3.cpp:34
Vec3 & operator+=(const Vec3 &other)
Compound addition assignment.
Definition vec3.cpp:60
float z
The x, y, and z components of the vector.
Definition Vec3.h:6
Vec3 Normalize() const
Definition vec3.cpp:39
Vec3 operator/(float scalar) const
Definition vec3.cpp:24
Vec3 Cross(const Vec3 &other) const
Definition vec3.cpp:52
Vec3 & operator-=(const Vec3 &other)
Compound subtraction assignment.
Definition vec3.cpp:68
Vec3()
Default constructor. Initializes all components to zero.
Definition vec3.cpp:5
Vec3 operator-() const
Definition vec3.cpp:29
Vec3 operator+(const Vec3 &other) const
Definition vec3.cpp:9
float y
Definition Vec3.h:6
float Dot(const Vec3 &other) const
Definition vec3.cpp:47
Vec3 operator*(float scalar) const
Definition vec3.cpp:19