Skip to content

Commit f34e9ea

Browse files
committed
fixed vector
1 parent 98c785d commit f34e9ea

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: MathUtil.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,18 @@ def set_magnitude(self, mag):
8181
# Uses the angle between i-unit vector and x-y vector component
8282
def direction(self):
8383
r = acos(self.x / self.magnitude())
84-
if self.y > 0:
84+
if self.y < 0:
8585
r *= -1
8686
return r
8787

8888
# direction must be in radians
8989
def set_direction(self, direction):
9090
m = self.magnitude()
9191
self.x = m * cos(direction)
92+
self.y = m * sin(direction)
9293

93-
y_temp = m * sin(direction)
94-
self.y = -y_temp if self.y > 0 else y_temp
94+
# y_temp = m * sin(direction)
95+
# self.y = -y_temp if self.y > 0 else y_temp
9596

9697
# Dot product of two vectors
9798
def dot(self, other):

0 commit comments

Comments
 (0)