Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
util.h File Reference
#include <boost/static_assert.hpp>

Go to the source code of this file.

Classes

struct  SimpleStringOrdering
 Simple functor for sorting string parameters by length and content. More...
 

Macros

#define __MITSUBA_CORE_UTIL_H_
 

Functions

String-related utility functions
MTS_EXPORT_CORE std::vector
< std::string > 
tokenize (const std::string &string, const std::string &delim)
 Given a list of delimiters, tokenize a std::string into a vector of strings. More...
 
MTS_EXPORT_CORE std::string trim (const std::string &str)
 Trim spaces (' ', '\n', '\r', '\t') from the ends of a string. More...
 
MTS_EXPORT_CORE std::string indent (const std::string &string, int amount=1)
 Indent a string (Used for recursive toString() structure dumping) More...
 
MTS_EXPORT_CORE std::string formatString (const char *pFmt,...)
 Wrapped snprintf. More...
 
MTS_EXPORT_CORE std::string timeString (Float time, bool precise=false)
 Convert a time difference (in seconds) to a string representation. More...
 
MTS_EXPORT_CORE std::string memString (size_t size, bool precise=false)
 Turn a memory size into a human-readable string. More...
 
template<class Iterator >
std::string containerToString (const Iterator &start, const Iterator &end)
 Return a string representation of a list of objects. More...
 
Miscellaneous
MTS_EXPORT_CORE void *__restrict allocAligned (size_t size)
 Allocate an aligned region of memory. More...
 
MTS_EXPORT_CORE void freeAligned (void *ptr)
 Free an aligned region of memory. More...
 
MTS_EXPORT_CORE int getCoreCount ()
 Determine the number of available CPU cores. More...
 
MTS_EXPORT_CORE std::string getHostName ()
 Return the host name of this machine. More...
 
MTS_EXPORT_CORE size_t getPrivateMemoryUsage ()
 Return the process private memory usage in bytes. More...
 
MTS_EXPORT_CORE size_t getTotalSystemMemory ()
 Returns the total amount of memory available to the OS. More...
 
MTS_EXPORT_CORE std::string getFQDN ()
 Return the fully qualified domain name of this machine. More...
 
MTS_EXPORT_CORE bool enableFPExceptions ()
 Enable floating point exceptions (to catch NaNs, overflows, arithmetic with infinity). More...
 
MTS_EXPORT_CORE bool disableFPExceptions ()
 Disable floating point exceptions. More...
 
MTS_EXPORT_CORE void restoreFPExceptions (bool state)
 Restore floating point exceptions to the specified state. More...
 
template<typename T , typename U >
union_cast (const U &val)
 Cast between types that have an identical binary representation. More...
 
template<typename T >
endianness_swap (T value)
 Swaps the byte order of the underlying representation. More...
 
template<typename DataType , typename IndexType >
void permute_inplace (DataType *data, std::vector< IndexType > &perm)
 Apply an arbitrary permutation to an array in linear time. More...
 
Numerical utility functions
MTS_EXPORT_CORE bool solveQuadratic (Float a, Float b, Float c, Float &x0, Float &x1)
 Solve a quadratic equation of the form a*x^2 + b*x + c = 0. More...
 
MTS_EXPORT_CORE bool solveQuadraticDouble (double a, double b, double c, double &x0, double &x1)
 Solve a double-precision quadratic equation of the form a*x^2 + b*x + c = 0. More...
 
Float radToDeg (Float value)
 Solve a quadratic equation of the form a*x^2 + b*x + c = 0. More...
 
Float degToRad (Float value)
 Convert degrees to radians. More...
 
template<typename VectorType >
Float unitAngle (const VectorType &u, const VectorType &v)
 Numerically well-behaved routine for computing the angle between two unit direction vectors. More...
 
Warping and sampling-related utility functions
MTS_EXPORT_CORE bool solveLinearSystem2x2 (const Float a[2][2], const Float b[2], Float x[2])
 Solve a 2x2 linear equation system using basic linear algebra. More...
 
MTS_EXPORT_CORE void coordinateSystem (const Vector &a, Vector &b, Vector &c)
 Complete the set {a} to an orthonormal base. More...
 
