Class: Vissen::Output::Vixel
- Inherits:
-
Object
- Object
- Vissen::Output::Vixel
- Defined in:
- lib/vissen/output/vixel.rb
Overview
The ‘Vixel` (Vissen pixel) represents the two dimensional representation of each grid pixel, for each grid. Each vixel has an intensity (i) and a palette position (p), both with values in the range 0..1.
TODO: How do we want the vixel to saturate? When written or when read?
Instance Attribute Summary collapse
-
#i ⇒ Float
The vixel intensity.
-
#p ⇒ Float
The vixel palette position.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
True if the other object has the same intensity and palette position.
-
#initialize(i = 0.0, p = 0.0) ⇒ Vixel
constructor
A new instance of Vixel.
-
#inspect ⇒ String
A string representation of the vixel.
Constructor Details
#initialize(i = 0.0, p = 0.0) ⇒ Vixel
Returns a new instance of Vixel.
19 20 21 22 |
# File 'lib/vissen/output/vixel.rb', line 19 def initialize(i = 0.0, p = 0.0) self.i = i self.p = p end |
Instance Attribute Details
#i ⇒ Float
Returns the vixel intensity.
12 13 14 |
# File 'lib/vissen/output/vixel.rb', line 12 def i @i end |
#p ⇒ Float
Returns the vixel palette position.
15 16 17 |
# File 'lib/vissen/output/vixel.rb', line 15 def p @p end |
Instance Method Details
#==(other) ⇒ true, false
Returns true if the other object has the same intensity and palette position.
27 28 29 30 31 |
# File 'lib/vissen/output/vixel.rb', line 27 def ==(other) @i == other.i && @p == other.p rescue NoMethodError false end |
#inspect ⇒ String
Returns a string representation of the vixel.
34 35 36 |
# File 'lib/vissen/output/vixel.rb', line 34 def inspect format '(%.1f, %.1f)', @i, @p end |