Class: Snow::Mat3

Inherits:
Object
  • Object
show all
Defined in:
lib/snow-math/mat3.rb

Instance Method Summary collapse

Instance Method Details

#adjoint!Object



33
34
35
# File 'lib/snow-math/mat3.rb', line 33

def adjoint!
  adjoint self
end

#cofactor!Object



37
38
39
# File 'lib/snow-math/mat3.rb', line 37

def cofactor!
  cofactor self
end

#inverse!Object



29
30
31
# File 'lib/snow-math/mat3.rb', line 29

def inverse!
  inverse self
end

#multiply(rhs, out = nil) ⇒ Object Also known as: *



45
46
47
48
49
50
51
52
53
# File 'lib/snow-math/mat3.rb', line 45

def multiply(rhs, out = nil)
  raise "Invalid type for output, must be the same as RHS" if !out.nil? && !out.kind_of?(rhs.class)
  case rhs
  when ::Snow::Mat3 then multiply_mat3(rhs, out)
  when ::Snow::Vec3 then rotate_vec3(rhs, out)
  when Numeric      then scale(rhs, rhs, rhs, out)
  else raise TypeError, "Invalid type for RHS"
  end
end

#multiply!(rhs) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/snow-math/mat3.rb', line 55

def multiply!(rhs)
  multiply rhs, case rhs
    when Mat3, Numeric then self
    when Vec3 then rhs
    else raise TypeError, "Invalid type for RHS"
    end
end

#multiply_mat3!(rhs) ⇒ Object



41
42
43
# File 'lib/snow-math/mat3.rb', line 41

def multiply_mat3!(rhs)
  multiply_mat3 rhs, self
end

#scale!(x, y, z) ⇒ Object



63
64
65
# File 'lib/snow-math/mat3.rb', line 63

def scale!(x, y, z)
  scale x, y, z, self
end

#transpose!Object



25
26
27
# File 'lib/snow-math/mat3.rb', line 25

def transpose!
  transpose self
end