Changeset 684 for mds-and-trees


Ignore:
Timestamp:
09/03/17 15:57:13 (3 years ago)
Author:
Maciej Komosinski
Message:

Minor optimization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mds-and-trees/tree-genealogy.py

    r683 r684  
    243243        sublines = 50
    244244        # TODO could be faster: compute delta and only add delta each time (but currently we do not use it often)
     245        normdiv = 2*sublines-1
    245246        for i in range(sublines):
    246             from_pos_sub = (self.compute_value(from_pos[0], to_pos[0], 2*i/(2*sublines-1), 1),
    247                             self.compute_value(from_pos[1], to_pos[1], 2*i/(2*sublines-1), 1))
    248             to_pos_sub = (self.compute_value(from_pos[0], to_pos[0], (2*i+1)/(2*sublines-1), 1),
    249                           self.compute_value(from_pos[1], to_pos[1], (2*i+1)/(2*sublines-1), 1))
     247            from_pos_sub = (self.compute_value(from_pos[0], to_pos[0], 2*i/normdiv, 1),
     248                            self.compute_value(from_pos[1], to_pos[1], 2*i/normdiv, 1))
     249            to_pos_sub = (self.compute_value(from_pos[0], to_pos[0], (2*i+1)/normdiv, 1),
     250                          self.compute_value(from_pos[1], to_pos[1], (2*i+1)/normdiv, 1))
    250251            self.add_line(file, from_pos_sub, to_pos_sub, style)
    251252
Note: See TracChangeset for help on using the changeset viewer.