File:Spiral.png: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<pre> | |||
def _calculate_position(self, radius, icon_size, index, children_count): | |||
width, height = self.box.get_allocation() | |||
# angle decreases as the radius increases | |||
inc = 12.0 + index / 6.0 | |||
angle = index * (2 * math.pi / inc) - math.pi / 2 | |||
# radius is proportional to index/children_count | |||
myminimum = _MINIMUM_RADIUS * .667 | |||
newradius = ((radius - myminimum) * (index * 1.1) / children_count) + | |||
myminimum | |||
x = newradius * math.cos(angle) + (width - icon_size) / 2 | |||
y = newradius * math.sin(angle) + (height - icon_size - | |||
style.GRID_CELL_SIZE) / 2 | |||
return x, y | |||
</pre> | |||
Latest revision as of 19:20, 9 September 2008
def _calculate_position(self, radius, icon_size, index, children_count):
width, height = self.box.get_allocation()
# angle decreases as the radius increases
inc = 12.0 + index / 6.0
angle = index * (2 * math.pi / inc) - math.pi / 2
# radius is proportional to index/children_count
myminimum = _MINIMUM_RADIUS * .667
newradius = ((radius - myminimum) * (index * 1.1) / children_count) +
myminimum
x = newradius * math.cos(angle) + (width - icon_size) / 2
y = newradius * math.sin(angle) + (height - icon_size -
style.GRID_CELL_SIZE) / 2
return x, y
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Thumbnail | Dimensions | User | Comment | |
|---|---|---|---|---|---|
| current | 19:15, 9 September 2008 | 600 × 450 (40 KB) | Walter (talk | contribs) |
You cannot overwrite this file.
File usage
The following page uses this file: