Feature #4891

Vector#normalize

Added by Kenta Murata almost 3 years ago. Updated almost 3 years ago.

[ruby-dev:43829]
Status:Closed
Priority:Normal
Assignee:Marc-Andre Lafortune
Category:lib
Target version:1.9.3

Description

知人からベクトルを正規化するメソッドが無いよと言われました。

いままで誰も気付かなかった (もしくは気付いても放っておいた) のですが、
存在してて当然のメソッドのような気がするので追加の提案をします。

パッチはこれです。
https://gist.github.com/1029140

History

#1 Updated by Kenta Murata almost 3 years ago

Bug じゃなくて Feature にするつもりでした。
Bug から Feature へ後から変更することはできないんでしょうか?

#2 Updated by Shota Fukumori almost 3 years ago

  • Tracker changed from Bug to Feature

#3 Updated by Marc-Andre Lafortune almost 3 years ago

  • Status changed from Open to Assigned
  • Assignee changed from Keiju Ishitsuka to Marc-Andre Lafortune
  • Target version changed from 2.0.0 to 1.9.3

Sure.

I have to merge in my announced changes to Matrix & Vector in 1.9.3 as soon as I get the time, so I could include this too. Are we after the official feature freeze yet (I don't see the 1.9.3 branch)?

#4 Updated by Sakuro OZAWA almost 3 years ago

=begin
Just for curiosity's sake, what is expected from Vector[0,0,0].normalize ?

  • (()) says: the zero vector cannot be normalized.
  • The patch gives Vector[NaN, NaN, NaN].
  • returns (dup of) self?
  • domain error? =end

#5 Updated by Marc-Andre Lafortune almost 3 years ago

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

Applied as r32467, thank you!

Also available in: Atom PDF