Class: Bayonetta::Position

Inherits:
LibBin::Structure
  • Object
show all
Includes:
VectorAccessor
Defined in:
lib/bayonetta/wmb.rb

Instance Method Summary collapse

Methods included from VectorAccessor

#[], #[]=

Instance Method Details

#*(scal) ⇒ Object



504
505
506
507
508
509
510
# File 'lib/bayonetta/wmb.rb', line 504

def *(scal)
  b = Position::new
  b.x = @x*scal
  b.y = @y*scal
  b.z = @z*scal
  b
end

#+(other) ⇒ Object



496
497
498
499
500
501
502
# File 'lib/bayonetta/wmb.rb', line 496

def +(other)
  b = Position::new
  b.x = @x + other.x
  b.y = @y + other.y
  b.z = @z + other.z
  b
end

#-(other) ⇒ Object



480
481
482
483
484
485
486
# File 'lib/bayonetta/wmb.rb', line 480

def -(other)
  b = Position::new
  b.x = @x - other.x
  b.y = @y - other.y
  b.z = @z - other.z
  b
end

#-@Object



488
489
490
491
492
493
494
# File 'lib/bayonetta/wmb.rb', line 488

def -@
  b = Position::new
  b.x = -@x
  b.y = -@y
  b.z = -@z
  b
end

#to_aObject



520
521
522
# File 'lib/bayonetta/wmb.rb', line 520

def to_a
  [x, y, z]
end

#to_sObject



516
517
518
# File 'lib/bayonetta/wmb.rb', line 516

def to_s
  "<#{@x}, #{@y}, #{@z}>"
end

#to_yaml_propertiesObject



512
513
514
# File 'lib/bayonetta/wmb.rb', line 512

def to_yaml_properties
  [:@x, :@y, :@z]
end