Costa's minimal surface

 From:  bemfarmer
7673.1 
Not having javascript code for a Weierstrass function: :-)

Data for a Costa minimal surface for PovRay were downloaded from here:
https://github.com/andrejbauer/costa-surface
After much effort and learning, the .csv file was converted to an .obj file.
The file costa-object.inc, a simple PovRay include file with vertices and triangle corner indices,
proved to be convenient to use with Excel and Notepad++,
to convert it first to a comma delimited .csv file, and then to a simple .obj file.

Using Notepad++, the ">," were Replaced with "blank".
Also, the "blank <" were converted first to "<," for use in Excel as a .csv,
Excel was then used to remove some decimals,(unnecessary?), and more importantly, increment
the face indices numbers by 1, as PovRay uses zero indexing face numbers,
whereas .obj apparently uses indexing starting at "1".
In the excel Developer tab, an excel macro was used to do the +1 to all of the face indices..
The Excel command button code, using cells G1:G10 for testing is:

Private Sub CommandButton1_Click()
On Error Resume Next
Set C = Range("G1:G10").Cells.SpecialCells(xlCellTypeConstants)
For Each cc In C
cc.Value = cc.Value + 1
Next
End Sub

The macro command button was explained here:
http://www.excel-easy.com/vba/create-a-macro.html
The increment macro was a variation with (face indices) cells B1:B3408, C1:C3408, and D1:C3408, from here:
http://www.mrexcel.com/forum/excel-questions/468109-macro-increment-cell-value-one.html

(To save the working file, the Excel macro command button file has to be saved in macro enabled xlsm file.)
(Very puzzling at the time, note that when ImportObj script encountered a 0 face index, it quit at 6 faces, also, Obj23dm.exe did better, but produced ~30% incorrect triangles with the 0 indexing.)
This strange behavior was corrected by adding +1 to the indices.
The vertex normals were discarded, but could have been converted also. Later Moi can export an .obj with vertex normals.

After deleting the command button, and saving file as .csv, Notepad++ was then used again.
The exponential notations such as 3.12E-14 were replaced by 0 (probably unneccesary?),
using Replace with Checkbox Regular Expressions selected, with the search
(\d\.\d\d)E-14 replaced with "0" (Similarly for E-15, E-16, and E-17.)
The "<," were replaced by either "v " for the vertices, or "f " for the faces.
(vertex normals would have been "vn " if they had been included.) (note space(s))
The csv delimiter "," were replaced by " ". (note space)
The .csv file is now renamed to .obj. It is a barebones .obj, with vertex x,y,z list,
and also face indice triplets, indicating the vertex of each triangle.
Michaels obj23dm.exe can be used on th .obj now, or the new script of Max Smirnov,

ImportObj can be used to get the .obj into Moi as a .3dm. This file is ~10mb.
SubdivBeta9 can be run on the .3dm, for a file of ~14mb. There is still some "creasing."
Rendering was done on both the re-exported Moi .3dm, and the subdivBeta9 .3dm, in KeyShot5.

- Brian


EDITED: 25 Nov 2018 by BEMFARMER

Attachments:

Image Attachments:
Size: 104.3 KB, Downloaded: 17 times, Dimensions: 235x235px