Method: PhotoUtils::SceneView#initialize

Defined in:
lib/photo_utils/scene_view.rb

#initialize(scene, options = {}) ⇒ SceneView

Returns a new instance of SceneView.



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/photo_utils/scene_view.rb', line 15

def initialize(scene, options={})
  @scene = scene
  @width = options[:width] || 900
  @height = options[:height] || 50
  @max_distance = options[:max_distance] || @scene.depth_of_field.far
  @camera_width  = options[:camera_width]  || @scene.focal_length
  @camera_height = options[:camera_height] || [@scene.absolute_aperture, @scene.format.height].max
  @scale = (@width.to_f - @height) / (@camera_width + @max_distance)
  @camera_scale = [
    @height.to_f / @camera_width,
    @height.to_f / @camera_height
  ].min
end