Nori

include/nori/common.h File Reference

#include <iostream>
#include <algorithm>
#include <vector>
#include <Eigen/Core>
#include <QString>
#include <stdint.h>
#include <ImathPlatform.h>

Go to the source code of this file.

Classes

class  NoriException
 Simple exception class, which stores a human-readable error description. More...

Defines

#define EIGEN_NO_DEBUG
#define NORI_NAMESPACE_BEGIN   namespace nori {
#define NORI_NAMESPACE_END   }
#define Epsilon   1e-4f
#define INV_PI   0.31830988618379067154f
#define INV_TWOPI   0.15915494309189533577f
#define INV_FOURPI   0.07957747154594766788f
#define SQRT_TWO   1.41421356237309504880f
#define INV_SQRT_TWO   0.70710678118654752440f
#define EXPECT_TAKEN(a)   a
#define EXPECT_NOT_TAKEN(a)   a

Typedefs

typedef TVector< float, 1 > Vector1f
typedef TVector< float, 2 > Vector2f
typedef TVector< float, 3 > Vector3f
typedef TVector< float, 4 > Vector4f
typedef TVector< double, 1 > Vector1d
typedef TVector< double, 2 > Vector2d
typedef TVector< double, 3 > Vector3d
typedef TVector< double, 4 > Vector4d
typedef TVector< int, 1 > Vector1i
typedef TVector< int, 2 > Vector2i
typedef TVector< int, 3 > Vector3i
typedef TVector< int, 4 > Vector4i
typedef TPoint< float, 1 > Point1f
typedef TPoint< float, 2 > Point2f
typedef TPoint< float, 3 > Point3f
typedef TPoint< float, 4 > Point4f
typedef TPoint< double, 1 > Point1d
typedef TPoint< double, 2 > Point2d
typedef TPoint< double, 3 > Point3d
typedef TPoint< double, 4 > Point4d
typedef TPoint< int, 1 > Point1i
typedef TPoint< int, 2 > Point2i
typedef TPoint< int, 3 > Point3i
typedef TPoint< int, 4 > Point4i
typedef TBoundingBox< Point1fBoundingBox1f
typedef TBoundingBox< Point2fBoundingBox2f
typedef TBoundingBox< Point3fBoundingBox3f
typedef TBoundingBox< Point4fBoundingBox4f
typedef TBoundingBox< Point1dBoundingBox1d
typedef TBoundingBox< Point2dBoundingBox2d
typedef TBoundingBox< Point3dBoundingBox3d
typedef TBoundingBox< Point4dBoundingBox4d
typedef TBoundingBox< Point1iBoundingBox1i
typedef TBoundingBox< Point2iBoundingBox2i
typedef TBoundingBox< Point3iBoundingBox3i
typedef TBoundingBox< Point4iBoundingBox4i
typedef TRay< Point2f, Vector2fRay2f
typedef TRay< Point3f, Vector3fRay3f

Enumerations

enum  EMeasure { EUnknownMeasure = 0, ESolidAngle, EDiscrete }
 

Measures associated with probability distributions.

More...

Functions

void sincosf (float theta, float *_sin, float *_cos)
 Emulate sincosf using sinf() and cosf()
float radToDeg (float value)
float degToRad (float value)
 Convert degrees to radians.
float clamp (float value, float min, float max)
 Simple floating point clamping function.
int clamp (int value, int min, int max)
 Simple integer clamping function.
float lerp (float t, float v1, float v2)
 Linearly interpolate between two values.
Vector3f squareToUniformSphere (const Point2f &sample)
 Uniformly sample a vector on the unit sphere with respect to solid angles.
Vector3f squareToUniformHemisphere (const Point2f &sample)
 Uniformly sample a vector on the unit hemisphere with respect to solid angles.
Vector3f squareToCosineHemisphere (const Point2f &sample)
 Uniformly sample a vector on the unit hemisphere with respect to projected solid angles.
Point2f squareToUniformDisk (const Point2f &sample)
 Uniformly sample a vector on a 2D disk.
Point2f squareToUniformDiskConcentric (const Point2f &sample)
 Low-distortion concentric square to disk mapping by Peter Shirley (PDF: 1/PI)
Point2f squareToUniformTriangle (const Point2f &sample)
 Convert an uniformly distributed square sample into barycentric coordinates.
Vector3f sphericalDirection (float theta, float phi)
 Compute a direction for the given coordinates in spherical coordinates.
Point2f sphericalCoordinates (const Vector3f &dir)
 Compute a direction for the given coordinates in spherical coordinates.
QString indent (const QString &string, int amount=2)
 Indent a complete string (except for the first line) by the requested number of spaces.
void * allocAligned (size_t size)
 Allocate an aligned region of memory.
void freeAligned (void *ptr)
 Free an aligned region of memory.
int getCoreCount ()
 Return the number of cores (real and virtual)

Define Documentation

#define EIGEN_NO_DEBUG

Definition at line 22 of file common.h.

#define Epsilon   1e-4f

Definition at line 45 of file common.h.

#define EXPECT_NOT_TAKEN (   a)    a

Definition at line 63 of file common.h.

#define EXPECT_TAKEN (   a)    a

Definition at line 62 of file common.h.

#define INV_FOURPI   0.07957747154594766788f

Definition at line 50 of file common.h.

#define INV_PI   0.31830988618379067154f

Definition at line 48 of file common.h.

