MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/FleX / UniformSampleSphereVolume

Function UniformSampleSphereVolume

core/maths.h:387–395  ·  view source on GitHub ↗

uniformly sample volume of a sphere using dart throwing

Source from the content-addressed store, hash-verified

385
386// uniformly sample volume of a sphere using dart throwing
387inline Vec3 UniformSampleSphereVolume()
388{
389 for(;;)
390 {
391 Vec3 v = RandVec3();
392 if (Dot(v, v) < 1.0f)
393 return v;
394 }
395}
396
397inline Vec3 UniformSampleSphere()
398{

Callers 1

PoissonSample3DFunction · 0.85

Calls 2

RandVec3Function · 0.85
DotFunction · 0.70

Tested by

no test coverage detected