[#65451] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...

Issue #10333 has been updated by Koichi Sasada.

9 messages 2014/10/07

[ruby-core:65963] [ruby-trunk - Feature #10442] Helper methods to Vector class

From: ruby-core@...
Date: 2014-10-29 00:51:07 UTC
List: ruby-core #65963
Issue #10442 has been updated by Marc-Andre Lafortune.


Thanks for the feature request(s).

I think `angle_between` could be useful. The patch needs work though:

* should check that given argument is a Vector
* should calling `self` when not necessary
* should avoid create intermediary vectors when not necessary for performance reasons
* the doc should specify the return to be in [0...Math::PI]
* I feel that `angle_with` would be a more appropriate name

I am less confident about the `projection_to`. It's really the norm of the projection, so maybe a name like `projected_norm` would be clearer, but I'm curious if this would be used much. Are there applications that use this? If so, please open a separate feature request with details on what kind of applications would use this.

I'll give you a couple of days if you'd like to fix the patch for `angle_with`, otherwise I'll fix it myself and commit it, up to you :-)

Thanks


----------------------------------------
Feature #10442: Helper methods to Vector class
https://bugs.ruby-lang.org/issues/10442#change-49697

* Author: Egunov Dmitriy
* Status: Open
* Priority: Normal
* Assignee: Marc-Andre Lafortune
* Category: lib
* Target version: 
----------------------------------------
Vector class missed some very helpful methods like angle between another vector and vector projection.

Patch attached. Please advice if more unit tests are needed.

---Files--------------------------------
vector_helpers.patch (1.44 KB)


-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next