Kelas Vektor Python
just make a class for vectors:
from math import sqrt, cos, sin
class Vector:
def __init__(self, start_x, start_y, end_x, end_y):
self.vector = [start_x, start_y, end_x, end_y]
def get_mag(self):
return sqrt((self.vector[0] - self.vector[2])**2 + (self.vector[1] - self.vector[3])**2)
def rotate(self, angle):
new_vector = [self.vector[0],
self.vector[1],
self.vector.get_mag() * cos(angle) + self.vector[0],
self.vector.get_mag() * sin(angle) + self.vector[1]]
self.vector = new_vector
return self.vector
............................many more functions
vector = Vector(x1, y1, x2, y2) #Creating a vector
Victorious Vulture