From 28d981ce163f8af5a53f5fb394abf8e7c9377d0b Mon Sep 17 00:00:00 2001 From: Jerraldy <121196050+Jerraldy@users.noreply.github.com> Date: Thu, 23 Feb 2023 17:03:32 +0000 Subject: [PATCH 1/3] Work --- main.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 104be10..3da4f77 100644 --- a/main.py +++ b/main.py @@ -1,2 +1,19 @@ 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"Vecto2d(x={self.x}, y={self.y}) is True" + + def _str_(self): + return f"{self.x}i, {self.y}j" + + def _abs_(self): + hypotenuse = (self.x**2+self.y**2)**.5 + + + def __eq__(self): + if Vector2d((self.x, self.y)==(other.x,other.y)) + def_sub_(self): + if vector2d((self.x-other.y), (self.x-other.y)) \ No newline at end of file From cdda6ec9b2c238d931569c69c161517fdbb85694 Mon Sep 17 00:00:00 2001 From: Jerraldy <121196050+Jerraldy@users.noreply.github.com> Date: Fri, 24 Feb 2023 19:38:49 +0000 Subject: [PATCH 2/3] your message --- main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 3da4f77..fd3991d 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +import math class Vector2d: def _init_(self, x, y): self.x =x @@ -15,5 +16,10 @@ def _abs_(self): def __eq__(self): if Vector2d((self.x, self.y)==(other.x,other.y)) + def_sub_(self): - if vector2d((self.x-other.y), (self.x-other.y)) \ No newline at end of file + if vector2d((self.x-other.y), (self.x-other.y)) + + def_angle_(self): + return math.atan2((y/x)-pi==pi)== +the the angie the ng e f \ No newline at end of file From 8b300a352e56090038b752de81f05fb45ef8a4a9 Mon Sep 17 00:00:00 2001 From: Jerraldy <121196050+Jerraldy@users.noreply.github.com> Date: Fri, 24 Feb 2023 19:59:15 +0000 Subject: [PATCH 3/3] Created a method to create an angle and change it into degrees --- main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index fd3991d..dbf3ee6 100644 --- a/main.py +++ b/main.py @@ -12,14 +12,16 @@ def _str_(self): def _abs_(self): hypotenuse = (self.x**2+self.y**2)**.5 - - + return hypotenuse + def _neg_(self) + return Vector2d(self.x*-1, self.y*-1) def __eq__(self): if Vector2d((self.x, self.y)==(other.x,other.y)) + return True def_sub_(self): if vector2d((self.x-other.y), (self.x-other.y)) def_angle_(self): - return math.atan2((y/x)-pi==pi)== -the the angie the ng e f \ No newline at end of file + return math.degress(math.atan2(self.y,self.x)) + \ No newline at end of file