-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVector2D.h
More file actions
58 lines (43 loc) · 1.36 KB
/
Vector2D.h
File metadata and controls
58 lines (43 loc) · 1.36 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Copyright (c) 2024 - Code By MERS4D
* All rights reserved.
*
* [MY SOCIAL MEDIA LINKS]:
* |-> Github: github.com/MohammadMersad/
* |-> Telegram: @CS_Mersad
* |-> Instragram: mersaad_h
* --------------------------------------------
*
* Project: Vector 2D | File: Vector2D.h
* File Description: Nothing Else... :)
*
* You may modify and distribute this source code, provided that the author's name
* and copyright notice remain intact. Any changes to the original code must be
* clearly documented.
*/
#pragma once
#include <cmath>
//#define VEC2D_DEBUG_MODE
#include <iostream>
class Vector2D
{
private:
double x, y;
public:
//----------------------------[ Functions ]----------------------------\\
/*Const*/ Vector2D(double n_x, double n_y);
double getX();
double getY();
void setX(const double& n_v);
void setY(const double& n_v);
Vector2D getNormalized();
double getLength();
//----------------------------[ Operators ]----------------------------\\
Vector2D operator+(const Vector2D& other);
Vector2D operator-(const Vector2D& other);
Vector2D& operator+=(const Vector2D& other);
Vector2D& operator-=(const Vector2D& other);
//Output/Input Stream
friend std::ostream& operator<<(std::ostream& os, const Vector2D& obj);
friend std::istream& operator>> (std::istream& stream, Vector2D& obj);
};