- 新增Math库: Vector2/3/4, Matrix3/4, Quaternion, Transform, Color等 - 新增测试框架: Google Test (gtest) - 新增140个单元测试,覆盖Vector, Matrix, Quaternion, Geometry - VolumeRenderer支持vcpkg的NanoVDB - 添加TESTING.md测试文档
28 lines
673 B
C++
28 lines
673 B
C++
#pragma once
|
|
|
|
#include <cmath>
|
|
#include <algorithm>
|
|
#include <cstdint>
|
|
|
|
#ifdef _MSC_VER
|
|
#define _USE_MATH_DEFINES
|
|
#include <math.h>
|
|
#endif
|
|
|
|
namespace XCEngine {
|
|
namespace Math {
|
|
|
|
constexpr float PI = 3.14159265358979323846f;
|
|
constexpr float TWO_PI = 6.28318530717958647692f;
|
|
constexpr float HALF_PI = 1.57079632679489661923f;
|
|
constexpr float DEG_TO_RAD = PI / 180.0f;
|
|
constexpr float RAD_TO_DEG = 180.0f / PI;
|
|
constexpr float EPSILON = 1e-6f;
|
|
constexpr float FLOAT_MAX = 3.402823466e+38f;
|
|
|
|
inline float Radians(float degrees) { return degrees * DEG_TO_RAD; }
|
|
inline float Degrees(float radians) { return radians * RAD_TO_DEG; }
|
|
|
|
} // namespace Math
|
|
} // namespace XCEngine
|