Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64527 - sandbox/SOC/2010/quasi_random/libs/random/example
From: jvd_at_[hidden]
Date: 2010-08-01 13:27:58


Author: qrng
Date: 2010-08-01 13:27:57 EDT (Sun, 01 Aug 2010)
New Revision: 64527
URL: http://svn.boost.org/trac/boost/changeset/64527

Log:
Added some comments

Text files modified:
   sandbox/SOC/2010/quasi_random/libs/random/example/cauchy_crofton.cpp | 10 ++++++++--
   1 files changed, 8 insertions(+), 2 deletions(-)

Modified: sandbox/SOC/2010/quasi_random/libs/random/example/cauchy_crofton.cpp
==============================================================================
--- sandbox/SOC/2010/quasi_random/libs/random/example/cauchy_crofton.cpp (original)
+++ sandbox/SOC/2010/quasi_random/libs/random/example/cauchy_crofton.cpp 2010-08-01 13:27:57 EDT (Sun, 01 Aug 2010)
@@ -23,6 +23,10 @@
 #include "box_intersection.hpp"
 
 
+// In this example uniformly distributed chord entry and exit points on a S^2 ball
+// are push_back'ed into a std::vector. This is not optimal for this particular example,
+// but if you use a special device to do the sampling as, for instance, is possible
+// with nVidia CUDA, you will need to store your points in heap anyway.
 template<typename Engine, typename Vector, typename T>
 void uniform_chords(Engine& gen, const Vector& center, T radius, std::size_t n_chords,
     std::vector<Vector>& points)
@@ -54,6 +58,8 @@
 }
 
 
+// Computes a bounding sphere for a given box and then counts a number of
+// chord entry and exit points on the box.
 template<typename Engine>
 void cauchy_crofton(Engine& gen, const example::box& model, std::size_t n_chords)
 {
@@ -78,8 +84,8 @@
   {
     example::ray r(points[i], points[i+1] - points[i]);
     if( model.intersect(r, 0, 1) ) {
- points_on_model += 2; // this is an approximation,
- } // but sufficient enough for this particular example
+ points_on_model += 2; // here we do not account for those cases when there is
+ } // only 1 entry/exit point.
   }
 
   value_t sampled_area =


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk