Sha256: b1cdb01c1dd044894cfcf5312bed6f5e7334a44a5bb3b43fe5f2e7ec52262793

Contents?: true

Size: 707 Bytes

Versions: 1

Compression:

Stored size: 707 Bytes

Contents

#! /usr/bin/env ruby # coding: utf-8

class Mageo::Sphere
  # povray 形式の文字列を返す。
  # color は Float による配列。通常、0〜1の範囲。
  def to_pov(color: , transmit: nil)
    result = sprintf("object { sphere{<% 7.4f, % 7.4f, % 7.4f>, %7.4f} ", *position, radius)
    #sprintf( "object { sphere{<% 7.4f, % 7.4f, % 7.4f>, %7.4f} pigment {color rgb <%4.2f, %4.2f, %4.2f>} }",
    #  *position, radius, *color)

    if transmit
      result += sprintf("pigment {color rgbt <%4.2f, %4.2f, %4.2f, %4.2f>} }", *color, transmit)
    else
      result += sprintf("pigment {color rgb <%4.2f, %4.2f, %4.2f>} }", *color)
    end
  end

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


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crystalcell-0.1.1 lib/crystalcell/povray/sphere.rb