proj home

Files   Classes   Functions   Hierarchy  

generateRandomPointsInSphere< T, D, RG > Class Template Reference

Generate random points inside a unit sphere. More...

#include <generaterandompoints.h>

List of all members.

Public Member Functions

 generateRandomPointsInSphere (vector< T > &v, uintc n)
 Random points in unit circle centered at the origin.


Detailed Description

template<typename T, typename D, typename RG>
class generateRandomPointsInSphere< T, D, RG >

Generate random points inside a unit sphere.

Definition at line 31 of file generaterandompoints.h.


Constructor & Destructor Documentation

template<typename T , typename D , typename RG >
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 }


The documentation for this class was generated from the following file:

Generated on Fri Mar 4 00:49:57 2011 for Chelton Evans Source by  doxygen 1.5.8