Compare commits

..

4 Commits
v1.4 ... main

Author SHA1 Message Date
77e8ac7da0 doc update 2025-04-08 21:55:49 +08:00
4e266889dd 更新 README.md 2025-02-03 12:25:09 +08:00
ddb0f25bc9 update readme 2025-02-03 11:46:18 +08:00
92d56d3b0a tmp 2025-01-16 20:08:46 +08:00
4 changed files with 88 additions and 22 deletions

View File

@ -1,5 +1,7 @@
## Spherical Triangular Tessellation (STT) Generator
> **Note:** This document is automatically generated by Cursor AI.The function names,parameters,and usage instructions in the document may contain errors.Please refer to the actual function declarations in the header file(`.h`).In case of any inconsistencies,the source code shall prevail.
### Introduction
The spherical triangular tessellation (STT) is a method to partition a spherical surface into triangular cells. This program generates STT based on an icosahedron and provides various refinement options:
@ -12,6 +14,61 @@ The spherical triangular tessellation (STT) is a method to partition a spherical
2. Topographic refinement based on elevation data
3. Customizable exterior and interior boundaries
### Technical Details
#### Core Algorithm
1. **Base Structure**
- Starts with an icosahedron (20 triangular faces)
- Uses quad-tree data structure for adaptive refinement
- Each face of the icosahedron becomes the root of a quad-tree
2. **Refinement Process**
- Adaptive refinement based on various constraints
- Uses vector calculations for spherical geometry
- Supports multiple levels of refinement (controlled by depth parameter)
3. **Constraint Types**
- Point constraints: Refines mesh around specific points
- Line constraints: Refines along great circle paths
- Polygon constraints: Refines within or around polygon boundaries
- Circle constraints: Refines within spherical caps
- Topographic constraints: Refines based on elevation data
4. **Coordinate Systems**
- Supports multiple reference systems:
* WGS84 ellipsoid
* Spherical Earth
* Lunar sphere
* Custom ellipsoid
* Custom flattened sphere
- Configurable orientation of the base icosahedron
### Algorithm Details
1. **Initialization**
- Creates base icosahedron
- Sets up coordinate system and orientation
- Initializes quad-tree structure
2. **Refinement Process**
- Reads constraint files
- For each triangle:
* Tests intersection with constraints
* Subdivides if needed based on depth and resolution
* Maintains neighbor relationships
3. **Output Generation**
- Generates final mesh
- Computes vertex locations
- Creates neighbor lists
- Exports in various formats
4. **Memory Management**
- Uses dynamic allocation for tree structures
- Automatically cleans up temporary data
- Efficient handling of large datasets
### Files and folders
1. **CMakeLists.txt**: CMake project configuration file
@ -22,7 +79,7 @@ The spherical triangular tessellation (STT) is a method to partition a spherical
### Installation
This program is developed and maintained by Dr. Yi Zhang (yizhang-geo@zju.edu.cn). To compile and install using [CMake](https://cmake.org):
To compile and install using [CMake](https://cmake.org):
```shell
mkdir build
@ -39,6 +96,7 @@ Usage: stt -d<minimal-depth>/<maximal-depth> [options]
Required:
-d<min>/<max> Minimal and maximal depths of the quad-tree structure
Example: -d3/7 for refinement from depth 3 to 7
Optional:
-r<ref> Coordinate reference system:
@ -48,6 +106,7 @@ Optional:
- <eq-rad>/<pole-rad>: Custom ellipsoid
- <eq-rad>,<flat-rate>: Custom flattened sphere
-o<lon>/<lat> Orientation of icosahedron top vertex
Default: 0/90 (North Pole)
Output options:
-m<file> Output Gmsh(.msh) mesh file
@ -72,29 +131,35 @@ Help:
### Input File Formats
#### Point Control Format
Controls refinement around specific points:
Controls refinement around specific points. Each point is defined by its location and refinement parameters:
```bash
# <longitude> <latitude> <maximal-depth> <minimal-resolution> <physical-group>
# longitude, latitude: Coordinates in degrees
# maximal-depth: Maximum refinement depth for this point
# minimal-resolution: Minimum cell size in degrees
# physical-group: Group identifier for the refined region
-45 -45 5 1.0 7
45 -45 5 1.0 7
```
#### Circle Control Format
Controls refinement around spherical caps:
Controls refinement around spherical caps. Each circle is defined by its center, radius, and refinement parameters:
```bash
# <longitude> <latitude> <spherical-cap-degree> <maximal-depth> <minimal-resolution> <physical-group>
# spherical-cap-degree: Angular radius of the cap in degrees
45 60 30 5 0.1 12
-20 -45 20 6 0.1 13
```
#### Line/Polygon Control Format
Controls refinement along lines or around polygons:
Controls refinement along lines or around polygons. Each shape is defined by a sequence of points and refinement parameters:
```bash
# First line: <number-of-points> <maximal-depth> <minimal-resolution> <physical-group>
# Following lines: <longitude> <latitude> of each point
# Points are connected in sequence, last point connects to first for polygons
4 6 0.1 5
-10 10
50 15
@ -103,31 +168,39 @@ Controls refinement along lines or around polygons:
```
#### Topography Control Format
Controls refinement based on elevation data:
Controls refinement based on elevation data. The refinement is based on elevation variation within triangles:
```bash
# First line: <maximum-STD> <maximal-depth> <minimal-resolution> <physical-group>
# Following lines: <longitude> <latitude> <elevation(meters)>
# maximum-STD: Maximum allowed standard deviation of elevation within a triangle
200.0 10 -1 5
-179.95 89.95 -4203.20
-179.85 89.95 -4203.07
-179.75 89.95 -4203.47
```
Note: maximum-STD represents the maximum standard deviation of elevation allowed in a triangle.
Note: maximum-STD represents the maximum standard deviation of elevation allowed in a triangle. A triangle will be refined if the elevation variation within it exceeds this threshold.
### Examples
1. Multi-resolution STT with geometric constraints:
```bash
# Creates a mesh with depth range 3-7, refined around lines, polygons and circles
stt -d 3/7 -m example.msh -l doc/control_lines.txt -g doc/control_poly.txt -c doc/control_circle.txt
```
![stt-example](doc/stt-example.png)
2. Topography-constrained STT:
```bash
# Creates a mesh with depth range 6-10, refined based on topography data
stt -d 6/10 -m topo_example.msh -t doc/control_topo.txt
```
![topo-example](doc/topo_constraint.png)
### Contact
For any bug reports or you need some help. Please contact Dr. Yi Zhang ([yizhang-geo@zju.edu.cn](yizhang-geo@zju.edu.cn)).

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 2.4 MiB

View File

@ -18,8 +18,15 @@ void disp_help(char* proname){
[-k<hole-shape-file>] \
[-z<control-topography-file>] \
[-h]";
clog << proname << " - v1.4 A generator of the Spherical Triangular Tessellation (STT)." << endl;
clog << "Usage: " << exe_name << endl;
clog << " _ _ \n";
clog << " ___ | |_ | |_ \n";
clog << " / __|| __|| __|\n";
clog << " \\__ \\| |_ | |_ \n";
clog << " |___/ \\__| \\__|\n";
clog << proname << " - v1.4 - A generator of the Spherical Triangular Tessellation (STT).\n\
This program is distributed under a dual licensing scheme. It is free for academic use, but a commercial license is required for commercial use.\n\n";
clog << "Author: Dr. Yi Zhang (yizhang-geo@zju.edu.cn)\n\n";
clog << "Usage: " << exe_name << endl << endl;
clog << "Options:" << endl;
clog << "\t-d\tMinimal and maximal quad-tree depths of the output STT." << endl;
clog << "\t-r\tCoordinate reference system of the output STT, the default is 1e+5/1e+5." << endl;

View File

@ -29,19 +29,5 @@ int SttGenerator::InTriangleTopo(QuadTreeNode* node, const ControlTopo& in_topo,
if (data_std(in_topo.topo) >= diff_threshold) return 1;
else return 0;
/*
for (int i = 0; i < in_topo.vert.size(); i++){
// 1. 允许的最大深度大于当前节点的深度
// 2. 允许的最小分辨率小于当前节点的分辨率
if (in_topo.max_depth >= node_depth && node_resolution >= in_topo.minimal_resolution){
// 统计符合条件的地形的最大值与最小值
if (in_topo.topo[i] > max_topo) max_topo = in_topo.topo[i];
if (in_topo.topo[i] < max_topo) min_topo = in_topo.topo[i];
}
}
if (std::abs(max_topo - min_topo) >= diff_threshold) return 1;
return 0;
*/
}
}