Skip to content

Commit

Permalink
Fixed dimension of CylinderStructured (pyvista#577)
Browse files Browse the repository at this point in the history
* CylinderStructured length fix

The structured grid generated was shorter than the length argument.

* Removed a layer of repeating points at the end of the circumference.
The dimension now provides the right number of points specified.
  • Loading branch information
math-artist authored Feb 3, 2020
1 parent 6082e8e commit 60dcaff
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions pyvista/utilities/geometric_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ def CylinderStructured(radius=0.5, height=1.0,
X = radius_matrix * np.cos(theta_matrix)
Y = radius_matrix * np.sin(theta_matrix)

# Duplicate the first point to close loop
X = np.append(X, X[0])
Y = np.append(Y, Y[0])

# Make all the nodes in the grid
xx = np.array([X] * z_resolution).ravel()
yy = np.array([Y] * z_resolution).ravel()
Expand All @@ -162,7 +158,7 @@ def CylinderStructured(radius=0.5, height=1.0,
# Create the grid
grid = pyvista.StructuredGrid()
grid.points = np.c_[xx, yy, zz]
grid.dimensions = [nr, theta_resolution+1, z_resolution]
grid.dimensions = [nr, theta_resolution, z_resolution]

# Orient properly in user direction
vx = np.array([0., 0., 1.])
Expand Down

0 comments on commit 60dcaff

Please sign in to comment.