Logo
Vector4.h
1#pragma once
2#include "Vector3.h"
3
4namespace SharpKmyMath
5{
6 public value struct Vector4 {
7
8 public:
9 float x, y, z, w;
10
11 Vector4(float v)
12 {
13 x = y = z = w = v;
14 }
15
16 Vector4(float _x, float _y, float _z, float _w)
17 {
18 x = _x;
19 y = _y;
20 z = _z;
21 w = _w;
22 }
23
24 static Vector4 operator * (Vector4 v, float f)
25 {
26 Vector4 ret;
27 ret.x = v.x * f;
28 ret.y = v.y * f;
29 ret.z = v.z * f;
30 ret.w = v.w * f;
31 return ret;
32 }
33
34 static Vector4 operator / (Vector4 v, float f)
35 {
36 Vector4 ret;
37 ret.x = v.x / f;
38 ret.y = v.y / f;
39 ret.z = v.z / f;
40 ret.w = v.w / f;
41 return ret;
42 }
43
45 {
46 Vector4 ret;
47 ret.x = v.x + v2.x;
48 ret.y = v.y + v2.y;
49 ret.z = v.z + v2.z;
50 ret.w = v.w + v2.w;
51 return ret;
52 }
53
55 {
56 Vector4 ret;
57 ret.x = v.x - v2.x;
58 ret.y = v.y - v2.y;
59 ret.z = v.z - v2.z;
60 ret.w = v.w - v2.w;
61 return ret;
62 }
63
65 {
66 Vector4 ret;
67 ret.x = -v.x;
68 ret.y = -v.y;
69 ret.z = -v.z;
70 ret.w = -v.w;
71 return ret;
72 }
73
75 {
76 return Vector3(x, y, z);
77 }
78 };
79
80}
Definition: RefCapture.h:3
Definition: Vector3.h:7
Definition: Vector4.h:6
float x
Definition: Vector4.h:9
float w
Definition: Vector4.h:9
float y
Definition: Vector4.h:9
static Vector4 operator/(Vector4 v, float f)
Definition: Vector4.h:34
float z
Definition: Vector4.h:9
static Vector4 operator+(Vector4 v, Vector4 v2)
Definition: Vector4.h:44
Vector4(float _x, float _y, float _z, float _w)
Definition: Vector4.h:16
static Vector4 operator*(Vector4 v, float f)
Definition: Vector4.h:24
Vector3 getXYZ()
Definition: Vector4.h:74
Vector4(float v)
Definition: Vector4.h:11
static Vector4 operator-(Vector4 v, Vector4 v2)
Definition: Vector4.h:54