From feea0a9e82a73951c8b75ff7461e731d92919ad7 Mon Sep 17 00:00:00 2001 From: nagachika Date: Fri, 11 Jul 2014 14:08:51 +0000 Subject: [PATCH] merge revision(s) r46780: [Backport #9499] * lib/matrix.rb: Fix sign for cross_product [#9499] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ lib/matrix.rb | 6 +++--- test/matrix/test_vector.rb | 5 +++++ version.h | 6 +++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad28e34316..92477c2647 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Jul 11 23:07:09 2014 Marc-Andre Lafortune + + * lib/matrix.rb: Fix sign for cross_product [#9499] + Sun Jul 6 23:16:30 2014 Masaya Tarui * st.c (st_foreach_check): change start point of search at check diff --git a/lib/matrix.rb b/lib/matrix.rb index f82ed65979..b20fd9451f 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -1764,9 +1764,9 @@ class Vector # def cross_product(v) Vector.Raise ErrDimensionMismatch unless size == v.size && v.size == 3 - Vector[ v[1]*@elements[2] - v[2]*@elements[1], - v[2]*@elements[0] - v[0]*@elements[2], - v[0]*@elements[1] - v[1]*@elements[0] ] + Vector[ v[2]*@elements[1] - v[1]*@elements[2], + v[0]*@elements[2] - v[2]*@elements[0], + v[1]*@elements[0] - v[0]*@elements[1] ] end # diff --git a/test/matrix/test_vector.rb b/test/matrix/test_vector.rb index 18660df574..ced774c490 100644 --- a/test/matrix/test_vector.rb +++ b/test/matrix/test_vector.rb @@ -146,4 +146,9 @@ class TestVector < Test::Unit::TestCase v = Vector[Rational(1,2), 0] assert_equal(0.5, v.norm) end + + def test_cross_product + v = Vector[1, 0, 0].cross_product Vector[0, 1, 0] + assert_equal(Vector[0, 0, 1], v) + end end diff --git a/version.h b/version.h index 80c403cb45..701b263b76 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.1.2" -#define RUBY_RELEASE_DATE "2014-07-06" -#define RUBY_PATCHLEVEL 168 +#define RUBY_RELEASE_DATE "2014-07-11" +#define RUBY_PATCHLEVEL 169 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 7 -#define RUBY_RELEASE_DAY 6 +#define RUBY_RELEASE_DAY 11 #include "ruby/version.h"