#define INV_SQRT_TWO   0.70710678118654752440f

Definition at line 52 of file common.h.

#define INV_TWOPI   0.15915494309189533577f

Definition at line 49 of file common.h.

#define NORI_NAMESPACE_BEGIN   namespace nori {

Definition at line 41 of file common.h.

#define NORI_NAMESPACE_END   }

Definition at line 42 of file common.h.

#define SQRT_TWO   1.41421356237309504880f

Definition at line 51 of file common.h.


Typedef Documentation

Definition at line 120 of file common.h.

Definition at line 116 of file common.h.

Definition at line 124 of file common.h.

Definition at line 121 of file common.h.

Definition at line 117 of file common.h.

Definition at line 125 of file common.h.

Definition at line 122 of file common.h.

Definition at line 118 of file common.h.

Definition at line 126 of file common.h.

Definition at line 123 of file common.h.

Definition at line 119 of file common.h.

Definition at line 127 of file common.h.

typedef TPoint<double, 1> Point1d

Definition at line 108 of file common.h.

typedef TPoint<float, 1> Point1f

Definition at line 104 of file common.h.

typedef TPoint<int, 1> Point1i

Definition at line 112 of file common.h.

typedef TPoint<double, 2> Point2d

Definition at line 109 of file common.h.

typedef TPoint<float, 2> Point2f

Definition at line 105 of file common.h.

typedef TPoint<int, 2> Point2i

Definition at line 113 of file common.h.

typedef TPoint<double, 3> Point3d

Definition at line 110 of file common.h.

typedef TPoint<float, 3> Point3f

Definition at line 106 of file common.h.

typedef TPoint<int, 3> Point3i

Definition at line 114 of file common.h.

typedef TPoint<double, 4> Point4d

Definition at line 111 of file common.h.

typedef TPoint<float, 4> Point4f

Definition at line 107 of file common.h.

typedef TPoint<int, 4> Point4i

Definition at line 115 of file common.h.

Definition at line 128 of file common.h.

Definition at line 129 of file common.h.

typedef TVector<double, 1> Vector1d

Definition at line 96 of file common.h.

typedef TVector<float, 1> Vector1f

Definition at line 86 of file common.h.

typedef TVector<int, 1> Vector1i

Definition at line 100 of file common.h.

typedef TVector<double, 2> Vector2d

Definition at line 97 of file common.h.

typedef TVector<float, 2> Vector2f

Definition at line 93 of file common.h.

typedef TVector<int, 2> Vector2i

Definition at line 101 of file common.h.

typedef TVector<double, 3> Vector3d

Definition at line 98 of file common.h.

typedef TVector<float, 3> Vector3f

Definition at line 94 of file common.h.

typedef TVector<int, 3> Vector3i

Definition at line 102 of file common.h.

typedef TVector<double, 4> Vector4d

Definition at line 99 of file common.h.

typedef TVector<float, 4> Vector4f

Definition at line 95 of file common.h.

typedef TVector<int, 4> Vector4i

Definition at line 103 of file common.h.


Enumeration Type Documentation

enum EMeasure

Measures associated with probability distributions.

Enumerator:
EUnknownMeasure 
ESolidAngle 
EDiscrete 

Definition at line 161 of file common.h.


Function Documentation

void* allocAligned ( size_t  size)

Allocate an aligned region of memory.

float clamp ( float  value,
float  min,
float  max 
) [inline]

Simple floating point clamping function.

Definition at line 174 of file common.h.

int clamp ( int  value,
int  min,
int  max 
) [inline]

Simple integer clamping function.

Definition at line 183 of file common.h.

float degToRad ( float  value) [inline]

Convert degrees to radians.

Definition at line 171 of file common.h.

void freeAligned ( void *  ptr)

Free an aligned region of memory.

int getCoreCount ( )

Return the number of cores (real and virtual)

QString indent ( const QString &  string,
int  amount = 2 
)

Indent a complete string (except for the first line) by the requested number of spaces.

float lerp ( float  t,
float  v1,
float  v2 
) [inline]

Linearly interpolate between two values.

Definition at line 192 of file common.h.

float radToDeg ( float  value) [inline]

Definition at line 168 of file common.h.

void sincosf ( float  theta,
float *  _sin,
float *  _cos 
) [inline]

Emulate sincosf using sinf() and cosf()

Definition at line 74 of file common.h.

Point2f sphericalCoordinates ( const Vector3f dir)

Compute a direction for the given coordinates in spherical coordinates.

Vector3f sphericalDirection ( float  theta,
float  phi 
)

Compute a direction for the given coordinates in spherical coordinates.

Vector3f squareToCosineHemisphere ( const Point2f sample)

Uniformly sample a vector on the unit hemisphere with respect to projected solid angles.

Point2f squareToUniformDisk ( const Point2f sample)

Uniformly sample a vector on a 2D disk.

Point2f squareToUniformDiskConcentric ( const Point2f sample)

Low-distortion concentric square to disk mapping by Peter Shirley (PDF: 1/PI)

Vector3f squareToUniformHemisphere ( const Point2f sample)

Uniformly sample a vector on the unit hemisphere with respect to solid angles.

Vector3f squareToUniformSphere ( const Point2f sample)

Uniformly sample a vector on the unit sphere with respect to solid angles.

Point2f squareToUniformTriangle ( const Point2f sample)

Convert an uniformly distributed square sample into barycentric coordinates.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines