dt.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. #pragma once
  2. #include<cstdio>
  3. #include "string.h"
  4. #include "windows.h"
  5. #define ROOT_PATH "D:\\Config\\"
  6. typedef int INT;
  7. typedef unsigned int UINT;
  8. typedef char CHAR;
  9. typedef unsigned char UCHAR;
  10. typedef short SHORT;
  11. typedef unsigned short USHORT;
  12. typedef long LONG;
  13. typedef unsigned long ULONG;
  14. typedef float FLOAT;
  15. typedef double DOUBLE;
  16. typedef long double LDOUBLE;
  17. #ifdef __SUPPORT_LLONG__
  18. typedef long long LLONG;
  19. typedef unsigned long long ULLONG;
  20. typedef unsigned long long QWORD;
  21. #endif /*__SUPPORT_LLONG__*/
  22. #ifndef FALSE
  23. #define FALSE false
  24. #endif
  25. #ifndef TRUE
  26. #define TRUE true
  27. #endif
  28. #ifndef OK
  29. #define OK 0
  30. #endif
  31. #ifndef SUCCESS
  32. #define SUCCESS 0
  33. #endif
  34. #ifndef FAIL
  35. #define FAIL (-1)
  36. #endif
  37. #ifndef STOP
  38. #define STOP 2
  39. #endif
  40. // Define NULL pointer value
  41. #ifndef NULL
  42. # ifdef __cplusplus
  43. # define NULL 0
  44. # else
  45. # define NULL ((void *)0)
  46. # endif
  47. #endif // NULL
  48. typedef struct _XY_LONG_STRUCT
  49. {
  50. LONG x;
  51. LONG y;
  52. _XY_LONG_STRUCT()
  53. {
  54. x = 0;
  55. y = 0;
  56. };
  57. _XY_LONG_STRUCT(LONG _x, LONG _y)
  58. {
  59. x = _x;
  60. y = _y;
  61. };
  62. _XY_LONG_STRUCT operator=(const LONG& a)
  63. {
  64. _XY_LONG_STRUCT b;
  65. b.x = a;
  66. b.y = a;
  67. return b;
  68. };
  69. _XY_LONG_STRUCT operator+(const _XY_LONG_STRUCT& a)
  70. {
  71. _XY_LONG_STRUCT b;
  72. b.x = this->x + a.x;
  73. b.y = this->y + a.y;
  74. return b;
  75. };
  76. _XY_LONG_STRUCT operator-(const _XY_LONG_STRUCT& a)
  77. {
  78. _XY_LONG_STRUCT b;
  79. b.x = this->x - a.x;
  80. b.y = this->y - a.y;
  81. return b;
  82. };
  83. }XY_LONG_STRUCT; //X,Y组合位置
  84. typedef struct _XY_DOUBLE_STRUCT
  85. {
  86. double x;
  87. double y;
  88. _XY_DOUBLE_STRUCT()
  89. {
  90. x = 0.0;
  91. y = 0.0;
  92. };
  93. _XY_DOUBLE_STRUCT(double _x, double _y)
  94. {
  95. x = _x;
  96. y = _y;
  97. };
  98. _XY_DOUBLE_STRUCT operator=(const double& a)
  99. {
  100. _XY_DOUBLE_STRUCT b;
  101. b.x = a;
  102. b.y = a;
  103. return b;
  104. };
  105. _XY_DOUBLE_STRUCT operator+(const _XY_DOUBLE_STRUCT& a)
  106. {
  107. _XY_DOUBLE_STRUCT b;
  108. b.x = this->x + a.x;
  109. b.y = this->y + a.y;
  110. return b;
  111. };
  112. _XY_DOUBLE_STRUCT operator-(const _XY_DOUBLE_STRUCT& a)
  113. {
  114. _XY_DOUBLE_STRUCT b;
  115. b.x = this->x - a.x;
  116. b.y = this->y - a.y;
  117. return b;
  118. };
  119. _XY_DOUBLE_STRUCT operator+(const _XY_LONG_STRUCT& a)
  120. {
  121. _XY_DOUBLE_STRUCT b;
  122. b.x = this->x + a.x;
  123. b.y = this->y + a.y;
  124. return b;
  125. };
  126. _XY_DOUBLE_STRUCT operator-(const _XY_LONG_STRUCT& a)
  127. {
  128. _XY_DOUBLE_STRUCT b;
  129. b.x = this->x - a.x;
  130. b.y = this->y - a.y;
  131. return b;
  132. };
  133. }XY_DOUBLE_STRUCT; //X,Y组合位置
  134. typedef struct _X_Y_ANGLE_STRUCT
  135. {
  136. double x;
  137. double y;
  138. double a; //角度
  139. _X_Y_ANGLE_STRUCT()
  140. {
  141. x = 0.0;
  142. y = 0.0;
  143. a = 0.0;
  144. };
  145. _X_Y_ANGLE_STRUCT(double _x, double _y, double _a)
  146. {
  147. x = _x;
  148. y = _y;
  149. a = _a;
  150. };
  151. }X_Y_ANGLE_STRUCT;
  152. struct X_Y_Z_R_STRUCT
  153. {
  154. DOUBLE x;
  155. DOUBLE y;
  156. DOUBLE z;
  157. DOUBLE r;
  158. X_Y_Z_R_STRUCT() {
  159. x = 0;
  160. y = 0;
  161. z = 0;
  162. r = 0;
  163. }
  164. X_Y_Z_R_STRUCT(DOUBLE dx, DOUBLE dy, DOUBLE dz, DOUBLE dr) {
  165. x = dx;
  166. y = dy;
  167. z = dz;
  168. r = dr;
  169. }
  170. };
  171. struct X_Y_Z_STRUCT
  172. {
  173. DOUBLE x;
  174. DOUBLE y;
  175. DOUBLE z;
  176. X_Y_Z_STRUCT() {
  177. x = 0;
  178. y = 0;
  179. z = 0;
  180. }
  181. X_Y_Z_STRUCT(DOUBLE dx, DOUBLE dy, DOUBLE dz) {
  182. x = dx;
  183. y = dy;
  184. z = dz;
  185. }
  186. };
  187. struct X_Y_R_STRUCT
  188. {
  189. DOUBLE x;
  190. DOUBLE y;
  191. DOUBLE r;
  192. X_Y_R_STRUCT() {
  193. x = 0;
  194. y = 0;
  195. r = 0;
  196. }
  197. X_Y_R_STRUCT(DOUBLE dx, DOUBLE dy, DOUBLE dr) {
  198. x = dx;
  199. y = dy;
  200. r = dr;
  201. }
  202. };
  203. #define DP(fmt,...) printf("%s(%d):"##fmt" \n", __FILE__, __LINE__, ##__VA_ARGS__)