Browse Source

note in random_points_on_mesh about alias table method

Former-commit-id: 34d3104d4a62c4bfdd7533dfdbfc5f120de83d45
Alec Jacobson 11 years ago
parent
commit
b9babab1cf
1 changed files with 1 additions and 0 deletions
  1. 1 0
      include/igl/random_points_on_mesh.cpp

+ 1 - 0
include/igl/random_points_on_mesh.cpp

@@ -34,6 +34,7 @@ IGL_INLINE void igl::random_points_on_mesh(
   VectorXs A0(A.size()+1);
   VectorXs A0(A.size()+1);
   A0(0) = 0;
   A0(0) = 0;
   A0.bottomRightCorner(A.size(),1) = A;
   A0.bottomRightCorner(A.size(),1) = A;
+  // Even faster would be to use the "Alias Table Method"
   cumsum(A0,1,C);
   cumsum(A0,1,C);
   const VectorXs R = (VectorXs::Random(n,1).array() + 1.)/2.;
   const VectorXs R = (VectorXs::Random(n,1).array() + 1.)/2.;
   assert(R.minCoeff() >= 0);
   assert(R.minCoeff() >= 0);