pysdic.create_3d_triangle_3_spherical#

create_3d_triangle_3_spherical(function=None, *, frame=None, t_bounds=None, p_bounds=None, t_array=None, p_array=None, n_t=None, n_p=None, direct=True, close=False, add_north=True, add_south=True, diagonal='first', seed=None, uv_layout=0)[source]#

Create a 3D triangle_3 mesh of a spherical surface with radius \(r = f(\theta, \phi)\), optionally closed at the poles.

The quadrangle_4 mesh of pysdic.create_3d_quadrangle_4_spherical() is split into triangles with pysdic.quadrangle_4_to_triangle_3() (the quadrangle \(q\) gives the triangles \(2q\) and \(2q + 1\)). Then:

  • If add_north is True, a vertex is added at the north pole (\(\theta = 0\)), with the radius \(f(0, \phi)\) averaged over the azimuthal angles, and connected to the first ring of vertices (first polar angle) by a fan of triangles.

  • If add_south is True, a vertex is added at the south pole (\(\theta = \pi\)) in the same way, and connected to the last ring of vertices.

The pole triangles have the same orientation as the other triangles, and are added after them (one per azimuthal interval, \(n_p - 1\), or \(n_p\) if close is True). The vertices of the grid keep their indices (mesh.coordinates[i_t * n_p + i_p]), then come the north and the south poles.

Note

In the UV map, the pole vertex of each pole triangle takes the middle of the UV coordinates of the two other vertices: the texture is not stretched over the pole caps.

Parameters:
Returns:

The triangle_3 mesh, with a UV map.

Return type:

pysdic.Mesh

Examples

A closed unit sphere.

1import numpy
2from pysdic import create_3d_triangle_3_spherical
3
4n_p = 20
5mesh = create_3d_triangle_3_spherical(
6    t_bounds=(0.1, numpy.pi - 0.1), n_t=10,
7    p_bounds=(0, 2 * numpy.pi * (1 - 1 / n_p)), n_p=n_p, close=True,
8)
9print(mesh.n_vertices, mesh.n_elements)  # 202 400