Plik:Symmetrical 5-set Venn diagram.svg

Treść strony nie jest dostępna w innych językach.
Ten plik jest umieszczony w Wikimedia Commons
Z Wikipedii, wolnej encyklopedii

Rozmiar pierwotny(Plik SVG, nominalnie 512 × 512 pikseli, rozmiar pliku: 4 KB)

 
W3C-validity not checked.

Opis

Opis
English: Radially-symmetrical five-set Venn diagram devised by Branko Grünbaum
Źródło Praca własna
Autor Cmglee

Python script to optimise for maximum area of the smallest regions

#!/usr/bin/env python
import math

class Ellipse:
 def __init__(self, x,y, rx,ry):
  self.x  = x
  self.y  = y
  self.rx = rx
  self.ry = ry

class Matrix:
 def __init__(self, ellipse):
  self.half_width  = max(int(math.ceil(ellipse.rx + ellipse.x) + 1),
                         int(math.ceil(ellipse.ry + ellipse.y) + 1))
  self.half_height = self.half_width
  self.width       = self.half_width * 2
  self.height      = self.half_height * 2
  self.cells       = [[0 for x in range(self.width)] for y in range(self.height)]
 def display(self):
  codes = '0123456789abcdefghijklmnopqrstuvwxyz'
  print('\n'.join([''.join([codes[self.cells[y][x]] for x in range(self.width)])
                                                    for y in range(self.height)]))
 def draw_ellipse(self, i_bit, ellipse, angle):
  mask_bit  = (1 << i_bit)
  sin_angle = math.sin(math.radians(angle))
  cos_angle = math.cos(math.radians(angle))
  for matrix_y in range(self.height):
   for matrix_x in range(self.width):
    cell_x_unrotated = matrix_x - self.half_width
    cell_y_unrotated = matrix_y - self.half_height
    cell_x = sin_angle * cell_y_unrotated + cos_angle * cell_x_unrotated
    cell_y = cos_angle * cell_y_unrotated - sin_angle * cell_x_unrotated
    cell_dx = float(cell_x - ellipse.x) / ellipse.rx
    cell_dy = float(cell_y - ellipse.y) / ellipse.ry
    # print('%3d%3d | %4d%4d | %6.2f%6.2f | %6.2f %d' %
    #       (matrix_x,matrix_y, cell_x,cell_y, cell_dx,cell_dy,
    #        cell_dx * cell_dx + cell_dy * cell_dy,cell_dx * cell_dx + cell_dy * cell_dy > 1))
    if (cell_dx * cell_dx + cell_dy * cell_dy <= 1): self.cells[matrix_y][matrix_x] |= mask_bit
 def draw_ellipses(self, ellipse):
  for i_ellipse in range(5): self.draw_ellipse(i_ellipse, ellipse, i_ellipse * 72)
 def count_regions(self):
  counts = [0 for code in range(1 << 5)]
  for matrix_y in range(self.height):
   for matrix_x in range(self.width):
    counts[self.cells[matrix_y][matrix_x]] += 1
  area_all  = self.width * self.height
  area_min  = area_all
  area_non0 = area_all - counts[0]
  for i_count in range(len(counts)):
   if (area_min > counts[i_count]): area_min = counts[i_count]
  if (True):
   # if (area_min > 0):
    bar = ''.join(['%-5d+----' % i for i in range(99)]).replace(' ','-')[1:]
    ppm = 1e6 * area_min / area_non0
    print('x:%2d y:%2d rx:%2d ry:%2d ppm:%4.0f %s' %
          (ellipse.x,ellipse.y, ellipse.rx,ellipse.ry, ppm, bar[:int(ppm / 100 + 0.5)]))
