Class: Ra::Surface
- Inherits:
-
Object
- Object
- Ra::Surface
- Defined in:
- lib/ra/surface.rb
Overview
A surface contains everything needed to apply lighting.
Instance Attribute Summary collapse
Instance Method Summary collapse
- #hpoint ⇒ Vector
-
#initialize(eyev:, normalv:, reflectv:, shape:, point:) ⇒ Surface
constructor
A new instance of Surface.
Constructor Details
#initialize(eyev:, normalv:, reflectv:, shape:, point:) ⇒ Surface
Returns a new instance of Surface.
30 31 32 33 34 35 36 |
# File 'lib/ra/surface.rb', line 30 def initialize(eyev:, normalv:, reflectv:, shape:, point:) @eyev = eyev @normalv = normalv.dot(eyev).negative? ? -normalv : +normalv @reflectv = reflectv @shape = shape @point = point end |
Instance Attribute Details
#eyev ⇒ Vector
8 9 10 |
# File 'lib/ra/surface.rb', line 8 def eyev @eyev end |
#normalv ⇒ Vector
12 13 14 |
# File 'lib/ra/surface.rb', line 12 def normalv @normalv end |
#point ⇒ Vector
24 25 26 |
# File 'lib/ra/surface.rb', line 24 def point @point end |
#reflectv ⇒ Vector
16 17 18 |
# File 'lib/ra/surface.rb', line 16 def reflectv @reflectv end |
Instance Method Details
#hpoint ⇒ Vector
39 40 41 |
# File 'lib/ra/surface.rb', line 39 def hpoint @hpoint ||= point + (normalv * EPSILON) end |