Files Classes Functions Hierarchy
#include <generaterandompoints.h>
Public Member Functions | |
| generateRandomPointsInSphere (vector< T > &v, uintc n) | |
| Random points in unit circle centered at the origin. | |
Definition at line 31 of file generaterandompoints.h.
| generateRandomPointsInSphere< T, D, RG >::generateRandomPointsInSphere | ( | vector< T > & | v, | |
| uintc | n | |||
| ) | [inline] |
Random points in unit circle centered at the origin.
Definition at line 74 of file generaterandompoints.h.
References r.
00078 { 00079 RG r; 00080 D x; 00081 D y; 00082 D z; 00083 for (uint i=0; i<n; ) 00084 { 00085 x = (D)2.0*r()-(D)1.0; 00086 y = (D)2.0*r()-(D)1.0; 00087 z = (D)2.0*r()-(D)1.0; 00088 if (x*x+y*y+z*z <= (D)1.0) 00089 { 00090 v.push_back( T(x,y,z) ); 00091 ++i; 00092 } 00093 } 00094 }
1.5.8