Module: Digiproc::CoreExtensions::VectorExtension::Projection::ClassMethods

Defined in:
lib/extensions/core_extensions.rb

Instance Method Summary collapse

Instance Method Details

#project(vec1, vec2) ⇒ Object

.projcect(vector1, vector2) returns a projection of vector 1 onto vector 2



85
86
87
88
89
# File 'lib/extensions/core_extensions.rb', line 85

def project(vec1, vec2)
    vec1 = vec1.is_a?(Vector)? vec1 : Vector.elements(vec1)
    vec2 = vec2.is_a?(Vector) ? vec2 : Vector.elements(vec2)
    vec2.project_onto vec1
end