📄 geom.h
字号:
/* YAKS, geometric, 2d geometri library Copyright (C) 2000 Johan Carlsson (johanc@ida.his.se) 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 2 of the License, or 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#ifndef GEOM_H#define GEOM_H#include <stdlib.h>#include <stdio.h>#include <math.h>#include <values.h>#include <time.h>#define GFALSE 0#define GTRUE 1/** *@enum g_Relation geom.h * Relation between objects. */enum g_Relation{/**Intersects with line A. */ INT_LA,/**Intersects with line B. */ INT_LB,/**Intersects with both line A and B. */ INT_LAB,/**Between line A and B, or between something and something. */ BETWEEN,/**Outside an area.*/ OUTSIDE,/**Inside an area. */ INSIDE};void geometricInit();/* Math *//** Radians for 90 degrees. */#define P90 (M_PI / 2)/** Radians for 180 degrees. */#define P180 (M_PI)/** Radians for 360 degrees. */#define P360 (M_PI * 2)double g_sin(double);double g_cos(double);int g_modulo(double ab,int b);int g_modulo(int a, int b);int g_mrand(int t);float g_rans(double n);/* Angle twisters */int g_splitAngle180(int ang); int g_adjustAngle360(int ang,int corr); double g_RADtoDGR(double r);double g_DGRtoRAD(double r);double g_wallAngle(float x1, float y1, float x2, float y2);//double g_lineAngle(int x1, int y1, int x2, int y2);double g_lineAngle(float x1, float y1, float x2, float y2);int g_relAngle(float absolut, float kepera);double g_relAngle(double absolute, double kepera);int g_controlAngle(int ang);/* Line functions */double g_distLinePoint(float ax1, float ay1, float ax2, float ay2, float px, float py); float g_distLinePoint(float ax1, float ay1, float ax2,float ay2, float px,float py, float *xt, float *yt, float *t);g_Relation g_circleBetweenLineAB(float ax1, float ay1, float ax2,float ay2, float bx1, float by1, float bx2,float by2, float cx, float cy, float cradius);int g_linesCrosses(float ax1, float ay1, float ax2,float ay2, float bx1, float by1, float bx2,float by2);double g_distPoint(float x, float y, float x1, float y1); double g_mang(int x, int y, int x1, int y1, double dist);/* Displacement functions*/float g_displaceX(float x,float d,double angle);float g_displaceY(float y,float d,double angle);float g_displaceXR(float x,float d,double angle);float g_displaceYR(float y,float d,double angle);#endif /* GEOM_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -