Path Tracer
Classes | Functions
DoubleUnitVec3D.h File Reference

Defines the DoubleUnitVec3D class and some functions around it. More...

#include "DoubleVec3D.h"
Include dependency graph for DoubleUnitVec3D.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  DoubleUnitVec3D
 A three-dimensional unit vector using doubles. More...
 

Functions

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

Detailed Description

Defines the DoubleUnitVec3D class and some functions around it.

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()