1 | // tConstants.h  |
2 | //  |
3 | // Physical and mathematical constants.  |
4 | //  |
5 | // Copyright (c) 2004-2006, 2015, 2017, 2019, 2020 Tristan Grimmer.  |
6 | // Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby  |
7 | // granted, provided that the above copyright notice and this permission notice appear in all copies.  |
8 | //  |
9 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL  |
10 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,  |
11 | // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN  |
12 | // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR  |
13 | // PERFORMANCE OF THIS SOFTWARE.  |
14 |   |
15 | #pragma once  |
16 | #include "Foundation/tPlatform.h"  |
17 | namespace tMath  |
18 | {  |
19 |   |
20 |   |
21 | const float Pi = 3.14159265358979323f; // 180 degrees.  |
22 | const float TwoPi = Pi * 2.0f; // 360 degrees.  |
23 | const float PiOver2 = Pi / 2.0f; // 90 degrees.  |
24 | const float PiOver3 = Pi / 3.0f; // 60 degrees.  |
25 | const float PiOver4 = Pi / 4.0f; // 45 degrees;  |
26 | const float PiOver6 = Pi / 6.0f; // 30 degrees;  |
27 | const float DefaultGamma = 2.2f;  |
28 | const float MaxFloat = 3.402823466e+38f;  |
29 |   |
30 | // This is a practical epsilon that can be used in many circumstances. One one millionth.  |
31 | const float Epsilon = 0.000001f;  |
32 |   |
33 | // This is the smallest effective positive float such that 1.0f+EpsilonEff != 1.0f.  |
34 | const float EpsilonEff = 1.192092896e-07f;  |
35 |   |
36 | // This is the smallest positive value that can be represented by a single precision floating point.  |
37 | const float EpsilonRep = 1.175494351e-38f;  |
38 | const float Infinity = MaxFloat;  |
39 |   |
40 | // The infinities below are not the special IEEE bit patterns that represent infinity. They are the very largest and  |
41 | // smallest values that may be represented without use of the special bit patterns.  |
42 | const float PosInfinity = MaxFloat;  |
43 | const float NegInfinity = -MaxFloat;  |
44 |   |
45 | // C++11 should promote 2147483648 to long long int, but VS currently turns it into and unsigned int. That's why we're  |
46 | // using the hex string literal representation for now.  |
47 | const int32 MinInt32 = 0x80000000; // Decimal value -2147483648.  |
48 | const int32 MaxInt32 = 2147483647; // Hex value 0x7FFFFFFF.  |
49 | const uint32 MinUint32 = 0;  |
50 | const uint32 MaxUint32 = 0xFFFFFFFF;  |
51 | const uint32 MinUint16 = 0;  |
52 | const uint32 MaxUint16 = 0xFFFF;  |
53 |   |
54 |   |
55 | }  |
56 | |