class Assimp::Vector3D

Public Instance Methods

*(other) click to toggle source
# File lib/assimp/vector3.rb, line 49
def *(other)
  v = Vector3D::new
  if other.kind_of? Vector3D
    v.set(x * other.x,
          y * other.y,
          z * other.z)
  else
    v.set(x * other,
          y * other,
          z * other)
  end
end
+(other) click to toggle source
# File lib/assimp/vector3.rb, line 35
def +(other)
  v = Vector3D::new
  v.set(x + other.x,
        y + other.y,
        z + other.z)
end
-(other) click to toggle source
# File lib/assimp/vector3.rb, line 42
def -(other)
  v = Vector3D::new
  v.set(x - other.x,
        y - other.y,
        z - other.z)
end
-@() click to toggle source
# File lib/assimp/vector3.rb, line 30
def -@
  v = Vector3D::new
  v.set(-x, -y, -z)
end
/(other) click to toggle source
# File lib/assimp/vector3.rb, line 69
def /(other)
  v = Vector3D::new
  if other.kind_of? Vector3D
    v.set(x / other.x,
          y / other.y,
          z / other.z)
  else
    v.set(x / other,
          y / other,
          z / other)
  end
end
^(other) click to toggle source
# File lib/assimp/vector3.rb, line 62
def ^(other)
  v = Vector3D::new
  v.set(y*other.z - z*other.y,
        z*other.x - x*other.z,
        x*other.y - y*other.x)
end
length() click to toggle source
# File lib/assimp/vector3.rb, line 19
def length
  Math::sqrt(square_length)
end
normalize() click to toggle source
# File lib/assimp/vector3.rb, line 92
def normalize
  v = self.dup
  v.normalize!
end
normalize!() click to toggle source
# File lib/assimp/vector3.rb, line 82
def normalize!
  l = length
  if l > 0.0
    self.x /= l
    self.y /= l
    self.z /= l
  end
  self
end
set( x, y, z ) click to toggle source
# File lib/assimp/vector3.rb, line 23
def set( x, y, z )
  self[:x] = x
  self[:y] = y
  self[:z] = z
  self
end
square_length() click to toggle source
# File lib/assimp/vector3.rb, line 15
def square_length
  x*x + y*y + z*z
end
to_s() click to toggle source
# File lib/assimp/vector3.rb, line 11
def to_s
  "<#{x}, #{y}, #{z}>"
end