From: nagachika00@... Date: 2014-03-03T16:21:45+00:00 Subject: [ruby-core:61258] [ruby-trunk - Bug #9499] [Assigned] The Vector.cross_product function returns the opposite vector of the expected result Issue #9499 has been updated by Tomoyuki Chikanaga. Status changed from Open to Assigned Assignee set to Marc-Andre Lafortune Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED ---------------------------------------- Bug #9499: The Vector.cross_product function returns the opposite vector of the expected result https://bugs.ruby-lang.org/issues/9499#change-45598 * Author: Deyan Hadzhiev * Status: Assigned * Priority: Normal * Assignee: Marc-Andre Lafortune * Category: lib * Target version: * ruby -v: ruby 2.1.0dev (2013-09-22) [i386-mingw32] * Backport: 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED ---------------------------------------- The member function of class Vector returns the opposite vector of the expected result. The function calculates the resulting vector as if the cross_product is v X self instead of self X v. Just to be sure I tried running the exact example from the 2.1.0 documentation, where is specified: Vector[1, 0, 0].cross_product Vector[0, 1, 0] => Vector[0, 0, 1] The documentation is right, but running the example produces Vector[0, 0, -1]. The fix is just to swap the two arguments of the '-' operator. The implementation is in matrix.rb line:1764 -- http://bugs.ruby-lang.org/