"""
ellipse = Ellipse(9,14, 40,80)
ellipse = Ellipse(7,16, 42,78)
ellipse = Ellipse(5,12, 46,70)
ellipse = Ellipse(5,14, 37,64)
ellipse = Ellipse(5,12, 40,65)
ellipse = Ellipse(5,12, 41,66)
ellipse = Ellipse(10,24, 82,132)
matrix  = Matrix(ellipse)
matrix.draw_ellipses(ellipse)
matrix.display()
matrix.count_regions()
"""
model_x  =  20; half_range_x  = 1; step_x  = 1
model_y  =  46; half_range_y  = 1; step_y  = 1
model_rx = 166; half_range_rx = 1; step_rx = 1
model_ry = 264; half_range_ry = 1; step_ry = 1
for    x  in range(-half_range_x , half_range_x  + 1, step_x ):
 for   y  in range(-half_range_y , half_range_y  + 1, step_y ):
  for  rx in range(-half_range_rx, half_range_rx + 1, step_rx):
   for ry in range(-half_range_ry, half_range_ry + 1, step_ry):
    ellipse = Ellipse(model_x + x,model_y + y, model_rx + rx,model_ry + ry)
    matrix  = Matrix(ellipse)
    matrix.draw_ellipses(ellipse)
    matrix.count_regions()
# """

Licencja

Ja, właściciel praw autorskich do tego dzieła, udostępniam je na poniższej licencji
w:pl:Licencje Creative Commons
uznanie autorstwa na tych samych warunkach
Wolno:
  • dzielić się – kopiować, rozpowszechniać, odtwarzać i wykonywać utwór
  • modyfikować – tworzyć utwory zależne
Na następujących warunkach:
  • uznanie autorstwa – musisz określić autorstwo utworu, podać link do licencji, a także wskazać czy utwór został zmieniony. Możesz to zrobić w każdy rozsądny sposób, o ile nie będzie to sugerować, że licencjodawca popiera Ciebie lub Twoje użycie utworu.
  • na tych samych warunkach – Jeśli zmienia się lub przekształca niniejszy utwór, lub tworzy inny na jego podstawie, można rozpowszechniać powstały w ten sposób nowy utwór tylko na podstawie tej samej lub podobnej licencji.

Podpisy

Dodaj jednolinijkowe objaśnienie tego, co ten plik pokazuje

Obiekty przedstawione na tym zdjęciu

przedstawia

Historia pliku

Kliknij na datę/czas, aby zobaczyć, jak plik wyglądał w tym czasie.

(od najnowszych | od najstarszych) Zobacz (10 nowszych | ) (10 | 20 | 50 | 100 | 250 | 500)
Data i czasMiniaturaWymiaryUżytkownikOpis
aktualny02:17, 16 kwi 2019Miniatura wersji z 02:17, 16 kwi 2019512 × 512 (4 KB)CmgleeImprove optimisation and rendering.
14:47, 14 paź 2016Miniatura wersji z 14:47, 14 paź 2016512 × 512 (4 KB)CmgleeOptimise for maximum area of the smallest regions.
02:35, 11 kwi 2011Miniatura wersji z 02:35, 11 kwi 2011746 × 742 (3 KB)AnonMoosadjusting margins
00:09, 12 mar 2011Miniatura wersji z 00:09, 12 mar 2011512 × 512 (3 KB)CmgleeUse defs to make opaque lines.
23:49, 11 mar 2011Miniatura wersji z 23:49, 11 mar 2011512 × 512 (3 KB)CmgleeExplicitly specify font size.
23:42, 11 mar 2011Miniatura wersji z 23:42, 11 mar 2011512 × 512 (1 KB)CmgleeMake transparent fill attribute of ellipses.
23:40, 11 mar 2011Miniatura wersji z 23:40, 11 mar 2011512 × 512 (1 KB)CmgleeAdd opaque lines.
23:37, 11 mar 2011Miniatura wersji z 23:37, 11 mar 2011512 × 512 (1017 bajtów)CmgleeUse fill with hex codes and opacity instead of fill with rgba codes.
23:34, 11 mar 2011Miniatura wersji z 23:34, 11 mar 2011512 × 512 (1010 bajtów)CmgleeTemporarily remove text to check if ellipses work.
23:33, 11 mar 2011Miniatura wersji z 23:33, 11 mar 2011512 × 512 (3 KB)CmgleeConvert CSS styles to attributes.
(od najnowszych | od najstarszych) Zobacz (10 nowszych | ) (10 | 20 | 50 | 100 | 250 | 500)

Żadna strona nie korzysta z tego pliku.

Globalne wykorzystanie pliku

Ten plik jest wykorzystywany także w innych projektach wiki:

Metadane