Project

General

Profile

Bug #9499

The Vector.cross_product function returns the opposite vector of the expected result

Added by dodo (Deyan Hadzhiev) about 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-09-22) [i386-mingw32]
[ruby-core:60564]

Description

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

Associated revisions

Revision 72d05366
Added by marcandre (Marc-Andre Lafortune) almost 5 years ago

  • lib/matrix.rb: Fix sign for cross_product [#9499]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 46780
Added by marcandre (Marc-Andre Lafortune) almost 5 years ago

  • lib/matrix.rb: Fix sign for cross_product [#9499]

Revision 46780
Added by marcandre (Marc-Andre Lafortune) almost 5 years ago

  • lib/matrix.rb: Fix sign for cross_product [#9499]

Revision 46780
Added by marcandre (Marc-Andre Lafortune) almost 5 years ago

  • lib/matrix.rb: Fix sign for cross_product [#9499]

Revision 46780
Added by marcandre (Marc-Andre Lafortune) almost 5 years ago

  • lib/matrix.rb: Fix sign for cross_product [#9499]

Revision 46780
Added by marcandre (Marc-Andre Lafortune) almost 5 years ago

  • lib/matrix.rb: Fix sign for cross_product [#9499]

Revision 46780
Added by marcandre (Marc-Andre Lafortune) almost 5 years ago

  • lib/matrix.rb: Fix sign for cross_product [#9499]

Revision feea0a9e
Added by nagachika (Tomoyuki Chikanaga) almost 5 years ago

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

Revision 46789
Added by nagachika (Tomoyuki Chikanaga) almost 5 years ago

merge revision(s) r46780: [Backport #9499]

* lib/matrix.rb: Fix sign for cross_product [#9499]

History

Updated by nagachika (Tomoyuki Chikanaga) about 5 years ago

  • Status changed from Open to Assigned
  • Assignee set to marcandre (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

Updated by nagachika (Tomoyuki Chikanaga) almost 5 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Applied in changeset ruby-21:r46789.


merge revision(s) r46780: [Backport #9499]

* lib/matrix.rb: Fix sign for cross_product [#9499]

Updated by nagachika (Tomoyuki Chikanaga) almost 5 years ago

  • Backport changed from 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: DONE

backported at r46789.

Also available in: Atom PDF