Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/68f40a7c-717c-8000-8af6-a222789ef1d8
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Assistant: Perfect 👍 Here’s your fully ASCII-safe Windows-friendly version — no Unicode characters at all, no fancy quotes or das… === Perfect 👍 Here’s your fully ASCII-safe (Windows-friendly) version — no Unicode characters at all, no fancy quotes or dashes. You can copy–paste this directly into Notepad, save it as GoldenEllipseSpiralCubeSLIDER_SINE_CONTINUOUS_SAFE.py, and run it immediately with: <syntaxhighlight lang="bash">py GoldenEllipseSpiralCubeSLIDER_SINE_CONTINUOUS_SAFE.py </syntaxhighlight> <syntaxhighlight lang="python"># -''- coding: utf-8 -''- === GoldenEllipseSpiralCubeSLIDER_SINE_CONTINUOUS_SAFE.py === === Plain ASCII version, compatible with Windows Python === import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Button from mpl_toolkits.mplot3d.art3d import Poly3DCollection class GoldenEllipseSpiralCube: def __init__(self): self.fig = plt.figure(figsize=(12, 8)) self.ax = self.fig.add_subplot(121, projection="3d") self.ax_info = self.fig.add_subplot(122) self.ax_info.axis("off") self.phi = (1 + np.sqrt(5)) / 2 self.pyramid_angle = 51.84 self.vertices = np.array([ [-1, -1, -1], [1, -1, -1], [1, 1, -1], [-1, 1, -1], [-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1] ]) self.faces = [ [0, 1, 2, 3], [4, 5, 6, 7], [0, 1, 5, 4], [2, 3, 7, 6], [0, 3, 7, 4], [1, 2, 6, 5] ] self.face_colors = [ [1, 0, 0, 0.05], [0, 1, 0, 0.05], [0, 0, 1, 0.05], [1, 1, 0, 0.05], [1, 0, 1, 0.05], [0, 1, 1, 0.05] ] self.spiral_points = self.create_circle_projection_spiral() self.circle_projection = self.create_circle_projection() self.golden_ellipse_points = self.create_golden_ellipse_projection() self.sine_projection_points = self.create_sine_projection() self.sine_visible = False self.elev = 30 self.azim = 45 self.create_buttons() self.setup_plot() self.setup_info_panel() def create_circle_projection_spiral(self): t = np.linspace(0, 2 * np.pi, 200) spiral = [] for a in t: x = np.cos(a) y = np.sin(a) z = -1.0 + (a / (2 '' np.pi)) '' 2.0 spiral.append([x, y, z]) return np.array(spiral) def create_circle_projection(self): proj = [] for p in self.spiral_points: proj.append([p[0], p[1], 1]) return np.array(proj) def create_golden_ellipse_projection(self): t = np.linspace(0, 2 * np.pi, 200) major = 1.0 minor = major / self.phi ell = [] for a in t: x = major * np.cos(a) y = minor * np.sin(a) z = 1 ell.append([x, y, z]) return np.array(ell) def create_sine_projection(self): z = np.linspace(1, -1, 400) theta = np.linspace(2 '' np.pi, 6 '' np.pi, 400) r = 1 - 0.3 '' np.sin(4 '' np.pi * (z + 1) / 2) x = r * np.cos(theta) y = r * np.sin(theta) return np.column_stack((x, y, z)) def create_buttons(self): self.ax_reset = plt.axes([0.25, 0.02, 0.12, 0.05]) self.ax_golden = plt.axes([0.38, 0.02, 0.15, 0.05]) self.ax_pyramid = plt.axes([0.54, 0.02, 0.15, 0.05]) self.ax_sine = plt.axes([0.70, 0.02, 0.18, 0.05]) self.btn_reset = Button(self.ax_reset, "Default View") self.btn_golden = Button(self.ax_golden, "Golden Ratio View") self.btn_pyramid = Button(self.ax_pyramid, "Pyramid Angle View") self.btn_sine = Button(self.ax_sine, "Toggle Sine Projection") self.btn_reset.on_clicked(self.reset_view) self.btn_golden.on_clicked(self.reset_golden_view) self.btn_pyramid.on_clicked(self.reset_pyramid_view) self.btn_sine.on_clicked(self.toggle_sine_projection) def setup_plot(self): self.ax.clear() for i, face in enumerate(self.faces): verts = self.vertices[face] poly = Poly3DCollection([verts], alpha=0.03) poly.set_facecolor(self.face_colors[i]) poly.set_edgecolor("gray") self.ax.add_collection3d(poly) s = self.spiral_points self.ax.plot3D(s[:,0], s[:,1], s[:,2], color="black", linewidth=3) c = self.circle_projection self.ax.plot3D(c[:,0], c[:,1], c[:,2], color="blue", linewidth=2) g = self.golden_ellipse_points self.ax.plot3D(g[:,0], g[:,1], g[:,2], color="gold", linewidth=3) if self.sine_visible: si = self.sine_projection_points self.ax.plot3D(si[:,0], si[:,1], si[:,2], color="orange", linewidth=3) self.ax.set_xlim([-1.5, 1.5]) self.ax.set_ylim([-1.5, 1.5]) self.ax.set_zlim([-1.5, 1.5]) self.ax.set_xlabel("X Axis", fontweight="bold") self.ax.set_ylabel("Y Axis", fontweight="bold") self.ax.set_zlabel("Z Axis", fontweight="bold") self.ax.set_title("Golden Ellipse Phenomenon", fontweight="bold") self.ax.view_init(elev=self.elev, azim=self.azim) self.fig.canvas.draw_idle() def setup_info_panel(self): self.ax_info.clear() self.ax_info.axis("off") text = ( "Golden Ellipse and Spiral Cube\n\n" "Controls:\n" "- Default View\n" "- Golden Ratio View\n" "- Pyramid Angle View\n" "- Toggle Sine Projection\n\n" "Sine Projection:\n" "Smooth continuation of the spiral into a vertical sine-like curve\n" "inside the cube volume." ) self.ax_info.text(0.05, 0.95, text, transform=self.ax_info.transAxes, va="top", ha="left", fontsize=9, family="monospace", bbox=dict(boxstyle="round,pad=1", facecolor="lightblue", alpha=0.7)) self.fig.canvas.draw_idle() def reset_view(self, event=None): self.elev = 30 self.azim = 45 self.setup_plot() def reset_golden_view(self, event=None): self.elev = 52 self.azim = 45 self.setup_plot() def reset_pyramid_view(self, event=None): self.elev = self.pyramid_angle self.azim = 45 self.setup_plot() def toggle_sine_projection(self, event=None): self.sine_visible = not self.sine_visible self.setup_plot() def show(self): print("GOLDEN ELLIPSE & CONTINUOUS SINE PROJECTION") print("====================================================") print("Left panel: 3D interactive visualization") print("Right panel: Info and controls") print("Use mouse drag to rotate, wheel to zoom.") plt.show() if __name__ == "__main__": cube = GoldenEllipseSpiralCube() cube.show() </syntaxhighlight> ✅ Safe for all Windows editors * Only ASCII characters. '' Includes # -''- coding: utf-8 -*-. * No degree (°) or en dash (–) symbols. * Runs directly with py or python. Would you like me to extend it later so that the sine curve gradually animates from the spiral (a morph effect)? It’s very doable with matplotlib.animation.FuncAnimation.
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)