Skip to content

Commit

Permalink
Added spaces so parameters look better.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Serrano committed Sep 28, 2017
1 parent 199b13d commit 5847254
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 62 deletions.
174 changes: 115 additions & 59 deletions docs/source/geomodelr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,14 @@ max_refinements)**

Args:
(function) query_func: a function of the geological model that
returns a unit. (list) bbox: the bounding box to search in.
(int) grid_divisions: the number of points for the grid. (int)
max_refinements: the number of refinements for this FDM scheme.
returns a unit.

(list) bbox: the bounding box to search in.

(int) grid_divisions: the number of points for the grid.

(int) max_refinements: the number of refinements for this FDM
scheme.

**geomodelr.utils.generate_octtree_grid(query_func, bbox,
grid_divisions, fdm_refine, oct_refine)**
Expand All @@ -346,10 +351,16 @@ grid_divisions, fdm_refine, oct_refine)**

Args:
(function) query_func: a function of the geological model that
returns a unit. (list) bbox: the bounding box to search in.
(int) grid_divisions: the number of points for the grid. (int)
fdm_refine: the number of refinements for the fdm scheme. (int)
oct_refine: the number of refinements for the octree scheme
returns a unit.

(list) bbox: the bounding box to search in.

(int) grid_divisions: the number of points for the grid.

(int) fdm_refine: the number of refinements for the fdm scheme.

(int) oct_refine: the number of refinements for the octree
scheme

**geomodelr.utils.generate_simple_grid(query_func, bbox,
grid_divisions)**
Expand All @@ -360,7 +371,10 @@ grid_divisions)**

Args:
(function) query_func: a function of the geological model that
returns a unit. (list) bbox: the bounding box to search in.
returns a unit.

(list) bbox: the bounding box to search in.

(int) grid_divisions: the number of points for the grid.

**geomodelr.utils.octtree_volume_calculation(query_func, bbox,
Expand All @@ -370,9 +384,14 @@ grid_divisions, oct_refine)**

Args:
(function) query_func: a function of the geological model that
returns a unit. (list) bbox: the bounding box to search in.
(int) grid_divisions: the number of points for the grid. (int)
oct_refine: the number of refinements for the octree scheme
returns a unit.

(list) bbox: the bounding box to search in.

(int) grid_divisions: the number of points for the grid.

(int) oct_refine: the number of refinements for the octree
scheme


geomodelr.isosurfaces module
Expand All @@ -387,20 +406,27 @@ normal_upwards=True)**

Args:
(geomodelr.model.GeologicalModel) model: The geomodelr
geological model. (unicode) unit: The unit to calculate the
isosurface for. (int) grid_divisions: The number of divisions
for all the axes. (bool) bounded: calculates the surface using
the bounding box. This will result in a solid. (bool)
filter_by_normal: filters by the normal of each triangle,
depending on the normal_upwards argument. (bool) normal_upwards:
if filter_by_normal is True, filters the triangles depending on
its normal. It returns only the triangles pointing upwards if
it’s True, otherwise it returns the triangles pointing
downwards.
geological model.

(unicode) unit: The unit to calculate the isosurface for.

(int) grid_divisions: The number of divisions for all the axes.

(bool) bounded: calculates the surface using the bounding box.
This will result in a solid.

(bool) filter_by_normal: filters by the normal of each triangle,
depending on the normal_upwards argument.

(bool) normal_upwards: if filter_by_normal is True, filters the
triangles depending on its normal. It returns only the triangles
pointing upwards if it’s True, otherwise it returns the
triangles pointing downwards.

Returns:
(list) vertices: The list of vertices. (list) triangles: The
list of triangles indexes to vertexes.
(list) vertices: The list of vertices.

(list) triangles: The list of triangles indexes to vertexes.

**geomodelr.isosurfaces.calculate_isovalues(model, unit,
grid_divisions, bbox, bounded=True)**
Expand All @@ -410,12 +436,15 @@ grid_divisions, bbox, bounded=True)**

Args:
(geomodelr.model.GeologicalModel) geolojson: The Geological
model created form a Geological JSON object. (int)
grid_divisions: The divisions of the grid in the X, Y and Z
directions. (list) bbox: the values of [minx, miny, minz, maxx,
maxy, maxz]. (bool) bounded: whether the object will be a solid,
(the bounded signed distance will be used), or it will be an
open surface.
model created form a Geological JSON object.

(int) grid_divisions: The divisions of the grid in the X, Y and
Z directions.

(list) bbox: the values of [minx, miny, minz, maxx, maxy, maxz].

(bool) bounded: whether the object will be a solid, (the bounded
signed distance will be used), or it will be an open surface.

**geomodelr.isosurfaces.calculate_normals(vertices, simplices)**

Expand All @@ -424,8 +453,10 @@ grid_divisions, bbox, bounded=True)**

Args:
(numpy.array) vertices: The vertices returned by the marching
cubes algorithm. (numpy.array) simplices: The simplices
(triangles) returned by the marching cubes algorithm.
cubes algorithm.

