Skip to content

Commit 11cf01b

Browse files
authored
Make a logo (#88)
* Add logo * flake * add logo to readme * update logo * replace random colouring * add logo to docs * update version number
1 parent adbaf93 commit 11cf01b

File tree

10 files changed

+179
-8
lines changed

10 files changed

+179
-8
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
# Symfem: a symbolic finite element definition library
1+
![Symfem](logo/logo.png)
2+
23
[![Documentation status](https://readthedocs.org/projects/symfem/badge/?version=latest)](https://symfem.readthedocs.io/en/latest/?badge=latest)
34
[![Style checks](https://github.com/mscroggs/symfem/actions/workflows/style-checks.yml/badge.svg)](https://github.com/mscroggs/symfem/actions)
45
[![Run tests](https://github.com/mscroggs/symfem/actions/workflows/run-tests.yml/badge.svg)](https://github.com/mscroggs/symfem/actions)
56
[![Coverage Status](https://coveralls.io/repos/github/mscroggs/symfem/badge.svg?branch=main)](https://coveralls.io/github/mscroggs/symfem?branch=main)
67
[![PyPI](https://img.shields.io/pypi/v/symfem?color=blue&label=PyPI&logo=pypi&logoColor=white)](https://pypi.org/project/symfem/)
78

9+
Symfem is a symbolic finite element definition library.
10+
811
## Installing Symfem
912
Symfem can be installed by downloading the [GitHub repo](https://github.com/mscroggs/symfem)
1013
and running:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2021.5.1
1+
2021.5.2

codemeta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld", "@type": "Code", "author": [{"@id": "0000-0002-4658-2443", "@type": "Person", "email": "[email protected]", "name": "Matthew Scroggs", "affiliation": "Department of Engineering, University of Cambridge"}], "identifier": "", "codeRepository": "https://github.com/mscroggs/symfem", "datePublished": "2021-01-23", "dateModified": "2021-05-08", "dateCreated": "2021-01-23", "description": "A symbolic finite element definition library", "keywords": "Python, finite element method, numerical analysis", "license": "MIT", "title": "Symfem", "version": "2021.5.1"}
1+
{"@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld", "@type": "Code", "author": [{"@id": "0000-0002-4658-2443", "@type": "Person", "email": "[email protected]", "name": "Matthew Scroggs", "affiliation": "Department of Engineering, University of Cambridge"}], "identifier": "", "codeRepository": "https://github.com/mscroggs/symfem", "datePublished": "2021-01-23", "dateModified": "2021-05-30", "dateCreated": "2021-01-23", "description": "A symbolic finite element definition library", "keywords": "Python, finite element method, numerical analysis", "license": "MIT", "title": "Symfem", "version": "2021.5.2"}

docs/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
#
8484
html_theme = "sphinxdoc"
8585

86+
html_logo = "../logo/logo.png"
87+
html_favicon = "../logo/favicon.svg"
88+
8689
# Theme options are theme-specific and customize the look and feel of a theme
8790
# further. For a list of options available for each theme, see the
8891
# documentation.

docs/index.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
####################################################
2-
Symfem: a symbolic finite element definition library
3-
####################################################
1+
.. image:: ../logo/logo.png
2+
:width: 800
3+
:alt: Symfem
44

5-
Welcome to the Symfem documention.
5+
Welcome to the documention of Symfem: a symbolic finite element definition library
66

77
*****************
88
Installing Symfem

logo/draw.py

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
from math import sqrt
2+
import svgwrite
3+
4+
letters = [
5+
# S
6+
[[(0, 0), (2, 0), (3, 1), (3, 3), (1, 3), (0, 2), (0, 0)],
7+
[(0, 1), (2, 1)],
8+
[(1, 2), (3, 2)]],
9+
# Y
10+
[[(0, 0), (2, 0), (3, 1), (3, 3), (2, 3), (2, 2), (1, 2), (1, 3), (0, 2), (0, 0)],
11+
[(0, 1), (2, 1)]],
12+
# M
13+
[[(0, 0), (1, 0), (1, 1), (2, 1), (2, 0), (3, 1), (3, 3), (1, 3), (0, 2), (0, 0)],
14+
[(1, 1), (1, 2)],
15+
[(2, 1), (2, 2)]],
16+
# F
17+
[[(0, 0), (1, 0), (1, 1), (2, 1), (2, 2), (3, 2), (3, 3), (1, 3), (0, 2), (0, 0)],
18+
[(1, 2), (2, 2)]],
19+
# E
20+
[[(0, 0), (2, 0), (3, 1), (2, 1), (2, 2), (3, 2), (3, 3), (1, 3), (0, 2), (0, 0)],
21+
[(1, 1), (2, 1)],
22+
[(1, 2), (2, 2)]],
23+
# M
24+
[[(0, 0), (1, 0), (1, 1), (2, 1), (2, 0), (3, 1), (3, 3), (1, 3), (0, 2), (0, 0)],
25+
[(1, 1), (1, 2)],
26+
[(2, 1), (2, 2)]]
27+
]
28+
29+
ups = [
30+
# S
31+
[(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1), (3, 1),
32+
(0, 2), (1, 2), (2, 2), (3, 2), (1, 3), (2, 3), (3, 3)],
33+
# Y
34+
[(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1), (3, 1),
35+
(0, 2), (1, 2), (2, 2), (3, 2), (1, 3), (2, 3), (3, 3)],
36+
# M
37+
[(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1), (3, 1),
38+
(0, 2), (1, 2), (2, 2), (3, 2), (1, 3), (2, 3), (3, 3)],
39+
# F
40+
[(0, 0), (1, 0), (0, 1), (1, 1), (2, 1),
41+
(0, 2), (1, 2), (2, 2), (3, 2), (1, 3), (2, 3), (3, 3)],
42+
# E
43+
[(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1), (3, 1),
44+
(0, 2), (1, 2), (2, 2), (3, 2), (1, 3), (2, 3), (3, 3)],
45+
# M
46+
[(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1), (3, 1),
47+
(0, 2), (1, 2), (2, 2), (3, 2), (1, 3), (2, 3), (3, 3)]
48+
]
49+
50+
for n, letter in enumerate(letters):
51+
letters[n] = [[(4 * n + j[0], j[1]) for j in i]
52+
for i in letter]
53+
all_ups = []
54+
for n, up in enumerate(ups):
55+
ups[n] = [(4 * n + j[0], j[1]) for j in up]
56+
all_ups += [(4 * n + j[0], j[1]) for j in up]
57+
58+
59+
def to_2d(x, y, z):
60+
return (90 + (x + (-z+y/2-3)/2) * 30, 68 + (3-y - z) * sqrt(3)/2 * 30)
61+
62+
63+
def zvalue(x, y, z):
64+
return z + x
65+
66+
67+
def in_letter(a, b, c):
68+
if a == (5, 2) or a == (9, 0) or a == (13, 0) or a == (14, 1) or a == (18, 1) or a == (21, 0):
69+
return False
70+
for u in ups:
71+
if a in u and b in u and c in u:
72+
return True
73+
return False
74+
75+
76+
svg = svgwrite.Drawing("logo.svg", size=(800, 200))
77+
78+
polys = []
79+
for x in range(-4, 26):
80+
for y in range(-3, 7):
81+
p1 = (x, y)
82+
p3 = (x+1, y+1)
83+
for p2 in [(x+1, y), (x, y+1)]:
84+
z1 = 1.3 if p1 in all_ups else 0
85+
z2 = 1.3 if p2 in all_ups else 0
86+
z3 = 1.3 if p3 in all_ups else 0
87+
if in_letter(p1, p2, p3):
88+
color = "#FFA366"
89+
strokecolor = "#999999"
90+
else:
91+
edge1 = (p2[0] - p1[0], p2[1] - p1[1], z2 - z1)
92+
edge2 = (p3[0] - p1[0], p3[1] - p1[1], z3 - z1)
93+
normal = (edge1[1] * edge2[2] - edge1[2] * edge2[1],
94+
edge1[2] * edge2[0] - edge1[0] * edge2[2],
95+
edge1[0] * edge2[1] - edge1[1] * edge2[0])
96+
if p2[0] == x:
97+
normal = tuple(-i for i in normal)
98+
size = sqrt(sum(i**2 for i in normal))
99+
normal = tuple(i / size for i in normal)
100+
dot = normal[0] + normal[1] / 2 - normal[2] / 5
101+
if dot < -0.5:
102+
color = "#999999"
103+
elif dot < 0:
104+
color = "#CCCCCC"
105+
elif dot < 0.5:
106+
color = "#AAAAAA"
107+
else:
108+
color = "#BBBBBB"
109+
strokecolor = "black"
110+
111+
mid = ((p1[0] + p2[0] + p3[0]) / 3,
112+
(p1[1] + p2[1] + p3[1]) / 3,
113+
(z1 + z2 + z3) / 3)
114+
polys.append((
115+
zvalue(*mid),
116+
[to_2d(*p1, z1), to_2d(*p2, z2), to_2d(*p3, z3)],
117+
color,
118+
strokecolor,
119+
in_letter(p1, p2, p3) and p1[0] < 4
120+
))
121+
122+
polys.sort(key=lambda p: p[0])
123+
124+
for p in polys:
125+
svg.add(svg.polygon(
126+
p[1],
127+
stroke=p[3], stroke_width=1, fill=p[2]))
128+
129+
for letter in letters:
130+
for line_group in letter:
131+
for i, j in zip(line_group[:-1], line_group[1:]):
132+
svg.add(svg.line(
133+
to_2d(*i, 1.3), to_2d(*j, 1.3),
134+
stroke="black", stroke_width=3, stroke_linecap="round"))
135+
136+
svg.save()
137+
138+
139+
def fav_move(p):
140+
print(p)
141+
return p[0] - 22, p[1] - 15
142+
143+
144+
svg = svgwrite.Drawing("favicon.svg", size=(120, 120))
145+
146+
for p in polys:
147+
if p[4]:
148+
svg.add(svg.polygon(
149+
[fav_move(i) for i in p[1]],
150+
stroke=p[3], stroke_width=1, fill=p[2]))
151+
152+
for line_group in letters[0]:
153+
for i, j in zip(line_group[:-1], line_group[1:]):
154+
svg.add(svg.line(
155+
fav_move(to_2d(*i, 1.3)),
156+
fav_move(to_2d(*j, 1.3)),
157+
stroke="black", stroke_width=3, stroke_linecap="round"))
158+
159+
svg.save()

logo/favicon.svg

Lines changed: 2 additions & 0 deletions
Loading

logo/logo.png

32.6 KB
Loading

logo/logo.svg

Lines changed: 2 additions & 0 deletions
Loading

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
requirements = [line.strip() for line in f if line.strip() != ""]
1616

1717
with open("README.md") as f:
18-
long_description = f.read()
18+
long_description = f.read().replace(
19+
"(logo/logo.png)",
20+
"(https://raw.githubusercontent.com/mscroggs/symfem/logo/logo/logo.png)")
1921

2022
data_files = [
2123
("symfem", ["symfem/VERSION"])]

0 commit comments

Comments
 (0)