gctl_toolkits/trackline/trackline.h
2025-02-11 10:43:28 +08:00

94 lines
3.0 KiB
C++

/********************************************************
* ██████╗ ██████╗████████╗██╗
* ██╔════╝ ██╔════╝╚══██╔══╝██║
* ██║ ███╗██║ ██║ ██║
* ██║ ██║██║ ██║ ██║
* ╚██████╔╝╚██████╗ ██║ ███████╗
* ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
* Geophysical Computational Tools & Library (GCTL)
*
* Copyright (c) 2022 Yi Zhang (yizhang-geo@zju.edu.cn)
*
* GCTL is distributed under a dual licensing scheme. You can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 2
* of the License, or (at your option) any later version. You should have
* received a copy of the GNU Lesser General Public License along with this
* program. If not, see <http://www.gnu.org/licenses/>.
*
* If the terms and conditions of the LGPL v.2. would prevent you from using
* the GCTL, please consider the option to obtain a commercial license for a
* fee. These licenses are offered by the GCTL's original author. As a rule,
* licenses are provided "as-is", unlimited in time for a one time fee. Please
* send corresponding requests to: yizhang-geo@zju.edu.cn. Please do not forget
* to include some description of your company and the realm of its activities.
* Also add information on how to contact you by electronic and paper mail.
******************************************************/
#ifndef _TRACKLINE_H
#define _TRACKLINE_H
#include "ctype.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "iostream"
#include "fstream"
#include "sstream"
#include "iomanip"
#include "vector"
#include "ctime"
#include "cmath"
#ifdef _WINDOWS
#include "io.h"
#include "process.h"
#else
#include "unistd.h"
#endif
#include "gctl/core.h"
#include "gctl/utility.h"
#include "gctl/algorithms.h"
#include "gctl/io.h"
using namespace std;
struct node2d
{
int id = -1;
double px = GCTL_BDL_MAX; //切割剖面上的二维横纵坐标值
double x = GCTL_BDL_MAX, y = GCTL_BDL_MAX; //在球坐标数据插值中 x y值对应经纬度 z值对应深度
double val = GCTL_BDL_MAX; //目前只允许每个点附带一个数据值
};
typedef vector<node2d> node2dArray;
/**
* @brief 两点之间的距离
*
* @param[in] n1 第一点
* @param[in] n2 第二点
*
* @return 距离
*/
double node2dDistance(node2d n1,node2d n2);
class trackLine
{
public:
trackLine(){}
~trackLine(){}
int getInputNode(char*);
int initBox(char*);
int initLine(char*);
int interLine();
int outLine(char*);
private:
node2dArray inputNode;
node2dArray lineNode;
int xnum,ynum;
double dx,dy;
double xmin,xmax,ymin,ymax;
std::vector<std::vector<int> > boxIndex;
node2dArray boxNode;
};
#endif