**build_sphere#

Description#

This command builds the mesh of a sphere using s3d3 elements through iterative subdivision of an icosahedron. The resulting mesh is a pure triangle mesh and has regular vertex distribution and element size. It involves three steps:

  • Generate an initial icosahedron

  • Subdivide its triangles

  • Project the vertices to the sphere

Syntax#

**build_sphere   [ *name name ]   *center (x y z)   *r radius   *n iteration   [ *file ascii_file   *with_material ]

name

Name of the created elset. By default name = SPHERE.

center

Center of the sphere. By default center = (0 0 0);

r

Radius of the sphere. By default r=1

n

The number of iterations. By default n=1, which corresponds to an icosahedron. At subsequent iterations, each triangle is subdivied into 4 smaller triangles.

file

ascii file containing the center, radius and elset_name for one or several spheres.

with_material

a boolean to assign (or not) a different elset name to each sphere (provided in *file).

Examples#

../../_images/sphere_icosahedron.svg
**build_sphere
 *center (0. 0. 0.)
 *r 2.
 *n 2

In the following, a second example allowing to build the mesh of several spheres at once (in this case 5) using an ascii file

**build_sphere
 *file spheres.txt
 *n 4
 *with_material

where spheres.txt contains

0.  0. 0. 2. sphere1
5.  0. 0. 2.  sphere2
-5.  0. 0. 2.  sphere3
0.  5. 0. 2.  sphere4
0. -5. 0. 2.  sphere5