Path Tracer
Functions
DoubleUnitVec3D.cpp File Reference
#include "DoubleUnitVec3D.h"
Include dependency graph for DoubleUnitVec3D.cpp:

Functions

DoubleUnitVec3D operator- (const DoubleUnitVec3D &vec)
 Unary minus. More...
 
DoubleUnitVec3D randomVectorOnUnitRadiusSphere ()
 Generates a random unit vector on a sphere. More...
 

Function Documentation

◆ operator-()

DoubleUnitVec3D operator- ( const DoubleUnitVec3D vec)

Unary minus.

Allows to skip the conversion from DoubleVec3D to DoubleUnitVec3D.

Parameters
vecThe vector that will be inversed.
Returns
The inverse of vec.

◆ randomVectorOnUnitRadiusSphere()

DoubleUnitVec3D randomVectorOnUnitRadiusSphere ( )

Generates a random unit vector on a sphere.

Every vector has the same probability to show up. We can combine this function with a dot product between the resulting vector and a normal to a surface. If we inverse the vector when the dot product is negative, then we get a random vector on a unit hemisphere.

Returns
A random unit vector on a sphere.
See also
Sphere::getRandomPoint()