Skip to content

Commit

Permalink
Updated Grid class documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Onur Rauf Bingol committed May 9, 2017
1 parent 2cfc756 commit 67c1a5f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nurbs/Grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(self, size_x, size_y):
self._size_y = float(size_y)
self._gridpts = []

# Returns the generated grid
def grid(self):
""" Returns the generated grid.
Expand All @@ -38,8 +39,9 @@ def grid(self):
"""
return self._gridpts

# Generates the grid using the input division parameters
def generate(self, num_u, num_v):
""" Generates the 2D grid.
""" Generates the 2D grid using the input division parameters.
:param num_u: number of divisions in x-direction
:param num_v: number of divisions in y-direction
Expand Down Expand Up @@ -83,6 +85,7 @@ def generate(self, num_u, num_v):
# Set x the value for the next column
current_x = current_x + spacing_x

# Rotates the grid about the z-axis
def rotate_z(self, angle=0):
""" Rotates the grid about the z-axis.
Expand All @@ -107,8 +110,9 @@ def rotate_z(self, angle=0):
# Finally, translate back to the starting location
self.translate(current_origin)

# Translates the grid origin to the input position
def translate(self, pt=(0.0, 0.0, 0.0)):
""" Translates the grid origin to the input point.
""" Translates the grid origin to the input position.
Grid origin is (0, 0, 0) at instantiation and always represents the bottom left corner of the 2D grid.
Expand All @@ -130,6 +134,7 @@ def translate(self, pt=(0.0, 0.0, 0.0)):
# Update the origin (bottom left corner)
self._origin = self._gridpts[0][0]

# Saves the generated grid to a text file
def save(self, file_name="grid.txt"):
""" Saves the generated grid to a text file.
Expand Down Expand Up @@ -163,6 +168,7 @@ def save(self, file_name="grid.txt"):
target.write(line)
target.write("\n")

# Generates hills (a.k.a. bumps) on the 2D grid
def bumps(self, num_bumps=0, all_positive=False, bump_height=3):
""" Generates random bumps (i.e. hills) on the 2D grid.
Expand Down

0 comments on commit 67c1a5f

Please sign in to comment.