Method: Processing::Vector#initialize
- Defined in:
- lib/processing/vector.rb
#new ⇒ Vector #new(x) ⇒ Vector #new(x, y) ⇒ Vector #new(x, y, z) ⇒ Vector #new(v) ⇒ Vector #new(a) ⇒ Vector
Initialize vector object.
31 32 33 34 35 36 37 38 39 |
# File 'lib/processing/vector.rb', line 31 def initialize(x = 0, y = 0, z = 0, context: nil) @point = case x when Rays::Point then x.dup when Vector then x.getInternal__.dup when Array then Rays::Point.new x[0] || 0, x[1] || 0, x[2] || 0 else Rays::Point.new x || 0, y || 0, z || 0 end @context = context || Context.context__ end |