summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-16 04:18:50 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-16 04:18:50 +0000
commit1a6c27346e02a497b5e3cfca8d7e6e77248a3f38 (patch)
treec29474ef0f4c169dcc428ab1f1e141fba68f59c7 /test
parent24924022499123bd478403485492010436563a63 (diff)
lib/matrix: Fix potential bug of Vector#angle_with
Could happen for some linearly dependent vectors. Patch by Vasiliy Petrov. [Fix GH-1803] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/matrix/test_vector.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/matrix/test_vector.rb b/test/matrix/test_vector.rb
index 52785120b1..631b4d809a 100644
--- a/test/matrix/test_vector.rb
+++ b/test/matrix/test_vector.rb
@@ -223,6 +223,8 @@ class TestVector < Test::Unit::TestCase
assert_in_epsilon(Math::PI/2, Vector[1, 0].angle_with(Vector[0, -1]))
assert_in_epsilon(Math::PI/4, Vector[2, 2].angle_with(Vector[0, 1]))
assert_in_delta(0.0, Vector[1, 1].angle_with(Vector[1, 1]), 0.00001)
+ assert_equal(Vector[6, 6].angle_with(Vector[7, 7]), 0.0)
+ assert_equal(Vector[6, 6].angle_with(Vector[-7, -7]), Math::PI)
assert_raise(Vector::ZeroVectorError) { Vector[1, 1].angle_with(Vector[0, 0]) }
assert_raise(Vector::ZeroVectorError) { Vector[0, 0].angle_with(Vector[1, 1]) }