class CrystalCell::Povray::Triangle

Attributes

color[RW]
transmit[RW]

Public Class Methods

new(vec0, vec1, vec2, color, transmit = nil) click to toggle source
Calls superclass method
# 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

Public Instance Methods

dump(io) click to toggle source
# File lib/crystalcell/povray/triangle.rb, line 26
def dump(io)
  io.puts self.to_pov
end
to_pov() click to toggle source

povray 形式の文字列を返す。 color は Float による配列。通常、0〜1の範囲。

# File lib/crystalcell/povray/triangle.rb, line 15
def to_pov
  #v = self.vertices
  #sprintf( "object { cylinder{ <% 7.4f, % 7.4f, % 7.4f>, <% 7.4f, % 7.4f, % 7.4f>, %7.4f } pigment { color rgb <%4.2f, %4.2f, %4.2f> } }",
  result = sprintf("triangle{ < % 7.4f, % 7.4f, % 7.4f>,<% 7.4f,% 7.4f,% 7.4f>,<% 7.4f,% 7.4f,% 7.4f>",
    *@vertices[0], *@vertices[1], *@vertices[2])
  result +=  sprintf(" pigment {color rgb<% 7.4f,% 7.4f,% 7.4f>", *@color)
  result +=  sprintf(" transmit % 7.4f", @transmit) if @transmit
  result +=  "}}"
  return result
end