point_in_tet

PURPOSE ^

POINT_IN_TET test for points contained in elements

SYNOPSIS ^

function point2tet = point_in_tet(fmdl,points, epsilon)

DESCRIPTION ^

POINT_IN_TET test for points contained in elements

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function point2tet = point_in_tet(fmdl,points, epsilon)
0002 %POINT_IN_TET test for points contained in elements
0003 
0004 % (C) 2015 Bartlomiej Grychtol
0005 % License: GPL version 2 or 3
0006 % $Id: point_in_tet.m 5424 2017-04-25 17:45:19Z aadler $
0007 
0008    progress_msg('Point_in_tet');
0009    [A,b] = tet_to_inequal(fmdl.nodes,fmdl.elems);
0010    progress_msg(.01);
0011    % This is split to decrease the memory footprint
0012    point2tet = (bsxfun(@minus, A(1:4:end,:)*points',b(1:4:end)) <= epsilon)';
0013    progress_msg(.21);
0014    for i = 2:4
0015       point2tet = point2tet & (bsxfun(@minus, A(i:4:end,:)*points',b(i:4:end)) <= epsilon)';
0016       progress_msg(.21 + (i-1)*.23);
0017    end
0018 
0019    % exclude coinciding nodes
0020    ex= bsxfun(@eq,points(:,1),fmdl.nodes(:,1)') & ...
0021        bsxfun(@eq,points(:,2),fmdl.nodes(:,2)') & ...
0022        bsxfun(@eq,points(:,3),fmdl.nodes(:,3)');
0023    progress_msg(.94);
0024    point2tet(any(ex,2),:) = 0;
0025    point2tet = sparse(point2tet);
0026    progress_msg(Inf);
0027 end

Generated on Tue 31-Dec-2019 17:03:26 by m2html © 2005