Class: Siren::Vec

Inherits:
Object
  • Object
show all
Defined in:
lib/vec.rb

Overview

Vec クラス拡張メソッド

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.oObject



10
11
12
# File 'lib/vec.rb', line 10

def self.o
  Siren::Vec.new 0.0, 0.0, 0.0
end

.xObject



14
15
16
# File 'lib/vec.rb', line 14

def self.x
  Siren::Vec.new 1.0, 0.0, 0.0
end

.xdirObject



54
55
56
# File 'lib/vec.rb', line 54

def self.xdir
  Siren::Vec.x
end

.xyObject



26
27
28
# File 'lib/vec.rb', line 26

def self.xy
  Siren::Vec.new 1.0, 1.0, 0.0
end

.xyzObject



50
51
52
# File 'lib/vec.rb', line 50

def self.xyz
  Siren::Vec.new 1.0, 1.0, 1.0
end

.xzObject



30
31
32
# File 'lib/vec.rb', line 30

def self.xz
  Siren::Vec.new 1.0, 0.0, 1.0
end

.yObject



18
19
20
# File 'lib/vec.rb', line 18

def self.y
  Siren::Vec.new 0.0, 1.0, 0.0
end

.ydirObject



58
59
60
# File 'lib/vec.rb', line 58

def self.ydir
  Siren::Vec.y
end

.yxObject



34
35
36
# File 'lib/vec.rb', line 34

def self.yx
  Siren::Vec.new 1.0, 1.0, 0.0
end

.yzObject



38
39
40
# File 'lib/vec.rb', line 38

def self.yz
  Siren::Vec.new 0.0, 1.0, 1.0
end

.zObject



22
23
24
# File 'lib/vec.rb', line 22

def self.z
  Siren::Vec.new 0.0, 0.0, 1.0
end

.zdirObject



62
63
64
# File 'lib/vec.rb', line 62

def self.zdir
  Siren::Vec.z
end

.zeroObject



6
7
8
# File 'lib/vec.rb', line 6

def self.zero
  Siren::Vec.new 0.0, 0.0, 0.0
end

.zxObject



42
43
44
# File 'lib/vec.rb', line 42

def self.zx
  Siren::Vec.new 1.0, 0.0, 1.0
end

.zyObject



46
47
48
# File 'lib/vec.rb', line 46

def self.zy
  Siren::Vec.new 0.0, 1.0, 1.0
end

Instance Method Details

#to_aObject Also known as: to_ary, xyz

Return x, y and z values of this object as an array.



75
76
77
# File 'lib/vec.rb', line 75

def to_a
  [self.x, self.y, self.z]
end

#to_sObject Also known as: inspect

Return this object as a string.



68
69
70
# File 'lib/vec.rb', line 68

def to_s
  "#<Vec:0x%x @x=%f, @y=%f, @z=%f>" % [self.object_id, self.x, self.y, self.z]
end