K3DSurf – Implicit 3D Surfaces

I just discovered an open project which aims to make 3D drawings of mathematical objects easy. Here is an example of a surface defined by the equation

\(\cos x + \cos y + \cos z = 0\)


This is based on a PNG export of the program, reduced from over 1MB to 100KB by Photoshop. The program does not save compressed PNG. So be careful.

K3DSurf can do more than implicit surfaces, and there is a lot to configure and change in the way the graphics look. The program runs under the portable library Qt and is available for Macs and Linux too. It is a very nice project.

The display is based on OpenGL and can be turned and zoomed in real time. OpenGL is something I never did in Euler math Toolbox (EMT). It is possible to turn 3D plots, even shaded ones. But OpenGL does this job much faster. Implicit surfaces are not implemented at this time anyway, besides as grid objects. To compensate for this, here is an anaglyph view of this surface in EMT. You need red/cyan glasses to see this properly.


Without the 3D view of red/cyan glasses the image is hard to grasp.

But EMT can call Povray. K3DSurf can do that too, but I cold not find out how it configures with my version of Povray. Here is the code for EMT.

>povstart(zoom=2,distance=10,angle=40°,height=40°); ...
>writeln(povsurface("cos(x)+cos(y)+cos(z)", ...
>           povlook(green),povbox(-4,4,look=""))); ...
>r=4.5; writeAxes(xmin=-r,xmax=r,ymin=-r,ymax=r,zmin=-r,zmax=r,d=0.05); ...


Admittedly, to produce a nice output for EMT, you need trial and error, while you can interactively set a nice viewing angle and zoom in K3DSurf. By the way, you find the output of Povray in the sub-directory Euler of the user home directory.

In Sage, the same is possible too.


There is a lot more to say about the Sage project. Maybe that is a topic for another blog.

Finally, let me say that I could not find a library or tool in Python for implicit 3D plots. The only function I could find uses the same approach as EMT.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.