surf3d.py

Created by vnap0v

Created on April 30, 2026

1.93 KB

This script draws a 3D surface plot with hidden-line removal.

The expression to plot is defined in a python function which takes 2 arguments (x,y) and returns z.

Plotting is performed by python function surf() which takes arguments telling it which function to plot and the ranges on x,y and z axis. An optional text string can be added to the plot.

The script uses a function which extends the functionality of the kandinsky module:

connect draws a line between two arbitrary points

connect(x1,y1,x2,y2,co="black")

The script uses only the math and kandinsky libraries.


During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.