def test_compatible_to_vector(): v = Vec3(Vec2(1, 2)) assert v == (1, 2, 0) v = Vec2(Vec3(1, 2, 3)) assert v.x == 1 assert v.y == 2
def test_angle_between_outside_domain(): v1 = Vec3(721.046967113573, 721.0469671135688, 0.0) v2 = Vec3(-721.0469671135725, -721.0469671135688, 0.0) angle = v1.angle_between(v2) assert math.isclose(angle, math.pi) # reverse order, same result angle = v2.angle_between(v1) assert math.isclose(angle, math.pi)
def test_sub_vec3(vec2): assert vec2(2, 3) - Vec3(7, 7) == (-5, -4)
def test_add_vec3(vec2): assert vec2(2, 3) + Vec3(7, 7) == (9, 10)