(numpy.array) simplices: The simplices (triangles) returned by
the marching cubes algorithm.

**geomodelr.isosurfaces.check_bbox_surface(sd)**

Expand All @@ -444,16 +475,23 @@ bounded=True, filter_by_normal=False, normal_upwards=False)**

Args:
(geomodelr.model.GeologicalModel) model: The geomodelr
geological model. (unicode) unit: The unit to calculate the
isosurface for. (int) grid_divisions: The number of divisions
for all the axes. (bool) bounded: calculates the surface using
the bounding box. This will result in a solid. (bool)
filter_by_normal: filters by the normal of each triangle,
depending on the normal_upwards argument. (bool) normal_upwards:
if filter_by_normal is True, filters the triangles depending on
its normal. It returns only the triangles pointing upwards if
it’s True, otherwise it returns the triangles pointing
downwards.
geological model.

(unicode) unit: The unit to calculate the isosurface for.

(int) grid_divisions: The number of divisions for all the axes.

(bool) bounded: calculates the surface using the bounding box.
This will result in a solid.

(bool) filter_by_normal: filters by the normal of each triangle,
depending on the normal_upwards argument.

(bool) normal_upwards: if filter_by_normal is True, filters the
triangles depending on its normal. It returns only

the triangles pointing upwards if it’s True, otherwise it
returns the triangles pointing downwards.

**geomodelr.isosurfaces.save_unit(name, model, unit, grid_divisions,
bounded=True, filter_by_normal=False, normal_upwards=False)**
Expand All @@ -463,23 +501,33 @@ bounded=True, filter_by_normal=False, normal_upwards=False)**

Args:
(str) name: the name to save the STL file.

(geomodelr.model.GeologicalModel) model: the model to be
queried. (unicode) unit: the unit to be meshed. (int)
grid_divisions: the number of divisions of the grid to mesh the
object. (bool) bounded: whether this surface is bounded by the
bbox or only by the topography. (bool) filter_by_normal: whether
to filter this mesh by normal to the surface. Useful if you
want to see the top or bottom of your formation. (bool)
normal_upwards: if filter_by_normal is True, whether you want
the triangles that look up or the triangles that look down.
queried.

(unicode) unit: the unit to be meshed.

(int) grid_divisions: the number of divisions of the grid to
mesh the object.

(bool) bounded: whether this surface is bounded by the bbox or
only by the topography.

(bool) filter_by_normal: whether to filter this mesh by normal
to the surface. Useful if you want to see the top or bottom of
your formation.

(bool) normal_upwards: if filter_by_normal is True, whether you
want the triangles that look up or the triangles that look down.

**geomodelr.isosurfaces.stl_mesh(vertices, simplices)**

Creates a numpy-stl mesh from a sets of vertices and triangles.

Args:
(list) vertices: vertices of the mesh. (list) simplices:
triangles of the mesh.
(list) vertices: vertices of the mesh.

(list) simplices: triangles of the mesh.

Returns:
(stl.mesh.Mesh): a numpy-stl mesh.
Expand All @@ -493,14 +541,22 @@ bounded=True, filter_by_normal=False, normal_upwards=False)**

Args:
(geomodelr.model.GeologicalModel) model: the model to be
queried. (unicode) unit: the unit to be meshed. (int)
grid_divisions: the number of divisions of the grid to mesh the
object. (bool) bounded: whether this surface is bounded by the
bbox or only by the topography. (bool) filter_by_normal: whether
to filter this mesh by normal to the surface. Useful if you
want to see the top or bottom of your formation. (bool)
normal_upwards: if filter_by_normal is True, whether you want
the triangles that look up or the triangles that look down.
queried.

(unicode) unit: the unit to be meshed.

(int) grid_divisions: the number of divisions of the grid to
mesh the object.

(bool) bounded: whether this surface is bounded by the bbox or
only by the topography.

(bool) filter_by_normal: whether to filter this mesh by normal
to the surface. Useful if you want to see the top or bottom of
your formation.

(bool) normal_upwards: if filter_by_normal is True, whether you
want the triangles that look up or the triangles that look down.

