MCPcopy Create free account
hub / github.com/aras-p/ToyPathTracer / RandomInUnitDisk

Function RandomInUnitDisk

Cpp/Source/Maths.cpp:20–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20float3 RandomInUnitDisk(uint32_t& state)
21{
22 float3 p;
23 do
24 {
25 p = 2.0 * float3(RandomFloat01(state),RandomFloat01(state),0) - float3(1,1,0);
26 } while (dot(p,p) >= 1.0);
27 return p;
28}
29
30float3 RandomInUnitSphere(uint32_t& state)
31{

Callers 1

GetRayMethod · 0.85

Calls 3

RandomFloat01Function · 0.85
dotFunction · 0.85
float3Class · 0.70

Tested by

no test coverage detected