Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
137 lines (120 loc) · 5.34 KB
/
Copy pathmain.py
File metadata and controls
137 lines (120 loc) · 5.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import math
class PrismLogoGenerator:
"""
Generates a meaningful SVG logo for the PRISM project.
The logo symbolizes the fusion of Metamaterial EM Engineering and
State-Dependent Geometric Algebra to create "Sculpted Matter."
"""
def __init__(self, width=600, height=300):
self.width = width
self.height = height
self.center_y = height / 2
# --- Color Palette ---
self.colors = {
"background": "#1A1A1A",
"metagrid": "#444444",
"prism_fill": "#2D3748", # A dark, slate blue
"prism_stroke": "#A0AEC0",
"wave_input": "#718096",
"beam_glow": "#00BFFF", # DeepSkyBlue
"beam_core": "#E0FFFF", # LightCyan
"text": "#E2E8F0"
}
def _generate_metamaterial_grid(self) -> str:
"""
Creates a grid of dots representing the programmable metamaterial surface.
The opacity fades, suggesting a field of influence.
"""
grid_elements = []
num_dots_x, num_dots_y = 10, 15
spacing = 12
start_x, start_y = 60, self.center_y - ((num_dots_y - 1) * spacing / 2)
for i in range(num_dots_x):
for j in range(num_dots_y):
cx = start_x + i * spacing
cy = start_y + j * spacing
# Opacity decreases as we move away from the prism
opacity = max(0.1, 1.0 - (i / num_dots_x) * 0.8)
grid_elements.append(
f'<circle cx="{cx}" cy="{cy}" r="1.5" fill="{self.colors["metagrid"]}" opacity="{opacity}" />'
)
return "\n".join(grid_elements)
def _generate_prism_body(self) -> str:
"""
Creates the central prism, representing the Geometric Algebra framework.
"""
p_height = 160
p_width = 80
p1 = f"{self.width/2 - p_width/2},{self.center_y - p_height/2}"
p2 = f"{self.width/2 - p_width/2},{self.center_y + p_height/2}"
p3 = f"{self.width/2 + p_width/2},{self.center_y}"
return (
f'<polygon points="{p1} {p2} {p3}" '
f'fill="{self.colors["prism_fill"]}" '
f'stroke="{self.colors["prism_stroke"]}" stroke-width="2" />'
)
def _generate_input_waves(self) -> str:
"""
Generates wave-like paths entering the prism, representing unfocused fields.
"""
start_x = 180
end_x = self.width/2 - 45
wave1_y = self.center_y - 30
wave2_y = self.center_y
wave3_y = self.center_y + 30
# Using SVG path quadratic Bezier curves (Q) for simple waves
return (
f'<path d="M {start_x} {wave1_y} Q {start_x + 20} {wave1_y-10}, {end_x} {self.center_y-10}" '
f'stroke="{self.colors["wave_input"]}" stroke-width="1.5" fill="none" />'
f'<path d="M {start_x} {wave2_y} Q {start_x + 20} {wave2_y+5}, {end_x} {self.center_y}" '
f'stroke="{self.colors["wave_input"]}" stroke-width="1.5" fill="none" />'
f'<path d="M {start_x} {wave3_y} Q {start_x + 20} {wave3_y+10}, {end_x} {self.center_y+10}" '
f'stroke="{self.colors["wave_input"]}" stroke-width="1.5" fill="none" />'
)
def _generate_plasma_beam(self) -> str:
"""
Generates the coherent output beam of "Sculpted Matter."
A glow effect is created with two overlapping lines.
"""
start_x = self.width/2 + 40
end_x = self.width - 50
# A wider, semi-transparent line for the glow
glow = (
f'<line x1="{start_x}" y1="{self.center_y}" x2="{end_x}" y2="{self.center_y}" '
f'stroke="{self.colors["beam_glow"]}" stroke-width="8" stroke-linecap="round" opacity="0.7" />'
)
# A thin, bright line for the core beam
core = (
f'<line x1="{start_x}" y1="{self.center_y}" x2="{end_x}" y2="{self.center_y}" '
f'stroke="{self.colors["beam_core"]}" stroke-width="3" stroke-linecap="round" />'
)
return glow + "\n" + core
def _generate_text(self) -> str:
"""Adds the project title below the logo."""
return (
f'<text x="{self.width/2}" y="{self.height - 40}" '
f'font-family="\'Segoe UI\', \'Helvetica Neue\', sans-serif" font-size="36" font-weight="300" '
f'fill="{self.colors["text"]}" text-anchor="middle" letter-spacing="2">PRISM</text>'
)
def generate_svg(self) -> str:
"""
Assembles all components into a final SVG string.
"""
svg_content = [
f'<svg width="{self.width}" height="{self.height}" viewBox="0 0 {self.width} {self.height}" '
f'xmlns="http://www.w3.org/2000/svg" style="background-color:{self.colors["background"]};">',
self._generate_metamaterial_grid(),
self._generate_input_waves(),
self._generate_prism_body(),
self._generate_plasma_beam(),
self._generate_text(),
'</svg>'
]
return "\n".join(svg_content)
if __name__ == '__main__':
logo_generator = PrismLogoGenerator()
svg_data = logo_generator.generate_svg()
file_name = "prism_logo.svg"
with open(file_name, "w") as f:
f.write(svg_data)
print(f"✅ PRISM logo successfully generated and saved to '{file_name}'")