mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
Update 80_linalg.py
This commit is contained in:
parent
e624034250
commit
6485bf3576
@ -9,7 +9,7 @@ assert repr(math) == "<module 'math'>"
|
|||||||
|
|
||||||
# test vec2--------------------------------------------------------------------
|
# test vec2--------------------------------------------------------------------
|
||||||
|
|
||||||
def rotated_vec2(vec_2, radians: float):
|
def rotated_vec2(vec_2: vec2, radians: float):
|
||||||
cos_theta = math.cos(radians)
|
cos_theta = math.cos(radians)
|
||||||
sin_theta = math.sin(radians)
|
sin_theta = math.sin(radians)
|
||||||
new_x = vec_2.x * cos_theta - vec_2.y * sin_theta
|
new_x = vec_2.x * cos_theta - vec_2.y * sin_theta
|
||||||
@ -39,7 +39,7 @@ test_vec2_copy = test_vec2
|
|||||||
radians = random.uniform(-10*math.pi, 10*math.pi)
|
radians = random.uniform(-10*math.pi, 10*math.pi)
|
||||||
test_vec2_copy = rotated_vec2(test_vec2_copy, radians)
|
test_vec2_copy = rotated_vec2(test_vec2_copy, radians)
|
||||||
res = test_vec2.rotate(radians)
|
res = test_vec2.rotate(radians)
|
||||||
assert (res == test_vec2_copy), res
|
assert (res == test_vec2_copy), (res, test_vec2_copy, test_vec2)
|
||||||
|
|
||||||
# test smooth_damp
|
# test smooth_damp
|
||||||
vel = vec2(0, 0)
|
vel = vec2(0, 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user