Back to class index
| Sphere::RandomPointOnSurfaceSyntaxfloat4 Sphere::RandomPointOnSurface(LCG &lcg); [21 lines of code]float4 Sphere::RandomPointOnSurface(LCG &lcg, const float4 ¢er, float radius); [4 lines of code] Generates a random point on the surface of this sphere. The points are distributed uniformly. This function uses the rejection method to generate a uniform distribution of points on the surface. Therefore it is assumed that this sphere is not degenerate, i.e. it has a positive radius. A fixed number of 1000 tries is performed, after which a fixed point on the surface is returned as a fallback. ParametersLCG &lcgA pre-seeded random number generator object that is to be used by this function to generate random values. See AlsoWork in progress:Todo: in float4 Sphere::RandomPointOnSurface(LCG &lcg): Add Sphere::PointOnSurface(polarYaw, polarPitch). |