24 #ifndef PXR_BASE_GF_MATH_H
25 #define PXR_BASE_GF_MATH_H
36 #include <type_traits>
43 return fabs(a-b) < epsilon;
49 return radians * (180.0 /
M_PI);
55 return degrees * (
M_PI / 180.0);
75 return (v < 0) ? -1 : ((v > 0) ? 1 : 0);
87 inline double GfExp(
double f) {
return std::exp(f); }
90 inline float GfExp(
float f) {
return std::exp(f); }
115 inline double GfAbs(
double f) {
return std::fabs(f); }
118 inline float GfAbs(
float f) {
return std::fabs(f); }
148 inline void GfSinCos(
double v,
double *
s,
double *
c) { ArchSinCos(v, s, c); }
151 inline void GfSinCos(
float v,
float *
s,
float *
c) { ArchSinCosf(v, s, c); }
157 if (value < min)
return min;
158 if (value > max)
return max;
165 if (value < min)
return min;
166 if (value > max)
return max;
178 double GfMod(
double a,
double b);
194 return (1-alpha)* a + alpha *
b;
201 return (a1 < a2 ? a1 : a2);
212 inline T GfMin(T a1, T a2, T a3, T a4, T a5) {
220 return (a1 < a2 ? a2 : a1);
231 inline T GfMax(T a1, T a2, T a3, T a4, T a5) {
241 inline decltype(std::declval<Left>() * std::declval<Right>())
252 inline decltype(std::declval<Left>() * std::declval<Right>())
262 GfIsArithmetic<Right>::value,
int> = 0>
263 inline decltype(std::declval<Left>() / std::declval<Right>())
271 #endif // PXR_BASE_GF_MATH_H
SYS_API double cos(double x)
decltype(std::declval< Left >()*std::declval< Right >()) GfCompMult(Left left, Right right)
double GfClamp(double value, double min, double max)
IMATH_HOSTDEVICE constexpr int floor(T x) IMATH_NOEXCEPT
GLsizei const GLfloat * value
vfloat4 sqrt(const vfloat4 &a)
GLboolean GLboolean GLboolean GLboolean a
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
void GfSinCos(double v, double *s, double *c)
T GfLerp(double alpha, const T &a, const T &b)
double GfPow(double f, double p)
ImageBuf OIIO_API pow(const ImageBuf &A, cspan< float > B, ROI roi={}, int nthreads=0)
GLfloat GLfloat GLfloat alpha
GLboolean GLboolean GLboolean b
PXR_NAMESPACE_OPEN_SCOPE bool GfIsClose(double a, double b, double epsilon)
double GfDegreesToRadians(double degrees)
IMATH_HOSTDEVICE constexpr int ceil(T x) IMATH_NOEXCEPT
GF_API double GfMod(double a, double b)
decltype(std::declval< Left >()/std::declval< Right >()) GfCompDiv(Left left, Right right)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
decltype(std::declval< Left >()*std::declval< Right >()) GfDot(Left left, Right right)
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
#define PXR_NAMESPACE_CLOSE_SCOPE
OIIO_FORCEINLINE T log(const T &v)
vint4 rint(const vfloat4 &a)
OIIO_FORCEINLINE OIIO_HOSTDEVICE T radians(T deg)
Convert degrees to radians.
double GfRadiansToDegrees(double radians)
SYS_API double sin(double x)
OIIO_FORCEINLINE OIIO_HOSTDEVICE T degrees(T rad)
Convert radians to degrees.