Class: CrystalCell::Povray::Triangle
- Inherits:
-
Mageo::Triangle
- Object
- Mageo::Triangle
- CrystalCell::Povray::Triangle
- Defined in:
- lib/crystalcell/povray/triangle.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#transmit ⇒ Object
Returns the value of attribute transmit.
Instance Method Summary collapse
- #dump(io) ⇒ Object
-
#initialize(vec0, vec1, vec2, color, transmit = nil) ⇒ Triangle
constructor
A new instance of Triangle.
-
#to_pov ⇒ Object
povray 形式の文字列を返す。 color は Float による配列。通常、0〜1の範囲。.
Constructor Details
#initialize(vec0, vec1, vec2, color, transmit = nil) ⇒ Triangle
Returns a new instance of Triangle.
7 8 9 10 11 |
# File 'lib/crystalcell/povray/triangle.rb', line 7 def initialize(vec0, vec1, vec2, color, transmit = nil) super(vec0, vec1, vec2) @color = color @transmit = transmit end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
5 6 7 |
# File 'lib/crystalcell/povray/triangle.rb', line 5 def color @color end |
#transmit ⇒ Object
Returns the value of attribute transmit.
5 6 7 |
# File 'lib/crystalcell/povray/triangle.rb', line 5 def transmit @transmit end |
Instance Method Details
#dump(io) ⇒ Object
29 30 31 |
# File 'lib/crystalcell/povray/triangle.rb', line 29 def dump(io) io.puts self.to_pov end |
#to_pov ⇒ Object
povray 形式の文字列を返す。color は Float による配列。通常、0〜1の範囲。
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/crystalcell/povray/triangle.rb', line 15 def to_pov v = self.vertices result = sprintf("triangle{<%f,%f,%f>,<%f,%f,%f>,<%f,%f,%f>", *@vertices[0], *@vertices[1], *@vertices[2]) result += sprintf(" pigment {color rgb<%f,%f,%f>", *@color) result += sprintf(" transmit %f", @transmit) if @transmit result += "}}" #result = sprintf("triangle{<%f,%f,%f>,<%f,%f,%f>,<%f,%f,%f> " + # "pigment {color rgb<%f,%f,%f>}}", # *@vertices[0], *@vertices[1], *@vertices[2], *@color) # return result end |