载入中...
搜索中...
未找到
Math.h
浏览该文件的文档.
1#pragma once
2
3
4#include <climits> // for CHAR_BIT
5#include <cstdlib> // for rand() and RAND_MAX
6
7/* Definitions of useful mathematical constants
8 * M_E - e
9 * M_LOG2E - log2(e)
10 * M_LOG10E - log10(e)
11 * M_LN2 - ln(2)
12 * M_LN10 - ln(10)
13 * M_PI - pi
14 * M_PI_2 - pi/2
15 * M_PI_4 - pi/4
16 * M_1_PI - 1/pi
17 * M_2_PI - 2/pi
18 * M_2_SQRTPI - 2/sqrt(pi)
19 * M_SQRT2 - sqrt(2)
20 * M_SQRT1_2 - 1/sqrt(2)
21 */
22
23#define EVE_M_E 2.71828182845904523536
24#define EVE_M_LOG2E 1.44269504088896340736
25#define EVE_M_LOG10E 0.434294481903251827651
26#define EVE_M_LN2 0.693147180559945309417
27#define EVE_M_LN10 2.30258509299404568402
28#define EVE_M_PI 3.14159265358979323846
29#define EVE_M_PI_2 1.57079632679489661923
30#define EVE_M_PI_4 0.785398163397448309616
31#define EVE_M_1_PI 0.318309886183790671538
32#define EVE_M_2_PI 0.636619772367581343076
33#define EVE_M_2_SQRTPI 1.12837916709551257390
34#define EVE_M_SQRT2 1.41421356237309504880
35#define EVE_M_SQRT1_2 0.707106781186547524401
36#define EVE_M_TORAD (float)(EVE_M_PI/180.0)
37#define EVE_M_TODEG (float)(180.0/EVE_M_PI)
38#define EVE_TORAD(x) (float)(x*EVE_M_TORAD)
39#define EVE_TODEG(x) (float)(x*EVE_M_TODEG)
40
41namespace eve
42{
43
45struct Rect
46{
47 int x, y;
48 int w, h;
49
51 bool operator == (const Rect &rhs) const
52 {
53 return x == rhs.x && y == rhs.y && w == rhs.w && h == rhs.h;
54 }
55};
56
57}
Definition Build.cpp:11
Axis-aligned integer rectangle (screen/tile space).
Definition Math.h:46
int x
Definition Math.h:47
int h
Definition Math.h:48
int y
Definition Math.h:47
int w
Definition Math.h:48
bool operator==(const Rect &rhs) const
Component-wise equality.
Definition Math.h:51