From 1ea8a226ba909fd012d3109cc3cd36661be3b2fb Mon Sep 17 00:00:00 2001 From: jasmin1985 <121196141+jasmin1985@users.noreply.github.com> Date: Fri, 24 Feb 2023 19:41:53 +0000 Subject: [PATCH 1/3] Created a function to have an angle fom and chang it into degrees --- main.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 104be10..b68dbdd 100644 --- a/main.py +++ b/main.py @@ -1,2 +1,22 @@ class Vector2d: - pass \ No newline at end of file + def __init__(self, x,y): + self.x = x + self.y = y + + def __repr__(self): + return f"Vector2d(x={self.x},y={self.y}) " + + def __str__(self): + return f"{self.x}+{self.y}" + + def __abs__(self): + return f"{self.x}**2/2,{self.y}**2/2" + + def __eq__(self): + if Vector2d((self.x == x)) + + + + def __angle__(self): + + From 5a252bcd1c793c43c6c25295d43c46f310d20742 Mon Sep 17 00:00:00 2001 From: jasmin1985 <121196141+jasmin1985@users.noreply.github.com> Date: Fri, 24 Feb 2023 19:52:06 +0000 Subject: [PATCH 2/3] Created a function to have an angle form and change it into degrees --- main.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index b68dbdd..56df809 100644 --- a/main.py +++ b/main.py @@ -7,16 +7,27 @@ def __repr__(self): return f"Vector2d(x={self.x},y={self.y}) " def __str__(self): - return f"{self.x}+{self.y}" + return f"{self.x}+{self.y}j" def __abs__(self): - return f"{self.x}**2/2,{self.y}**2/2" + hypertenuse = (self.x**2+self.y**2)**.5 + return hypertenuse - def __eq__(self): - if Vector2d((self.x == x)) - - + def __neg__(self): + return Vector2d(self.x*-1, self.y*-1) - def __angle__(self): + + def __add__(self,other): + return Vector2d((self.x + other.x),(self.y +other.y)) + + def __eq__(self,other): + if Vector2d((self.x == other.x),(self.y == other.y)) : + return True + + def __sub__(self,other): + return self.x - other.x and self.y - other.y + + def angle(self): + return math.degrees(math.atan2(self.y, self.x)) From a3d361736f66ff2e7e09e9602855d3b22e7722b9 Mon Sep 17 00:00:00 2001 From: jasmin1985 <121196141+jasmin1985@users.noreply.github.com> Date: Fri, 24 Feb 2023 19:54:00 +0000 Subject: [PATCH 3/3] Created a function to have an angle form and change it into degrees --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 56df809..26a0055 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +import math class Vector2d: def __init__(self, x,y): self.x = x