-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVec2.h
More file actions
44 lines (36 loc) · 1.83 KB
/
Copy pathVec2.h
File metadata and controls
44 lines (36 loc) · 1.83 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <cstdint>
#pragma once
class Vec2 {
private:
float x, y;
public:
__host__ __device__ Vec2(float x,float y);
__host__ __device__ Vec2 operator+(const Vec2& other) const;
__host__ __device__ Vec2 operator+(const float other) const;
__host__ __device__ Vec2 operator-(const Vec2& other) const;
__host__ __device__ Vec2 operator-(const float other) const;
__host__ __device__ Vec2 operator*(const float other) const;
__host__ __device__ Vec2 operator*(const Vec2& other) const;
__host__ __device__ Vec2 operator/(const float other) const;
__host__ __device__ Vec2 operator/(const Vec2& other) const;
__host__ __device__ Vec2 operator-() const;
__host__ __device__ Vec2& operator+=(const Vec2& other);
__host__ __device__ Vec2& operator+=(const float other);
__host__ __device__ Vec2& operator-=(const Vec2& other);
__host__ __device__ Vec2& operator-=(const float other);
__host__ __device__ Vec2& operator*=(const float other);
__host__ __device__ Vec2& operator*=(const Vec2& other);
__host__ __device__ float& operator[](const uint& other);
__host__ __device__ const float& operator[](const uint& other) const;
__host__ __device__ const float& getX() const;
__host__ __device__ const float& getY() const;
__host__ __device__ const float& getZ() const;
__host__ __device__ void setX(float x);
__host__ __device__ void setY(float y);
__host__ __device__ void setZ(float z);
__host__ __device__ float dot(const Vec2& other) const;
__host__ __device__ Vec2 cross(const Vec2& other) const;
__host__ __device__ uint32_t toUint32() const;
friend std::ostream& operator<<(std::ostream& os, const Vec2& vec);
};