File:Symmetrical 5-set Venn diagram.svg
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
![File:Symmetrical 5-set Venn diagram.svg](https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Symmetrical_5-set_Venn_diagram.svg/512px-Symmetrical_5-set_Venn_diagram.svg.png?20190416001745)
Size of this PNG preview of this SVG file: 512 × 512 pixels. Other resolutions: 240 × 240 pixels | 480 × 480 pixels | 768 × 768 pixels | 1,024 × 1,024 pixels | 2,048 × 2,048 pixels.
Original file (SVG file, nominally 512 × 512 pixels, file size: 4 KB)
File information
Structured data
Captions
Captions
Add a one-line explanation of what this file represents
Summary
[edit]DescriptionSymmetrical 5-set Venn diagram.svg |
English: Radially-symmetrical five-set Venn diagram devised by Branko Grünbaum |
Source | Own work |
Author | Cmglee |
Python script to optimise for maximum area of the smallest regions
[edit]#!/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()
# """
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following license:
![w:en:Creative Commons](https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/CC_some_rights_reserved.svg/90px-CC_some_rights_reserved.svg.png)
![attribution](https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Cc-by_new_white.svg/24px-Cc-by_new_white.svg.png)
![share alike](https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Cc-sa_white.svg/24px-Cc-sa_white.svg.png)
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 00:17, 16 April 2019 | ![]() | 512 × 512 (4 KB) | Cmglee (talk | contribs) | Improve optimisation and rendering. |
12:47, 14 October 2016 | ![]() | 512 × 512 (4 KB) | Cmglee (talk | contribs) | Optimise for maximum area of the smallest regions. | |
00:35, 11 April 2011 | ![]() | 746 × 742 (3 KB) | AnonMoos (talk | contribs) | adjusting margins | |
22:09, 11 March 2011 | ![]() | 512 × 512 (3 KB) | Cmglee (talk | contribs) | Use defs to make opaque lines. | |
21:49, 11 March 2011 | ![]() | 512 × 512 (3 KB) | Cmglee (talk | contribs) | Explicitly specify font size. | |
21:42, 11 March 2011 | ![]() | 512 × 512 (1 KB) | Cmglee (talk | contribs) | Make transparent fill attribute of ellipses. | |
21:40, 11 March 2011 | ![]() | 512 × 512 (1 KB) | Cmglee (talk | contribs) | Add opaque lines. | |
21:37, 11 March 2011 | ![]() | 512 × 512 (1,017 bytes) | Cmglee (talk | contribs) | Use fill with hex codes and opacity instead of fill with rgba codes. | |
21:34, 11 March 2011 | ![]() | 512 × 512 (1,010 bytes) | Cmglee (talk | contribs) | Temporarily remove text to check if ellipses work. | |
21:33, 11 March 2011 | ![]() | 512 × 512 (3 KB) | Cmglee (talk | contribs) | Convert CSS styles to attributes. |
You cannot overwrite this file.
File usage on Commons
The following 2 pages use this file:
File usage on other wikis
The following other wikis use this file:
- Usage on bn.wikipedia.org
- Usage on de.wikipedia.org
- Usage on en.wikipedia.org
- Usage on en.wikiversity.org
- Usage on fi.wikipedia.org
- Usage on fr.wikipedia.org
- Usage on id.wikipedia.org
- Usage on ja.wikipedia.org
- Usage on pt.wikipedia.org
- Usage on uk.wikipedia.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Short title | Symmetrical 5-set Venn diagram |
---|---|
Image title | Radially symmetrical five-set Venn diagram originally devised by Branko Gruenbaum and optimised for maximum area of the smallest regions and rendered by CMG Lee. |
Width | 100% |
Height | 100% |