<commit_before>## Costa's minimal surface with PovRay

[Costa's minimal surface](http://mathworld.wolfram.com/CostaMinimalSurface.html) is one of those amazing mathematical objects that look good when rendered with [PovRay](http://www.povray.org/). While it is not too hard to find trinagulations of Costa's surface suitable for the PovRay [`triangle` element](http://www.povray.org/documentation/view/3.6.1/295/), triangulations with surface normals are not that easy to come by. But these are needed for the [`smooth_triangle`](http://www.povray.org/documentation/view/3.6.1/295/) element which makes Phong shading possible.

In the service of humanity, and especially my students who wanted to render the surface, I provide here the code to triangulate and compute the normals to Costa's minimal surface. The code is written in Mathematica, which is not freely accessible. Therefore, for convenience the repository also contains certain files generated by Mathematica:

* a CSV file `costa.csv` with ready-made triangulations and surface normals,
* a PDF version of `Costa.nb`.

There is also a Python script that converts the CSV fiel to a partial PovRay [`mesh2`](http://www.povray.org/documentation/view/3.6.1/293/) element.

### How to use the files

To generate a picture using PovRay, proceed as follows:

1. Run `Costa.nb` with Mathematica and use the `CostaCSV` function to generate a CSV
   file which contains the triangulation and normals, say `costa.csv`.

2. Use `csv-to-mesh2.py` to convert the CSV file to a *partial* PovRay `mesh2` object.

3. Include the partial `mesh2` object into your PovRay file, as demostrated in `costa.pov`.

4. Generate `costa.png` with something like
<commit_msg>Still better README<commit_after>## Costa's minimal surface with PovRay

[Costa's minimal surface](http://mathworld.wolfram.com/CostaMinimalSurface.html) is one of those amazing mathematical objects that look good when rendered with [PovRay](http://www.povray.org/). While it is not too hard to find triangulations of Costa's surface suitable for the PovRay [`triangle` element](http://www.povray.org/documentation/view/3.6.1/295/), triangulations with surface normals are not that easy to come by. But these are needed for the [`smooth_triangle`](http://www.povray.org/documentation/view/3.6.1/295/) element which makes Phong shading possible.

In the service of humanity, and especially my students who wanted to render the surface, I provide here the code to triangulate and compute the normals to Costa's minimal surface. The code is written in Mathematica, which is not freely accessible. Therefore, for convenience the repository also contains certain files generated by Mathematica:

* a CSV file `costa.csv` with ready-made triangulations and surface normals, with
  a Python script `cvs-to-mesh2.py` for converting the CSV file to a partial PovRay   
  [`mesh2`](http://www.povray.org/documentation/view/3.6.1/293/) element,

* a PDF file `Costa.pdf`, the PDF export of `Costa.nb`, so you can see how I did it.

### How to use the files

To generate a picture using PovRay, proceed as follows:

1. Run `Costa.nb` with Mathematica and use the `CostaCSV` function to generate a CSV
   file which contains the triangulation and normals, say `costa.csv`.

2. Use `csv-to-mesh2.py` to convert the CSV file to a *partial* PovRay `mesh2` object.

3. Include the partial `mesh2` object into your PovRay file, as demonstrated in `costa.pov`.

4. Generate `costa.png` with something like

{'fraction_non_alphanumeric': 0.08638443935926773, 'fraction_numerical': 0.015160183066361556, 'mean_word_length': 4.5157728706624605, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1607459', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1002, 'n_words': 455}