Use <DDImage/DDMath.h> instead of <math.h> to make portable programs. More...
Functions | |
long | fast_rint (double val) |
long | fast_floor (double val) |
double | radians (double degrees) |
float | radiansf (float degrees) |
double | degrees (double radians) |
float | degreesf (float radians) |
template<class Type > | |
Type | MIN (const Type &a, const Type &b) |
template<class Type > | |
Type | MAX (const Type &a, const Type &b) |
template<class Type , class Typeb > | |
Type | clamp (Type a, Typeb b, Typeb c) |
template<class Type > | |
Type | clamp (Type a) |
template<class Type , class Typeb > | |
bool | step (Type a, Typeb x) |
template<class Type , class Typeb > | |
Type | smoothstep (Type a, Type b, Typeb x) |
template<class Type , class Typeb > | |
Type | lerp (Type a, Type b, Typeb x) |
Use <DDImage/DDMath.h> instead of <math.h> to make portable programs.
This header file only contains inline functions and thus can be used in any code, whether or not it is linked with the DDImage library. It's primary purpose is to fix deficiencies in various platforms math header files.
See also <noise.h>
|
inline |
Fast version of (int)rint(). Works for -2147483648.5 .. 2147483647.49975574019, Requires IEEE floating point.
Referenced by DD::Image::LUT::fillToTable(), DD::Image::Format::from_uv_centre(), DD::Image::Filter::get(), DD::Image::Iop::getTextureImageInfo(), DD::Image::Linear::to_byte(), DD::Image::ProxyContext::to_proxy(), DD::Image::ProxyContext::to_proxy_rel(), and DD::Image::Linear::to_short().
|
inline |
Fast version of (int)floor(). Works for -32728 to 32727.99999236688, rounds numbers greater than n.9999923668 to n+1 rather than n. Requires IEEE floating point.
This doesn't work for numbers outside the bounds, but is 4x faster than standard floor within those bounds. Adding this bounds check doesn't seem to affect its performance, so this allows us to keep using the function
Referenced by DD::Image::Render::_request(), DD::Image::Iop::do_sample_shadowmap(), DD::Image::rTriangle::intersect_scanline(), and DD::Image::Transform::motionBlurSample().
|
inline |
Convert degrees to radians.
References degrees().
Referenced by DD::Image::ComplexLightOp::_validate(), degrees(), degreesf(), DD::Image::Transform::rotateX(), DD::Image::Transform::rotateY(), and DD::Image::Transform::rotateZ().
|
inline |
Convert degrees to radians, returns a float.
References degrees().
|
inline |
|
inline |
Convert radians to degrees, returns a float.
References radians().
|
inline |
Takes the minimum of two things with a '<' operator. Returns b if either a or b is NaN. The function name is uppercase to avoid collisions with the many vender header files that define a macro or other template called min().
Referenced by DD::Image::DrawIop::_validate(), DD::Image::Render::draw_primitives(), DD::Image::Box3::expand(), DD::Image::rTriangle::intersect_dist_squared(), DD::Image::Box::merge(), DD::Image::Transform::motionBlurSample(), DD::Image::ChannelSet::operator&(), DD::Image::ChannelSet::operator&=(), DD::Image::ChannelSet::operator+=(), DD::Image::ChannelSet::operator-=(), DD::Image::Row::range(), DD::Image::Iop::request(), and DD::Image::Scene::validate().
|
inline |
Takes the maximum of two things with a '<' operator. Returns b if either a or b is NaN. The function name is uppercase to avoid collisions with the many vender header files that define a macro or other template called max().
Referenced by DD::Image::Render::_validate(), DD::Image::DrawIop::_validate(), DD::Image::Quadtree< T >::add(), DD::Image::Render::draw_primitives(), DD::Image::Box3::expand(), DD::Image::NukeWrapper::maximum_inputs(), DD::Image::Box::merge(), DD::Image::NukeWrapper::NukeWrapper(), DD::Image::Row::range(), DD::Image::Iop::request(), and DD::Image::Scene::validate().
|
inline |
Restricts a to the range b through c for any type with a '<' operator. Returns b if either a or b or c is NaN.
Referenced by DD::Image::ComplexLightOp::_validate(), DD::Image::RenderScene::inputContext(), DD::Image::MergeOperation(), DD::Image::DrawIop::pixel_engine(), DD::Image::CameraOp::setHorizontalFov(), and DD::Image::Scene::validate().
|
inline |
Same as clamp(a,0,1)
|
inline |
Returns 0 if x is less than a, returns 1 otherwise. Matches the function in RenderMan and other shading languages.
Referenced by DD::Image::Transform::append().
|
inline |
Returns 0 if x is less than a, returns 1 if x is greater or equal to b, returns a smooth cubic interpolation otherwise. Matches the function in RenderMan and other shading languages.
|
inline |
Returns a point on the line f(x) where f(0)==a and f(1)==b. Matches the function in RenderMan and other shading languages.
Referenced by DD::Image::NukeWrapper::uses_input().
©2024 The Foundry Visionmongers, Ltd. All Rights Reserved. |