mirror of
https://github.com/AxioDL/zeus.git
synced 2025-12-21 02:39:24 +00:00
Remove unneeded standard math functions
This commit is contained in:
@@ -90,7 +90,7 @@ public:
|
||||
return dist;
|
||||
}
|
||||
|
||||
float distanceFromPoint(const CVector3f& other) const { return sqrtF(distanceFromPointSquared(other)); }
|
||||
float distanceFromPoint(const CVector3f& other) const { return std::sqrt(distanceFromPointSquared(other)); }
|
||||
|
||||
inline bool intersects(const CAABox& other) const
|
||||
{
|
||||
|
||||
@@ -374,7 +374,7 @@ public:
|
||||
|
||||
void toHSL(float& h, float& s, float& l);
|
||||
|
||||
CColor toGrayscale() { return {sqrtF((r * r + g * g + b * b) / 3), a}; }
|
||||
CColor toGrayscale() { return {std::sqrt((r * r + g * g + b * b) / 3), a}; }
|
||||
|
||||
/**
|
||||
* @brief Clamps to GPU-safe RGBA values [0,1]
|
||||
|
||||
@@ -337,7 +337,7 @@ public:
|
||||
return x * x + y * y;
|
||||
#endif
|
||||
}
|
||||
inline float magnitude() const { return sqrtF(magSquared()); }
|
||||
inline float magnitude() const { return std::sqrt(magSquared()); }
|
||||
|
||||
inline void zeroOut()
|
||||
{
|
||||
|
||||
@@ -306,7 +306,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
inline float magnitude() const { return sqrtF(magSquared()); }
|
||||
inline float magnitude() const { return std::sqrt(magSquared()); }
|
||||
|
||||
inline bool isNotInf() const
|
||||
{
|
||||
|
||||
@@ -107,26 +107,13 @@ CVector3f getCatmullRomSplinePoint(const CVector3f& a, const CVector3f& b, const
|
||||
CVector3f getRoundCatmullRomSplinePoint(const CVector3f& a, const CVector3f& b, const CVector3f& c, const CVector3f& d,
|
||||
float t);
|
||||
|
||||
inline float powF(float a, float b) { return std::pow(a, b); }
|
||||
inline float floorF(float val) { return std::floor(val); }
|
||||
inline float ceilingF(float val)
|
||||
{
|
||||
float tmp = std::floor(val);
|
||||
return (tmp == val ? tmp : tmp + 1.0);
|
||||
}
|
||||
|
||||
// Since round(double) doesn't exist in some <cmath> implementations
|
||||
// we'll define our own
|
||||
inline double round(double val) { return (val < 0.0 ? ceilingF(val - 0.5) : floorF(val + 0.5)); }
|
||||
inline double round(double val) { return (val < 0.0 ? std::ceil(val - 0.5) : std::ceil(val + 0.5)); }
|
||||
inline double powD(float a, float b) { return std::exp(b * std::log(a)); }
|
||||
|
||||
double sqrtD(double val);
|
||||
inline double invSqrtD(double val) { return 1.0 / sqrtD(val); }
|
||||
inline float invSqrtF(float val) { return float(1.0 / sqrtD(val)); }
|
||||
inline float sqrtF(float val) { return float(sqrtD(val)); }
|
||||
float fastArcCosF(float val);
|
||||
float fastCosF(float val);
|
||||
float fastSinF(float val);
|
||||
inline double invSqrtD(double val) { return 1.0 / std::sqrt(val); }
|
||||
inline float invSqrtF(float val) { return float(1.0 / std::sqrt(val)); }
|
||||
int floorPowerOfTwo(int x);
|
||||
int ceilingPowerOfTwo(int x);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user