gctl/lib/maths/gaussfunc.h

82 lines
3.2 KiB
C
Raw Normal View History

2024-09-10 15:45:07 +08:00
/********************************************************
*
*
*
*
*
*
* Geophysical Computational Tools & Library (GCTL)
*
* Copyright (c) 2023 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 _GAUSSFUNC_H
#define _GAUSSFUNC_H
#include "../core/enum.h"
#include "../core/macro.h"
#include "../core/exceptions.h"
namespace gctl
{
/**
* @brief
*/
struct gaussian_para1d
{
double mu; ///< 分布中心
double sigma; ///< 分布标准差
gaussian_para1d();
gaussian_para1d(double in_mu, double in_sigma);
};
//正态函数参数组
struct gaussian_para2d
{
// 中心位置x y 标准差位置半径x y 绕x轴逆时针旋转的弧度
double mu_x, mu_y, sigma_x, sigma_y, rho;
gaussian_para2d();
gaussian_para2d(double in_mux, double in_muy, double in_sigmax,
double in_sigmay, double in_rho);
};
/**
* @brief
*
* @param[in] para
* @param[in] x
*
* @return
*/
double gaussian_dist1d(double x, const gaussian_para1d &para, gradient_type_e mode = Value);
/**
* @brief
*
* @param[in] x x坐标
* @param[in] y y坐标
* @param[in] p
* @param[in] mode (Value为分布值Dx为x方向梯度Dy为y方向梯度)
*
* @return
*/
double gaussian_dist2d(double x, double y, const gaussian_para2d &p,
gradient_type_e mode = Value);
}
#endif // _GAUSSFUNC_H