Class: Teien::Vector3D

Inherits:
Bullet::BtVector3
  • Object
show all
Defined in:
lib/teien/core/tools.rb

Overview

3d vector

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

._load(source) ⇒ Object



58
59
60
61
# File 'lib/teien/core/tools.rb', line 58

def self._load(source)
  array = source.unpack("fff")
  return Vector3D.new(array[0], array[1], array[2])
end

.to_bullet(ogre) ⇒ Object



42
43
44
# File 'lib/teien/core/tools.rb', line 42

def self.to_bullet(ogre)
  return Bullet::BtVector3.new(ogre.x, ogre.y, ogre.z)
end

.to_ogre(bullet) ⇒ Object



38
39
40
# File 'lib/teien/core/tools.rb', line 38

def self.to_ogre(bullet)
  return Ogre::Vector3.new(bullet.x, bullet.y, bullet.z)
end

.to_self(vec) ⇒ Object



46
47
48
# File 'lib/teien/core/tools.rb', line 46

def self.to_self(vec)
  return Vector3D.new(vec.x, vec.y, vec.z)
end

.to_string(vec) ⇒ Object



50
51
52
# File 'lib/teien/core/tools.rb', line 50

def self.to_string(vec)
  return sprintf("(%f, %f, %f)", vec.x, vec.y, vec.z)
end

Instance Method Details

#_dump(limit) ⇒ Object



54
55
56
# File 'lib/teien/core/tools.rb', line 54

def _dump(limit)
  return [x(), y(), z()].pack("fff")
end

#copy(vec) ⇒ Object



63
64
65
# File 'lib/teien/core/tools.rb', line 63

def copy(vec)
  set_value(vec.x, vec.y, vec.z)
end