38 lines
835 B
C++
38 lines
835 B
C++
#ifndef UTILS_VEC_HPP
|
|
#define UTILS_VEC_HPP
|
|
|
|
#include <cstddef>
|
|
#include <cstdlib>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <cmath>
|
|
|
|
class vec3
|
|
{
|
|
private:
|
|
float x, y, z;
|
|
|
|
public:
|
|
vec3() : x(0), y(0), z(0) {}
|
|
vec3(float x, float y, float z) : x(x), y(y), z(z) {}
|
|
|
|
float getX() const { return x; }
|
|
float getY() const { return y; }
|
|
float getZ() const { return z; }
|
|
|
|
void setX(float val) { this->x = val; }
|
|
void setY(float val) { this->y = val; }
|
|
void setZ(float val) { this->z = val; }
|
|
|
|
vec3 operator+(const vec3 &other) const;
|
|
vec3 operator-(const vec3 &other) const;
|
|
vec3 operator*(float scalar) const;
|
|
vec3 operator/(float scalar) const;
|
|
|
|
vec3 dot(const vec3 &other) const;
|
|
vec3 cross(const vec3 &other) const;
|
|
vec3 normalize() const;
|
|
};
|
|
|
|
#endif // !UTILS_VEC_HPP
|