mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
271cc5cf23
* remove some rules * format all codes with new format rule
31 lines
544 B
C++
31 lines
544 B
C++
#include "cocos/math/Utils.h"
|
|
|
|
#include <algorithm>
|
|
#include <cmath>
|
|
#include <random>
|
|
#include "math/Math.h"
|
|
|
|
namespace {
|
|
std::random_device rd;
|
|
std::uniform_real_distribution<float> uniformReal{0.0F, 1.0F};
|
|
} // namespace
|
|
|
|
namespace cc {
|
|
|
|
namespace mathutils {
|
|
|
|
float random() {
|
|
return uniformReal(rd);
|
|
}
|
|
|
|
Vec3ElementType absMaxComponent(const Vec3 &v) {
|
|
return absMax(absMax(v.x, v.y), v.z);
|
|
}
|
|
|
|
Vec3ElementType maxComponent(const Vec3 &v) {
|
|
return std::max(std::max(v.x, v.y), v.z);
|
|
}
|
|
|
|
} // namespace mathutils
|
|
|
|
} // namespace cc
|