Class: CrystalCell::Povray::Cylinder

Inherits:
Mageo::Cylinder
  • Object
show all
Defined in:
lib/crystalcell/povray/cylinder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(position0, position1, radius, color) ⇒ Cylinder

Returns a new instance of Cylinder.



6
7
8
9
# File 'lib/crystalcell/povray/cylinder.rb', line 6

def initialize(position0, position1, radius, color)
  super(position0, position1, radius)
  @color = color
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



4
5
6
# File 'lib/crystalcell/povray/cylinder.rb', line 4

def color
  @color
end

#positionsObject (readonly)

Returns the value of attribute positions.



4
5
6
# File 'lib/crystalcell/povray/cylinder.rb', line 4

def positions
  @positions
end

Instance Method Details

#dump(io) ⇒ Object



19
20
21
# File 'lib/crystalcell/povray/cylinder.rb', line 19

def dump(io)
  io.puts self.to_pov
end

#to_povObject

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



13
14
15
16
17
# 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