Skip to content

Commit c34e2de

Browse files
committed
Added comments to trisurf example.
This mesh was taken from the triplot demo. I have taken out an input point rotation, this is in the interest of keeping the example code to a minimum.
1 parent cc1d9eb commit c34e2de

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

examples/mplot3d/trisurf3d_demo.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,23 @@
55

66
n_angles = 36
77
n_radii = 8
8-
min_radius = 0.25
9-
radii = np.linspace(min_radius, 0.95, n_radii)
108

9+
# An array of radii
10+
# Does not include radius r=0, this is to eliminate duplicate points
11+
radii = np.linspace(0.125, 1.0, n_radii)
12+
13+
# An array of angles
1114
angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)
15+
16+
# Repeat all angles for each radius
1217
angles = np.repeat(angles[...,np.newaxis], n_radii, axis=1)
13-
angles[:,1::2] += np.pi/n_angles
1418

19+
# Convert polar (radii, angles) coords to cartesian (x, y) coords
20+
# (0, 0) is added here. There are no duplicate points in the (x, y) plane
1521
x = np.append(0, (radii*np.cos(angles)).flatten())
1622
y = np.append(0, (radii*np.sin(angles)).flatten())
23+
24+
# Pringle surface
1725
z = np.sin(-x*y)
1826

1927
fig = plt.figure()

0 commit comments

Comments
 (0)