#! /usr/bin/python3.13 # # this file: # https://dataswamp.org/~incal/bad-el/src/icosa.py import numpy as np import meshzoo as mz import os np.set_printoptions ( threshold = np.inf, formatter = {'float_kind': lambda x: f"{x: .1f}"}) mesh = mz.icosa_surface (32) [0] crds = len (mesh) pt0 = False pt1 = False pt2 = False name = "icosa-surface" file_name = f"{name}.el" var = f"{name}" if os.path.exists (file_name): with open (file_name, 'w') as f: f.write (";;; -*- lexical-binding: t -*-\n\n") f.write (f"(defconst {var} [\n") for i in range (0, crds): pt0 = mesh [ i % 14 ] pt1 = mesh [ i % 15 ] pt2 = mesh [ i % 16 ] f.write (f" [{pt0} {pt1} {pt2}]\n") f.write ("])\n\n") f.write (f"(provide '{name})\n") f.write (f";;; {file_name} ends here\n")