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_3mesh of a spherical surface with radius \(r = f(\theta, \phi)\), optionally closed at the poles.The
quadrangle_4mesh ofpysdic.create_3d_quadrangle_4_spherical()is split into triangles withpysdic.quadrangle_4_to_triangle_3()(the quadrangle \(q\) gives the triangles \(2q\) and \(2q + 1\)). Then:If
add_northis 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_southis 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
closeis 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:
function (Optional[Callable[[numpy.ndarray, numpy.ndarray], ArrayLike]]) – See
pysdic.create_3d_quadrangle_4_spherical(). For a closed sphere, use polar angles strictly between 0 and \(\pi\).frame (Optional[py3dframe.Frame]) – See
pysdic.create_3d_quadrangle_4_spherical(). For a closed sphere, use polar angles strictly between 0 and \(\pi\).t_bounds (Optional[Tuple[Real, Real]]) – See
pysdic.create_3d_quadrangle_4_spherical(). For a closed sphere, use polar angles strictly between 0 and \(\pi\).p_bounds (Optional[Tuple[Real, Real]]) – See
pysdic.create_3d_quadrangle_4_spherical(). For a closed sphere, use polar angles strictly between 0 and \(\pi\).t_array (Optional[ArrayLike]) – See
pysdic.create_3d_quadrangle_4_spherical(). For a closed sphere, use polar angles strictly between 0 and \(\pi\).p_array (Optional[ArrayLike]) – See
pysdic.create_3d_quadrangle_4_spherical(). For a closed sphere, use polar angles strictly between 0 and \(\pi\).n_t (Optional[Integral]) – See
pysdic.create_3d_quadrangle_4_spherical(). For a closed sphere, use polar angles strictly between 0 and \(\pi\).n_p (Optional[Integral]) – See
pysdic.create_3d_quadrangle_4_spherical(). For a closed sphere, use polar angles strictly between 0 and \(\pi\).direct (bool) – See
pysdic.create_3d_quadrangle_4_spherical(). For a closed sphere, use polar angles strictly between 0 and \(\pi\).close (bool) – See
pysdic.create_3d_quadrangle_4_spherical(). For a closed sphere, use polar angles strictly between 0 and \(\pi\).uv_layout (Integral) – See
pysdic.create_3d_quadrangle_4_spherical(). For a closed sphere, use polar angles strictly between 0 and \(\pi\).add_north (bool, optional (default:
True)) – If True, the north pole is added. The first polar angle must be greater than 0.add_south (bool, optional (default:
True)) – If True, the south pole is added. The last polar angle must be lower than \(\pi\).diagonal (str, optional (default:
"first")) – The diagonal used to split the quadrangles:"first","second","alternate"or"random".seed (Optional[Union[Integral, numpy.random.Generator]], optional (default:
None)) – The seed ofdiagonal="random".
- Returns:
The
triangle_3mesh, with a UV map.- Return type:
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