Mesh generation

medianshape.simplicial.meshgen.get_mesh_surface(mesh)[source]

Gets a surface mesh out of a tetrahedralized simplicial complex K.

medianshape.simplicial.meshgen.meshgen2d(bbox, l, fixed_points=None, include_corners=True)[source]

Generates a simplical complex K of dimension 2, a triangulated mesh.

Parameters:
  • bbox (float) – a bounding box, [\(x_{min}, y_{min}, x_{max}, y_{max}\)].
  • l (float) – initial edge length.
  • fixed_points (float) – fixed points that should be in K.
  • include_corners (bool) – If True, the corner points of the given boundary box must be in K.
Returns:

mesh – an object of Mesh2D class.

Return type:

object.

medianshape.simplicial.meshgen.meshgen3d(bbox, l, fixed_points=None, include_corners=True, load_data=False, shape='ball', **kwargs)[source]

Generates a simplical complex K of dimension 3, a tetrahedralized mesh.

Parameters:
  • bbox (float) – a bounding box, [\(x_{min}, y_{min}, z_{min}, x_{max}, y_{max}, z_{max}\)].
  • l (float) – initial edge length.
  • fixed_points (float) – fixed points that should be in K.
  • include_corners (bool) – If True, the corner points of the given boundary box must be in K.
Returns:

mesh – an object of Mesh3D class.

Return type:

object.

medianshape.simplicial.meshgen.scipy_mesh3d(bbox, l, fixed_points)[source]

Generates a simplical complex K of dimension 3, a tetrahedralized mesh.

Parameters:
  • bbox (float) – a bounding box, [\(x_{min}, y_{min}, z_{min}, x_{max}, y_{max}, z_{max}\)].
  • l (float) – initial edge length.
  • fixed_points (float) – fixed points that should be in K.
Returns:

points, tetrahedras.

Return type:

float, int.

medianshape.simplicial.meshgen.distmesh2d(bbox, l, fixed_points=None, shape='square')[source]

Generates a simplical complex K of dimension 2, a triangulated mesh.

Parameters:
  • bbox (float) – a bounding box, [\(x_{min}, y_{min}, x_{max}, y_{max}\)].
  • l (float) – initial edge length.
  • fixed_points (float) – fixed points that should be in K.
  • shape (str) – the shape of K.
Returns:

points, triangles.

medianshape.simplicial.meshgen.distmesh3d(bbox, l=0.1, fixed_points=None, shape='ball', **kwargs)[source]

Generates tetrahedral mesh, K in 3D with a given shape using Distmesh.

Parameters:
  • bbox (float) – a bounding box, [\(x_{min}, y_{min}, z_{min}, x_{max}, y_{max}, z_{max}\)].
  • l (float) – initial edge length.
  • fixed_points (float) – fixed points that should be in K.
  • shape (str) – a shape of K
Returns:

points, tetrahedras.

medianshape.simplicial.meshgen.square_mesh(bbox, l, fixed_points=None)[source]

Generates a simplical complex K of dimension 2, a triangulated mesh, with square shape using Distmesh.

Parameters:
  • bbox (float) – a bounding box, [\(x_{min}, y_{min}, x_{max}, y_{max}\)].
  • l (float) – initial edge length.
  • fixed_points (float) – fixed points that should be in K.
Returns:

points, triangles.

medianshape.simplicial.meshgen.cuboid_mesh(bbox, l, fixed_points=None)[source]

Generates tetrahedral mesh in 3D using DistMesh with cubic shape using Distmesh.

Parameters:
  • bbox (float) – a bounding box, [\(x_{min}, y_{min}, z_{min}, x_{max}, y_{max}, z_{max}\)].
  • l (float) – initial edge length.
  • fixed_points (float) – fixed points that should be in K.
Returns:

points, tetrahedras.

medianshape.simplicial.meshgen.dcuboid(p, x1, y1, z1, x2, y2, z2)[source]

Signed distance function for cubiod with corners (x1,y1,z1), (x1,y1,z2), (x1,y2,z1), (x1,y2,z2), (x2,y1,z1), (x2,y2,z1), (x2,y1,z2), (x2,y2,z2).

This has an incorrect distance to the four corners.