Returns:
(dict): the triangulated unit with a few useful properties.
Expand Down
6 changes: 3 additions & 3 deletions geomodelr/cpp/geomodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ BOOST_PYTHON_MODULE(cpp)
"negative inside the unit and possitive outside the unit\n\n"
"Args:\n"
" (string) unit:\n"
" The unit to measure the signed distance to\n"
" The unit to measure the signed distance to\n\n"
" (tuple) point:\n"
" The three coordinates (esting, norting, altitute a.s.l) of the point in the given coordinate system.\n"
"Returns:\n"
Expand All @@ -146,7 +146,7 @@ BOOST_PYTHON_MODULE(cpp)
"or above the topography, it returns a positive number (outside)\n\n"
"Args:\n"
" (string) unit:\n"
" The unit to measure the signed distance to\n"
" The unit to measure the signed distance to\n\n"
" (tuple) point:\n"
" The three coordinates (esting, norting, altitute a.s.l) of the point in the given coordinate system.\n"
"Returns:\n"
Expand All @@ -161,7 +161,7 @@ BOOST_PYTHON_MODULE(cpp)
"when the point is above the topography. It does not always produce solids\n\n"
"Args:\n"
" (string) unit:\n"
" The unit to measure the signed distance to\n"
" The unit to measure the signed distance to\n\n"
" (tuple) point:\n"
" The three coordinates (esting, norting, altitute a.s.l) of the point in the given coordinate system.\n"
"Returns:\n"
Expand Down
29 changes: 29 additions & 0 deletions geomodelr/isosurfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ def calculate_isovalues(model, unit, grid_divisions, bbox, bounded=True):
Args:
(geomodelr.model.GeologicalModel) geolojson: The Geological model created form a Geological JSON object.
(int) grid_divisions: The divisions of the grid in the X, Y and Z directions.
(list) bbox: the values of [minx, miny, minz, maxx, maxy, maxz].
(bool) bounded: whether the object will be a solid, (the bounded signed distance will be used), or it will be an open surface.
"""

Expand Down Expand Up @@ -98,7 +101,9 @@ def calculate_normals(vertices, simplices):
Args:
(numpy.array) vertices: The vertices returned by the marching cubes algorithm.
(numpy.array) simplices: The simplices (triangles) returned by the marching cubes algorithm.
"""
normals = np.zeros(simplices.shape, dtype=float)
v1 = vertices[simplices[:,1]] - vertices[simplices[:,0]]
Expand All @@ -111,15 +116,21 @@ def calculate_isosurface(model, unit, grid_divisions, bounded=True, filter_by_no
Args:
(geomodelr.model.GeologicalModel) model: The geomodelr geological model.
(unicode) unit: The unit to calculate the isosurface for.
(int) grid_divisions: The number of divisions for all the axes.
(bool) bounded: calculates the surface using the bounding box. This will result in a solid.
(bool) filter_by_normal: filters by the normal of each triangle, depending on the normal_upwards argument.
(bool) normal_upwards: if filter_by_normal is True, filters the triangles depending on its normal. It returns only
the triangles pointing upwards if it's True, otherwise it returns the triangles pointing downwards.
Returns:
(list) vertices: The list of vertices.
(list) triangles: The list of triangles indexes to vertexes.
"""

Expand Down Expand Up @@ -193,11 +204,17 @@ def plot_unit( model, unit, grid_divisions, bounded=True, filter_by_normal=False
Args:
(geomodelr.model.GeologicalModel) model: The geomodelr geological model.
(unicode) unit: The unit to calculate the isosurface for.
(int) grid_divisions: The number of divisions for all the axes.
(bool) bounded: calculates the surface using the bounding box. This will result in a solid.
(bool) filter_by_normal: filters by the normal of each triangle, depending on the normal_upwards argument.
(bool) normal_upwards: if filter_by_normal is True, filters the triangles depending on its normal. It returns only
the triangles pointing upwards if it's True, otherwise it returns the triangles pointing downwards.
"""
Expand All @@ -219,6 +236,7 @@ def stl_mesh( vertices, simplices ):
Args:
(list) vertices: vertices of the mesh.
(list) simplices: triangles of the mesh.
Returns:
(stl.mesh.Mesh): a numpy-stl mesh.
Expand All @@ -237,12 +255,18 @@ def save_unit( name, model, unit, grid_divisions, bounded=True, filter_by_normal
Args:
(str) name: the name to save the STL file.
(geomodelr.model.GeologicalModel) model: the model to be queried.
(unicode) unit: the unit to be meshed.
(int) grid_divisions: the number of divisions of the grid to mesh the object.
(bool) bounded: whether this surface is bounded by the bbox or only by the topography.
(bool) filter_by_normal: whether to filter this mesh by normal to the surface. Useful
if you want to see the top or bottom of your formation.
(bool) normal_upwards: if filter_by_normal is True, whether you want the triangles that look up or
the triangles that look down.
"""
Expand All @@ -260,11 +284,16 @@ def triangulate_unit( model, unit, grid_divisions, bounded=True, filter_by_norma
Args:
(geomodelr.model.GeologicalModel) model: the model to be queried.
(unicode) unit: the unit to be meshed.
(int) grid_divisions: the number of divisions of the grid to mesh the object.
(bool) bounded: whether this surface is bounded by the bbox or only by the topography.
(bool) filter_by_normal: whether to filter this mesh by normal to the surface. Useful
if you want to see the top or bottom of your formation.
(bool) normal_upwards: if filter_by_normal is True, whether you want the triangles that look up or
the triangles that look down.
Returns:
Expand Down
1 change: 1 addition & 0 deletions geomodelr/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ def model_from_file(filename):
Args:
(str) filename: The path to the Geological JSON file downloaded from
Geomodelr.com.
Returns:
(GeologicalModel): The output Geological model to query the geological
units freely.
Expand Down

0 comments on commit 5847254

Please sign in to comment.