Method: Rubyvis::Vector#initialize

Defined in:
lib/rubyvis/vector.rb

#initialize(x, y) ⇒ Vector

Constructs a pv.Vector for the specified x and y coordinate. This constructor should not be invoked directly; use pv.vector instead.

y&#x27e9;</i>. The intent of this class is to simplify vector math. Note that in performance-sensitive cases it may be more efficient to represent 2D vectors as simple objects with x and y attributes, rather than using instances of this class.

Parameters:

  • x (number)

    the x coordinate.

  • y (number)

    the y coordinate.



28
29
30
31
# File 'lib/rubyvis/vector.rb', line 28

def initialize(x,y) 
  @x=x
  @y=y
end