Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing vector methods #228

Merged
merged 15 commits into from
Jul 21, 2024
Prev Previous commit
Next Next commit
Pass epsilon to Vector2:FuzzyEq()
  • Loading branch information
ZachCurtis committed Jul 19, 2024
commit 83067d4ec1e99717169abf5647119b822df5c4cb
3 changes: 2 additions & 1 deletion tests/roblox/datatypes/Vector2.luau
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ assert(Vector2.new(-1.7, 2):Sign() == Vector2.new(-1, 1))
assert(Vector2.new(-1.9, 2.1):Ceil() == Vector2.new(-1, 3))
assert(Vector2.new(-1.1, 2.99):Floor() == Vector2.new(-2, 2))

assert(Vector2.new(1, 2):FuzzyEq(Vector2.new(1 - 1e-6, 2 + 1e-6)))
assert(Vector2.new(1, 2):FuzzyEq(Vector2.new(1 - 1e-6, 2 + 1e-6), 1e-5))
assert(not Vector2.new(1, 2):FuzzyEq(Vector2.new(1.2, 2), 0.1))

local angle = Vector2.new(1, 1):Angle(Vector2.new(-1, 1))
assert(math.abs(angle - (math.pi / 2)) < 1e-5)