Rank: 4892 based on 16 downloads (last 30 days) and 1 file submitted

Marc Lalancette

Toronto Hospital for Sick Children

Personal Profile:


Watch this Author's files


Files Posted by Marc Lalancette
Updated   File Tags Downloads
(last 30 days)
Comments Rating
06 Feb 2014 Screenshot SurfaceSmooth Restricted smoothing of a triangulated surface Author: Marc Lalancette triangulation, surface, patch, smoothing 16 1
  • 5.0
5.0 | 1 rating
Comments and Ratings by Marc Lalancette View all
Updated File Comments Rating
02 Dec 2014 inpolyhedron - are points inside a triangulated volume? Test if 3d points are inside a mesh. Or, voxelise a mask from a surface. Mesh can be non-convex too! Author: Sven

Amazing performance, great to have the grid input option. Sad about meshgrid (Y,X,Z) instead of ndgrid (X,Y,Z) type output though, can't simply convert to list doing IN(:).
Sept 2013 update indicates normals should point in, but help still says out...

17 Aug 2014 Kernel Density Estimator Reliable and extremely fast kernel density estimator for one-dimensional data Author: Zdravko Botev

Thanks, very useful. Strangely I get very different results on Matlab 2011b and 2013b with the same data. On the recent version, the density distribution is more smooth and has a stronger tendency to not go to 0 at the ends of the distribution. I'm guessing this is due to changes in a Matlab function. Any ideas?

03 Feb 2014 Volume of a surface triangulation Given a surface triangulation, compute the volume enclosed using divergence theorem. Author: Krishnan Suresh

Nice application, but here's a cleaned up version (with V = p' and F = f'):
% 'z' coordinate of triangle centers.
FaceCentroidZ = ( V(F(:, 1), 3) + V(F(:, 2), 3) + V(F(:, 3), 3) ) /3;
% Face normal vectors, with length equal to triangle area.
FNdA = cross( (V(F(:, 2), :) - V(F(:, 1), :)), ...
(V(F(:, 3), :) - V(F(:, 2), :)) , 2 ) / 2;
% Volume from divergence theorem (using vector field along z).
V = FaceCentroidZ' * FNdA(:, 3);

03 Jul 2012 Quartile & Percentile Calculation Demonstrates a method for computing percentiles and other basic statistics. Author: Chris D. Larson

Quick and practical, but doesn't properly take into account repeated median values, e.g. [1, 2, 2, 2, 2] would have the first 3 quartiles equal to 2, but this code would give [1, 2, NaN].

23 Mar 2012 COMBN (4.3) All combinations of N elements taken from the vector V. Author: Jos (10584)

Nice code, thanks! Just for fun, slight to medium speed improvement (sorry my k = your N):

%instead of:
%[Y{k:-1:1}] = ndgrid(X) ;
%Y = reshape(cat(k+1,Y{:}),[],k) ;
%fill Y directly:
nX = numel(X);
Y(nX^k, k) = X(1); % Initialize to give shape and data type.
s(1:k-1) = {ones(1, nX)};
for i = 1:k
Y( ((i-1)*nX^k + 1) : (i*nX^k) ) = X(s{1:i-1}, :, s{i:k-1});
X = permute(X, [1:i-1, i+1, i]);
% This has inverse order for the combinations as you had, easy to change.

Comments and Ratings on Marc Lalancette's Files
Updated File Comment by Comments Rating
16 Jun 2014 SurfaceSmooth Restricted smoothing of a triangulated surface Author: Marc Lalancette Thomas-Glyn Cox

Nevermind, I figured it out. So far looks great!

Contact us