线性函数,C语言方式实现
GitHub仓库:https://github.com/XinLiGH/LinearFunction
PS:博文不再更新,后续更新会在GitHub仓库进行。
线性函数,C语言方式实现。程序中涉及到线性函数的概念,详细介绍见维基百科[Linear function](https://en.wikipedia.org/wiki/Linear_function)。
1,开发环境
1,操作系统:Windows 10 专业版
2,IDE:Visual Studio 2017 专业版
2,程序源码
LinearFunction.h文件
/**
******************************************************************************
* @file LinearFunction.h
* @author XinLi
* @version v1.0
* @date 13-September-2018
* @brief Header file for LinearFunction.c module.
******************************************************************************
* @attention
*
* <h2><center>Copyright © 2018 XinLi</center></h2>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
******************************************************************************
*/
#ifndef __LINEARFUNCTION_H
#define __LINEARFUNCTION_H
#ifdef __cplusplus
extern "C" {
#endif
/* Header includes -----------------------------------------------------------*/
/* Macro definitions ---------------------------------------------------------*/
/* Type definitions ----------------------------------------------------------*/
typedef struct
{
float slope;
float intercept;
}LinearFunction;
/* Variable declarations -----------------------------------------------------*/
/* Variable definitions ------------------------------------------------------*/
/* Function declarations -----------------------------------------------------*/
void LinearFunction_PointSlopeInit(LinearFunction *function, float x, float y, float slope);
void LinearFunction_TwoPointInit(LinearFunction *function, float x1, float y1, float x2, float y2);
void LinearFunction_SetSlope(LinearFunction *function, float slope);
voi