[前][次][番号順一覧][スレッド一覧]

ruby-changes:34706

From: nagachika <ko1@a...>
Date: Fri, 11 Jul 2014 23:08:58 +0900 (JST)
Subject: [ruby-changes:34706] nagachika:r46789 (ruby_2_1): merge revision(s) r46780: [Backport #9499]

nagachika	2014-07-11 23:08:51 +0900 (Fri, 11 Jul 2014)

  New Revision: 46789

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46789

  Log:
    merge revision(s) r46780: [Backport #9499]
    
    * lib/matrix.rb: Fix sign for cross_product [#9499]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/lib/matrix.rb
    branches/ruby_2_1/test/matrix/test_vector.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 46788)
+++ ruby_2_1/ChangeLog	(revision 46789)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Fri Jul 11 23:07:09 2014  Marc-Andre Lafortune  <ruby-core@m...>
+
+	* lib/matrix.rb: Fix sign for cross_product [#9499]
+
 Sun Jul  6 23:16:30 2014  Masaya Tarui  <tarui@r...>
 
 	* st.c (st_foreach_check): change start point of search at check
Index: ruby_2_1/lib/matrix.rb
===================================================================
--- ruby_2_1/lib/matrix.rb	(revision 46788)
+++ ruby_2_1/lib/matrix.rb	(revision 46789)
@@ -1764,9 +1764,9 @@ class Vector https://github.com/ruby/ruby/blob/trunk/ruby_2_1/lib/matrix.rb#L1764
   #
   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
 
   #
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 46788)
+++ ruby_2_1/version.h	(revision 46789)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #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"
 
Index: ruby_2_1/test/matrix/test_vector.rb
===================================================================
--- ruby_2_1/test/matrix/test_vector.rb	(revision 46788)
+++ ruby_2_1/test/matrix/test_vector.rb	(revision 46789)
@@ -146,4 +146,9 @@ class TestVector < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/matrix/test_vector.rb#L146
     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

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r46780


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]