Module: Ra::Tuple
- Defined in:
- lib/ra/tuple.rb
Overview
Constant Summary collapse
- POINT =
1
- VECTOR =
0
Class Method Summary collapse
Class Method Details
.cross(source, target) ⇒ Vector
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ra/tuple.rb', line 15 def self.cross(source, target) cross = Vector[source[0], source[1], source[2]].cross(Vector[target[0], target[1], target[2]]) Vector[ cross[0], cross[1], cross[2], Tuple::VECTOR, ] end |
.reflect(vector, normal) ⇒ Vector
29 30 31 |
# File 'lib/ra/tuple.rb', line 29 def self.reflect(vector, normal) vector - (normal * 2 * vector.dot(normal)) end |