File:FermatSpiral.png

From Sugar Labs
Jump to navigation Jump to search

FermatSpiral.png(600 × 450 pixels, file size: 45 KB, MIME type: image/png)

    def _calculate_position(self, radius, icon_size, index, children_count):
        width, height = self.box.get_allocation()
        # include an offset (8) to the index
        # so that the center of the spiral is left blank
        # angle = n * 137.5 degree or 2.4 radians
        angle = (index + 8) * 2.4

        # radius = constant * sqrt(n)
        radius = (_MINIMUM_RADIUS / 5) * math.sqrt(index + 8)

        x = radius * math.cos(angle) + (width - icon_size) / 2
        y = radius * 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/TimeThumbnailDimensionsUserComment
current19:16, 9 September 2008Thumbnail for version as of 19:16, 9 September 2008600 × 450 (45 KB)Walter (talk | contribs)

The following page uses this file: