Class: ColorDecomposition::Quadtree
- Inherits:
-
Object
- Object
- ColorDecomposition::Quadtree
- Defined in:
- lib/color_decomposition/quadtree/quadtree.rb
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #base_nodes ⇒ Object
- #generate_similarity_tree(similarity) ⇒ Object
-
#initialize(width, height) ⇒ Quadtree
constructor
A new instance of Quadtree.
Constructor Details
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
5 6 7 |
# File 'lib/color_decomposition/quadtree/quadtree.rb', line 5 def root @root end |
Instance Method Details
#base_nodes ⇒ Object
11 12 13 14 |
# File 'lib/color_decomposition/quadtree/quadtree.rb', line 11 def base_nodes generate_to_base(nodes = [], max_level) nodes end |
#generate_similarity_tree(similarity) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/color_decomposition/quadtree/quadtree.rb', line 16 def generate_similarity_tree(similarity) level = max_level - 1 level.times do nodes_from_level(nodes = [], level) nodes.each do |node| node.merge if node.child_leaves? && node.similar?(similarity) end level -= 1 end end |