update to v1.4.1
This commit is contained in:
parent
3995ecce93
commit
f2d36a1f85
@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.15.2)
|
cmake_minimum_required(VERSION 3.15.2)
|
||||||
# 设置工程名称
|
# 设置工程名称
|
||||||
project(stt VERSION 1.4 LANGUAGES CXX)
|
project(stt VERSION 1.4.1 LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
|
||||||
|
69
src/main.cc
69
src/main.cc
@ -1,6 +1,15 @@
|
|||||||
|
/***********************************
|
||||||
|
* Update histories:
|
||||||
|
*
|
||||||
|
* v1.4.1
|
||||||
|
* 1. Add minimal resolution and max depth controls for the topography constrain.
|
||||||
|
* 2. Add data format and update history sections in help information.
|
||||||
|
*
|
||||||
|
***********************************/
|
||||||
|
|
||||||
#include "stt_class.h"
|
#include "stt_class.h"
|
||||||
|
|
||||||
void disp_help(char* proname){
|
void disp_help(char* proname, bool show_all){
|
||||||
string exe_name = proname;
|
string exe_name = proname;
|
||||||
exe_name = " " + exe_name +
|
exe_name = " " + exe_name +
|
||||||
" -d<minimal-depth>/<maximal-depth> \
|
" -d<minimal-depth>/<maximal-depth> \
|
||||||
@ -23,7 +32,7 @@ void disp_help(char* proname){
|
|||||||
clog << " / __|| __|| __|\n";
|
clog << " / __|| __|| __|\n";
|
||||||
clog << " \\__ \\| |_ | |_ \n";
|
clog << " \\__ \\| |_ | |_ \n";
|
||||||
clog << " |___/ \\__| \\__|\n";
|
clog << " |___/ \\__| \\__|\n";
|
||||||
clog << proname << " - v1.4 - A generator of the Spherical Triangular Tessellation (STT).\n\
|
clog << proname << " - v1.4.1 - 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";
|
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 << "Author: Dr. Yi Zhang (yizhang-geo@zju.edu.cn)\n\n";
|
||||||
clog << "Usage: " << exe_name << endl << endl;
|
clog << "Usage: " << exe_name << endl << endl;
|
||||||
@ -42,7 +51,57 @@ This program is distributed under a dual licensing scheme. It is free for academ
|
|||||||
clog << "\t-s\tInput outline polygon location(.txt) filename." << endl;
|
clog << "\t-s\tInput outline polygon location(.txt) filename." << endl;
|
||||||
clog << "\t-k\tInput hole polygon location(.txt) filename." << endl;
|
clog << "\t-k\tInput hole polygon location(.txt) filename." << endl;
|
||||||
clog << "\t-z\tInput topography(.txt) filename." << endl;
|
clog << "\t-z\tInput topography(.txt) filename." << endl;
|
||||||
clog << "\t-h\tShow help information." << endl;
|
clog << "\t-h\tShow full help information." << endl;
|
||||||
|
|
||||||
|
if (!show_all) return;
|
||||||
|
|
||||||
|
clog << R"(
|
||||||
|
Input File Formats:
|
||||||
|
|
||||||
|
1. Point Control Format
|
||||||
|
Controls refinement around specific points. Each point is defined by its location and refinement parameters:
|
||||||
|
|
||||||
|
# <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
|
||||||
|
|
||||||
|
2. Circle Control Format
|
||||||
|
Controls refinement around spherical caps. Each circle is defined by its center, radius, and refinement parameters:
|
||||||
|
|
||||||
|
# <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
|
||||||
|
|
||||||
|
3. Line/Polygon Control Format
|
||||||
|
Controls refinement along lines or around polygons. Each shape is defined by a sequence of points and refinement parameters:
|
||||||
|
|
||||||
|
# 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
|
||||||
|
60 55
|
||||||
|
-15 50
|
||||||
|
|
||||||
|
4. Topography Control Format
|
||||||
|
Controls refinement based on elevation data. The refinement is based on elevation variation within triangles:
|
||||||
|
|
||||||
|
# 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. A triangle will be refined if the elevation variation within it exceeds this threshold.)" << std::endl;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]){
|
int main(int argc, char* argv[]){
|
||||||
@ -68,7 +127,7 @@ int main(int argc, char* argv[]){
|
|||||||
|
|
||||||
// show help information is no options is read
|
// show help information is no options is read
|
||||||
if (argc == 1){
|
if (argc == 1){
|
||||||
disp_help(argv[0]);
|
disp_help(argv[0], false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +136,7 @@ int main(int argc, char* argv[]){
|
|||||||
// get option number
|
// get option number
|
||||||
switch (curr){
|
switch (curr){
|
||||||
case 'h': // show help information
|
case 'h': // show help information
|
||||||
disp_help(argv[0]); return 0;
|
disp_help(argv[0], true); return 0;
|
||||||
case 'd':
|
case 'd':
|
||||||
option_number = 0; break;
|
option_number = 0; break;
|
||||||
case 'r':
|
case 'r':
|
||||||
|
@ -24,10 +24,14 @@ int SttGenerator::InTriangleTopo(QuadTreeNode* node, const ControlTopo& in_topo,
|
|||||||
}
|
}
|
||||||
node_resolution = node_resolution*60/Pi;
|
node_resolution = node_resolution*60/Pi;
|
||||||
|
|
||||||
|
if (in_topo.max_depth >= node_depth &&
|
||||||
|
node_resolution >= in_topo.minimal_resolution &&
|
||||||
|
data_std(in_topo.topo) >= diff_threshold)
|
||||||
|
{
|
||||||
// 将控制点的组别赋值给当前节点
|
// 将控制点的组别赋值给当前节点
|
||||||
node->tri.physic_group = in_topo.physic_group;
|
node->tri.physic_group = in_topo.physic_group;
|
||||||
|
return 1;
|
||||||
if (data_std(in_topo.topo) >= diff_threshold) return 1;
|
}
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user