MTS_EXPORT_CORE void computeShadingFrame (const Vector &n, const Vector &dpdu, Frame &frame)
 Given a smoothly varying shading normal and a tangent of a shape parameterization, compute a smoothly varying orthonormal frame. More...
 
MTS_EXPORT_CORE void computeShadingFrameDerivative (const Vector &n, const Vector &dpdu, const Vector &dndu, const Vector &dndv, Frame &du, Frame &dv)
 Compute the spatial derivative of computeShadingFrame. More...
 
MTS_EXPORT_CORE void stratifiedSample1D (Random *random, Float *dest, int count, bool jitter)
 Generate (optionally jittered) stratified 1D samples. More...
 
MTS_EXPORT_CORE void stratifiedSample2D (Random *random, Point2 *dest, int countX, int countY, bool jitter)
 Generate (optionally jittered) stratified 2D samples. More...
 
MTS_EXPORT_CORE void latinHypercube (Random *random, Float *dest, size_t nSamples, size_t nDim)
 Generate latin hypercube samples. More...
 
MTS_EXPORT_CORE Vector sphericalDirection (Float theta, Float phi)
 Convert spherical coordinates to a direction. More...
 
MTS_EXPORT_CORE Point2 toSphericalCoordinates (const Vector &v)
 Convert a direction to spherical coordinates. More...
 
Fresnel reflectance computation and related things
MTS_EXPORT_CORE Float fresnelDielectric (Float cosThetaI, Float cosThetaT, Float eta)
 Calculates the unpolarized Fresnel reflection coefficient at a planar interface between two dielectrics. More...
 
MTS_EXPORT_CORE Float fresnelDielectricExt (Float cosThetaI, Float &cosThetaT, Float eta)
 Calculates the unpolarized Fresnel reflection coefficient at a planar interface between two dielectrics (extended version) More...
 
Float fresnelDielectricExt (Float cosThetaI, Float eta)
 Calculates the unpolarized Fresnel reflection coefficient at a planar interface between two dielectrics (extended version) More...
 
MTS_EXPORT_CORE Float fresnelConductorApprox (Float cosThetaI, Float eta, Float k)
 Calculates the unpolarized Fresnel reflection coefficient at a planar interface having a complex-valued relative index of refraction (approximate scalar version) More...
 
MTS_EXPORT_CORE Spectrum fresnelConductorApprox (Float cosThetaI, const Spectrum &eta, const Spectrum &k)
 Calculates the unpolarized Fresnel reflection coefficient at a planar interface having a complex-valued relative index of refraction (approximate vectorized version) More...
 
MTS_EXPORT_CORE Float fresnelConductorExact (Float cosThetaI, Float eta, Float k)
 Calculates the unpolarized Fresnel reflection coefficient at a planar interface having a complex-valued relative index of refraction (accurate scalar version) More...
 
MTS_EXPORT_CORE Spectrum fresnelConductorExact (Float cosThetaI, const Spectrum &eta, const Spectrum &k)
 Calculates the unpolarized Fresnel reflection coefficient at a planar interface having a complex-valued relative index of refraction (accurate vectorized version) More...
 
MTS_EXPORT_CORE Float fresnelDiffuseReflectance (Float eta, bool fast=false)
 Calculates the diffuse unpolarized Fresnel reflectance of a dielectric material (sometimes referred to as "Fdr"). More...
 
MTS_EXPORT_CORE Vector reflect (const Vector &wi, const Normal &n)
 Specularly reflect direction wi with respect to the given surface normal. More...
 
MTS_EXPORT_CORE Vector refract (const Vector &wi, const Normal &n, Float eta, Float &cosThetaT, Float &F)
 Specularly refract the direction wi into a planar dielectric with the given surface normal and index of refraction. More...
 
MTS_EXPORT_CORE Vector refract (const Vector &wi, const Normal &n, Float eta, Float cosThetaT)
 Specularly refract the direction wi into a planar dielectric with the given surface normal and index of refraction. More...
 
MTS_EXPORT_CORE Vector refract (const Vector &wi, const Normal &n, Float eta)
 Specularly refract the direction wi into a planar dielectric with the given surface normal and index of refraction. More...
 

Macro Definition Documentation

#define __MITSUBA_CORE_UTIL_H_