Class: CrystalCell::Povray::Camera

Inherits:
Object
  • Object
show all
Defined in:
lib/crystalcell/povray/camera.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(camera_type: nil, location: nil, right: [-1.33, 0.0, 0.0], up: nil, direction: nil, sky: [0.0, 0.0, 1.0], angle: nil, look_at: nil) ⇒ Camera

camera_type: perspectice, orthographic, etc. Note: default values of some setting is modified from original povray

because of left-handed coordinate system.
This library provide only on right-handed system in crystallography.

---------------------------------------------
setting       default_orig  default_this
camera_type   perspective   
location      <0,0,0>       
direction     <0,0,1>       
right         <1.33,0,0>    [-1.33, 0.0, 0.0],
sky           <0,1,0>       [  0.0, 0.0, 1.0],
up            <0,1,0>       
look_at       <0,0,1>


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/crystalcell/povray/camera.rb', line 43

def initialize(camera_type:      nil, # perspective
               location:         nil, # <0,0,0>
               right:            [-1.33, 0.0, 0.0],
               up:               nil,
               direction:        nil,
               sky:              [0.0, 0.0, 1.0],
               angle:            nil,
               #camera_modifiers: nil,
               look_at:          nil
               )
  @camera_type  = camera_type
  @location     = location
  @right        = right
  @up           = up
  @direction    = direction
  @sky          = sky
  @angle        = angle
  #@camera_modifiers    = camera_modifiers
  @look_at      = look_at
end

Instance Attribute Details

#angleObject

camera { orthographic

// orthographic       // これを入れる場合は location の前に。
location <  3.0, 3.0, 3.0 > // camera location
look_at  <  0.0, 0.0, 0.0 > // 注視点
sky      <  0.0, 0.0, 1.0 >
right    <-1.00, 0.0, 0.0 >
up       <  0.0, 1.0, 0.0 >
angle    68                 // カメラの水平方向の画角。左右合計の角度。

}



26
27
28
# File 'lib/crystalcell/povray/camera.rb', line 26

def angle
  @angle
end

#camera_typeObject

camera { orthographic

// orthographic       // これを入れる場合は location の前に。
location <  3.0, 3.0, 3.0 > // camera location
look_at  <  0.0, 0.0, 0.0 > // 注視点
sky      <  0.0, 0.0, 1.0 >
right    <-1.00, 0.0, 0.0 >
up       <  0.0, 1.0, 0.0 >
angle    68                 // カメラの水平方向の画角。左右合計の角度。

}



26
27
28
# File 'lib/crystalcell/povray/camera.rb', line 26

def camera_type
  @camera_type
end

#directionObject

camera { orthographic

// orthographic       // これを入れる場合は location の前に。
location <  3.0, 3.0, 3.0 > // camera location
look_at  <  0.0, 0.0, 0.0 > // 注視点
sky      <  0.0, 0.0, 1.0 >
right    <-1.00, 0.0, 0.0 >
up       <  0.0, 1.0, 0.0 >
angle    68                 // カメラの水平方向の画角。左右合計の角度。

}



26
27
28
# File 'lib/crystalcell/povray/camera.rb', line 26

def direction
  @direction
end

#locationObject

camera { orthographic

// orthographic       // これを入れる場合は location の前に。
location <  3.0, 3.0, 3.0 > // camera location
look_at  <  0.0, 0.0, 0.0 > // 注視点
sky      <  0.0, 0.0, 1.0 >
right    <-1.00, 0.0, 0.0 >
up       <  0.0, 1.0, 0.0 >
angle    68                 // カメラの水平方向の画角。左右合計の角度。

}



26
27
28
# File 'lib/crystalcell/povray/camera.rb', line 26

def location
  @location
end

#look_atObject

camera { orthographic

// orthographic       // これを入れる場合は location の前に。
location <  3.0, 3.0, 3.0 > // camera location
look_at  <  0.0, 0.0, 0.0 > // 注視点
sky      <  0.0, 0.0, 1.0 >
right    <-1.00, 0.0, 0.0 >
up       <  0.0, 1.0, 0.0 >
angle    68                 // カメラの水平方向の画角。左右合計の角度。

}



26
27
28
# File 'lib/crystalcell/povray/camera.rb', line 26

def look_at
  @look_at
end

#rightObject

camera { orthographic

// orthographic       // これを入れる場合は location の前に。
location <  3.0, 3.0, 3.0 > // camera location
look_at  <  0.0, 0.0, 0.0 > // 注視点
sky      <  0.0, 0.0, 1.0 >
right    <-1.00, 0.0, 0.0 >
up       <  0.0, 1.0, 0.0 >
angle    68                 // カメラの水平方向の画角。左右合計の角度。

}



26
27
28
# File 'lib/crystalcell/povray/camera.rb', line 26

def right
  @right
end

#skyObject

camera { orthographic

// orthographic       // これを入れる場合は location の前に。
location <  3.0, 3.0, 3.0 > // camera location
look_at  <  0.0, 0.0, 0.0 > // 注視点
sky      <  0.0, 0.0, 1.0 >
right    <-1.00, 0.0, 0.0 >
up       <  0.0, 1.0, 0.0 >
angle    68                 // カメラの水平方向の画角。左右合計の角度。

}



26
27
28
# File 'lib/crystalcell/povray/camera.rb', line 26

def sky
  @sky
end

#upObject

camera { orthographic

// orthographic       // これを入れる場合は location の前に。
location <  3.0, 3.0, 3.0 > // camera location
look_at  <  0.0, 0.0, 0.0 > // 注視点
sky      <  0.0, 0.0, 1.0 >
right    <-1.00, 0.0, 0.0 >
up       <  0.0, 1.0, 0.0 >
angle    68                 // カメラの水平方向の画角。左右合計の角度。

}



26
27
28
# File 'lib/crystalcell/povray/camera.rb', line 26

def up
  @up
end

Instance Method Details

#dump(io) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/crystalcell/povray/camera.rb', line 64

def dump(io)
  io.puts "camera {"
  io.printf("  %s\n", @camera_type) if @camera_type
  io.printf("  location  <%f, %f, %f >\n", *@location)  if @location
  io.printf("  right     <%f, %f, %f >\n", *@right)     if @right
  io.printf("  up        <%f, %f, %f >\n", *@up)        if @up
  io.printf("  direction <%f, %f, %f >\n", *@direction) if @direction
  io.printf("  sky       <%f, %f, %f >\n", *@sky)       if @sky
  io.printf("  angle     %f\n"           , @angle)      if @angle
  #@camera_modifiers.each do |i|
  #  io.puts i
  #end
  io.printf("  look_at   <%f, %f, %f >\n", *@look_at) if @look_at
  io.puts "}"
end