polynomials_on_simplices.geometry.mesh.basic_meshes.triangle_meshes module

Triangulated geometries.

annulus_triangulation(angular_resolution, radial_resolution)[source]

Create a triangulation of an annulus.

Parameters:
  • angular_resolution – Number of vertices in the triangulation, going around the annulus.
  • radial_resolution – Number of vertices in the triangulation, from the inner perimeter to the outer perimeter.
Returns:

n by 3 list of triangles.

disc_triangulation(angular_resolution=20, radial_resolution=2)[source]

Create a triangulation of a disc.

Parameters:
  • angular_resolution – Number of vertices in the triangulation, going around the disc.
  • radial_resolution – Number of vertices in the triangulation, from the center of the disc to the perimeter.
Returns:

n by 3 list of triangles.

equilateral_triangle_vertices(edge_length=1.0, edge_resolution=3)[source]

Create the vertices of an equilateral triangle in the xy-plane with two corners along the x-axis and the third corner in the first quadrant.

Parameters:
  • edge_length – Length of each edge in the triangle.
  • edge_resolution – Number of vertices along each edge of the triangle.
Returns:

n by 3 list of vertices.

general_triangle_vertices(tri_vertices, edge_resolution=3)[source]

Create the vertices of a triangle defined by its three vertices.

Parameters:
  • tri_vertices – The three vertices of the triangle.
  • edge_resolution – Number of vertices along each edge of the triangle.
Returns:

n by 3 or n by 2 list of vertices (depending on the shape of the input triangle vertices).

offset_triangulation_vertices(triangles, offset)[source]

Offset the index of each vertex in a triangulation. The triangles list is modified in-place.

Parameters:
  • triangles – n by 3 list of indexed triangles which will be edited.
  • offset – Offset for each vertex index.
rectangle_triangulation(width_resolution=2, height_resolution=2)[source]

Create a triangulation of a rectangle.

Parameters:
  • width_resolution – Number of vertices along the width of the rectangle.
  • height_resolution – Number of vertices along the height of the rectangle.
Returns:

n by 3 list of triangles.

rectangle_vertices(width, height, width_resolution=2, height_resolution=2)[source]

Create the vertices of a rectangle in the xy-plane centered in the origin, and with edges aligned with the x- and y-axis.

Parameters:
  • width – Width of the rectangle.
  • height – Height of the rectangle.
  • width_resolution – Number of vertices along the width of the rectangle.
  • height_resolution – Number of vertices along the height of the rectangle.
Returns:

n by 3 list of vertices.

triangle_mesh_triangulation(original_triangles, edge_resolution)[source]

Create a triangulation of a triangle mesh, where each original triangle is subdivided with the given number of vertices along each edge.

Parameters:
  • original_triangles – Triangle mesh to be subdivided.
  • edge_resolution – Number of vertices along each edge in the original triangle mesh.
Returns:

n by 3 list of triangles.

triangle_mesh_vertices(original_triangles, original_vertices, edge_resolution)[source]
Create the vertices of a triangle mesh, where each original triangle is subdivided with the given number
of vertices along each edge.
Parameters:
  • original_triangles – Triangle mesh to be subdivided.
  • original_vertices – Vertices in the original triangle mesh.
  • edge_resolution – Number of vertices along each edge in the original triangle mesh.
Returns:

n by 3 list of vertices.

triangle_triangulation(edge_resolution)[source]

Create a triangulation of a triangle.

Parameters:edge_resolution – Number of vertices along each edge of the triangle.
Returns:n by 3 list of triangles.
triangle_vertices(width=1.0, height=1.0, edge_resolution=3)[source]

Create the vertices of a triangle in the xy-plane with corners in (0, 0), (width, 0) and (0, height).

Parameters:
  • width – ‘Width’ of the triangle.
  • height – ‘Height’ of the triangle.
  • edge_resolution – Number of vertices along each edge of the triangle.
Returns:

n by 3 list of vertices.

unit_square_vertices(width_resolution=2, height_resolution=2)[source]

Create the vertices of the unit square in the xy-plane.

Parameters:
  • width_resolution – Number of vertices along the width of the unit square.
  • height_resolution – Number of vertices along the height of the unit square.
Returns:

n by 3 list of vertices.