Package meshpy :: Module geometry
[hide private]
[frames] | no frames]

Module geometry

source code



Geometry builder
----------------

.. autoclass:: GeometryBuilder

Geometries
----------

These functions are designed so that their output can be splat-passed to
:meth:`GeometryBuilder.add_geometry`::

    builder = GeometryBuilder()
    builder.add_geometry(*make_ball(10))

.. autoclass:: Marker
    :members:
    :undoc-members:

.. autofunction:: make_box
.. autofunction:: make_circle
.. autofunction:: make_ball
.. autofunction:: make_cylinder

Extrusions and surfaces of revolution
-------------------------------------

.. data:: EXT_OPEN
.. data:: EXT_CLOSED_IN_RZ

.. autofunction:: generate_extrusion
.. autofunction:: generate_surface_of_revolution

Classes [hide private]
  GeometryBuilder
..
  Marker
Functions [hide private]
 
bounding_box(points) source code
 
is_multi_polygon(facets) source code
 
offset_point_indices(facets, offset) source code
 
make_box(a, b, subdivisions=None)
:param subdivisions: is a tuple of integers specifying the number of subdivisions along each axis.
source code
 
make_circle(r, center=(0, 0), subdivisions=40, marker=100) source code
 
make_ball(r, subdivisions=10) source code
 
make_cylinder(radius, height, radial_subdivisions=10, height_subdivisions=1) source code
 
_is_same_float(a, b, threshold=1e-10) source code
 
generate_extrusion(rz_points, base_shape, closure=0, point_idx_offset=0, ring_point_indices=None, ring_markers=None, rz_closure_marker=0)
Extrude a given connected *base_shape* (a list of (x,y) points) along the z axis.
source code
 
generate_surface_of_revolution(rz_points, closure=0, radial_subdiv=16, point_idx_offset=0, ring_point_indices=None, ring_markers=None, rz_closure_marker=0) source code
Variables [hide private]
  __doc__ = ...
  EXT_OPEN = 0
  EXT_CLOSED_IN_RZ = 1
  __package__ = 'meshpy'
Function Details [hide private]

generate_extrusion(rz_points, base_shape, closure=0, point_idx_offset=0, ring_point_indices=None, ring_markers=None, rz_closure_marker=0)

source code 

Extrude a given connected *base_shape* (a list of (x,y) points) along the z axis. For each step in the extrusion, the base shape is multiplied by a radius and shifted in the z direction. Radius and z offset are given by *rz_points*, which is a list of (r, z) tuples.

Returns ``(points, facets, facet_holestarts, markers)``, where *points* is a list of (3D) points and facets is a list of polygons. Each polygon is, in turn, represented by a tuple of indices into *points*. If *point_idx_offset* is not zero, these indices start at that number. *markers* is a list equal in length to *facets*, each specifying the facet marker of that facet. *facet_holestarts* is also equal in length to *facets*, each element is a list of hole starting points for the corresponding facet.

Use MeshInfo.set_facets_ex to add the extrusion to a MeshInfo structure.

The extrusion proceeds by generating quadrilaterals connecting each ring. If any given radius in *rz_points* is 0, triangle fans are produced instead of quads to provide non-degenerate closure.

If *closure* is :data:`EXT_OPEN`, no efforts are made to put end caps on the extrusion.

If *closure* is :data:`EXT_CLOSED_IN_RZ`, then a torus-like structure is assumed and the last ring is just connected to the first.

If *ring_markers* is not None, it is an list of markers added to each ring. There should be len(rz_points)-1 entries in this list. If rings are added because of closure options, they receive the corresponding *XXX_closure_marker*. If *facet_markers* is given, this function returns (points, facets, markers), where markers is is a list containing a marker for each generated facet. Unspecified markers generally default to 0.

If *ring_point_indices* is given, it must be a list of the same length as *rz_points*. Each entry in the list may either be None, or a list of point indices. This list must contain the same number of points as the *base_shape*; it is taken as the indices of pre-existing points that are to be used for the given ring, instead of generating new points.


Variables Details [hide private]

__doc__

Value:
"""

Geometry builder
----------------

.. autoclass:: GeometryBuilder

Geometries
...