Meshing the sphere

spherical triangular tessellation(STT) generator

Posted by Yi Zhang on December 29, 2018

Recently by the same author:


线性共轭梯度算法库

You may find interesting:


3D forward modeling of gravity and magnetic data under the Cartesian coordinates.


netcdf数据可视化(二)

Panoply简要使用说明

View in toolbox

Program Propose

The spherical triangular tessellation is a kind of partition of the spherical surface composed by only triangular cells. This program could generate the STT based on an icosahedron. The STT generated by the program could be refined around given points, lines, polygons and circles on the spherical surface. The exterior and interior outlines of the STT could also be customized.

Installation

You need to compile the executable file stt using the makefile. Please change the variable CC in the makefile to the compiler you use.

If you don’t have gcc installed.

  • For Mac OS users, install gcc using Homebrew by
brew install gcc
  • For Linux users, install gcc by
apt-get install gcc

After the gcc is installed. Use make the compile the program. Then move or symlink the executable file stt to any directory included in your $PATH, for instance, /usr/local/bin.

Usage

Usage: stt -d<minimal-depth>/<maximal-depth> [-r'WGS84'|'Earth'|'Moon'|<equator-radius>/<pole-radius>|<equator_radius>,<flat-rate>] [-o<orient-longitude>/<orient-latitude>] [-m<output-msh-filename>] [-v<output-vert-loc-filename>] [-t<output-tri-cen-filename>] [-n<output-tri-neg-filename>] [-p<control-point-filename>] [-l<control-line-filename>] [-g<control-poly-filename>] [-c<control-circle-filename>] [-s<outline-shape-filename>] [-k<hole-shape-filename>] [-h]

Options

  • -d: Minimal and maximal depths of the quad-tree structures used to construct the STT.
  • -r: Coordinate reference system of the output files.
  • -o: Orientation of the top vertex of the base icosahedron.
  • -m: Output filename of the Gmsh(.msh) file.
  • -v: Output filename of the vertices’ location.
  • -t: Output filename of the triangles’ center location.
  • -n: Output filename of the triangles’ neighbor.
  • -p: Input filename of control points’ location.
  • -l: Input filename of control lines’ location.
  • -g: Input filename of control polygons’ location.
  • -c: Input filename of control circles’ location.
  • -s: Input filename of outline shapes’ location.
  • -k: Input filename of hole shapes’ location.
  • -h: show help information.

Input File Formats

Point format

The format of the control points’ location is a plain text file. Each line of the file has the information of one control point which contains the spherical coordinates, maximal quad-tree depth, minimal resolution and physical group of the point. The program takes both the tree depth and resolution to control the fineness of the refined STT. The refinement of the STT will stop which ever the two conditions has been reached. Note that any line that starts with ‘#’ or any empty line will be skipped. An example file:

# <longitude> <latitude> <maximal-depth> <minimal-resolution> <physical-group>
-45 -45 5 1.0 7
45 -45 5 1.0 7
45 45 5 1.0 7
-45 45 5 1.0 7

Circle format

The format of the control circles’ location is a plain text file. Each line of the file has the information of one control circle which contains the spherical coordinates, spherical cap degree, maximal quad-tree depth, minimal resolution and physical group of the circle. The program takes both the tree depth and resolution to control the fineness of the refined STT. The refinement of the STT will stop which ever the two conditions has been reached. Note that any line that starts with ‘#’ or any empty line will be skipped. An example file:

# <longitude> <latitude> <spherical-cap-degree> <maximal-depth> <minimal-resolution> <physical-group>
45 60 30 5 0.1 12
-20 -45 20 6 0.1 13

Line format

The format of the control lines’, polygons’, outlines’, and holes’ location is a plain text file. Blocks separated by empty lines contain information of control units. For each block, the first line has the number of the spherical locations, maximal quad-tree depth, minimal resolution and physical group of the unit. Followed by spherical coordinates of the unit.The program takes both the tree depth and resolution to control the fineness of the refined STT. The refinement of the STT will stop which ever the two conditions has been reached. Note that any line that starts with ‘#’ or any empty line will be skipped. An example file:

# <number-of-points> <maximal-depth> <minimal-resolution> <physical-group>
# <longitude> <latitude>
# <longitude> <latitude>
# ... ...
4 6 0.1 5
-10 10
50 15
60 55
-15 50

Examples

An example of multi-resolution STT:

stt -d 3/7 -m example.msh -l doc/control_lines.txt -g doc/control_poly.txt -c doc/control_circle.txt

stt-example