CPP-Renderer/include/vector/vec_utils.hpp

47 lines
1.3 KiB
C++

#ifndef VEC_UTILS_HPP
#define VEC_UTILS_HPP
#include <cstddef>
#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
class vec3
{
private:
float x, y, z;
float orientation;
float scale;
float rotation;
public:
vec3() : x(0), y(0), z(0), orientation(0), scale(1), rotation(0) {}
vec3(float x, float y, float z) : x(x), y(y), z(z), orientation(0), scale(1), rotation(0) {}
float getX() const { return x; }
float getY() const { return y; }
float getZ() const { return z; }
float getOrientation() const { return orientation; }
float getScale() const { return scale; }
float getRotation() const { return rotation; }
void setX(float val) { this->x = val; }
void setY(float val) { this->y = val; }
void setZ(float val) { this->z = val; }
void setOrientation(float val) { this->orientation = val; }
void setScale(float val) { this->scale = val; }
void setRotation(float val) { this->rotation = 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 // !VEC_UTILS_HPP