class CrystalCell::Povray::Cylinder

Attributes

color[R]
positions[R]

Public Class Methods

new(position0, position1, radius, color) click to toggle source
Calls superclass method
# File lib/crystalcell/povray/cylinder.rb, line 6
def initialize(position0, position1, radius, color)
  super(position0, position1, radius)
  @color = color
end

Public Instance Methods

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

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

# File lib/crystalcell/povray/cylinder.rb, line 13
def to_pov
  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> } }",
  *positions[0], *positions[1], radius, *color)
  #*@positions[0], *@positions[1], radius, @color)
end