-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVec3.h
More file actions
26 lines (25 loc) · 750 Bytes
/
Vec3.h
File metadata and controls
26 lines (25 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#pragma once
class Vec3 {
public:
double x, y, z;
// constructors
Vec3() : x(0), y(0), z(0) {};
Vec3(double _x, double _y, double _z) : x(_x), y(_y), z(_z) {};
Vec3(const Vec3 &other) : x(other.x), y(other.y), z(other.z) {};
Vec3(double i) : x(i), y(0), z(0) {};
~Vec3() {};
// operators
Vec3 operator+(const Vec3 &) const;
Vec3 operator-(const Vec3 &) const;
Vec3 operator*(const double) const;
double operator*(const Vec3 &) const;
Vec3 operator^(const Vec3 &) const;
double length() const;
// assignment operators
Vec3 operator=(const Vec3 &);
Vec3 operator=(const double);
Vec3 operator+=(const Vec3 &);
Vec3 operator-=(const Vec3 &);
Vec3 operator*=(const double);
Vec3 operator^=(const Vec3 &);
};