File: insurface.m

package info (click to toggle)
octave-iso2mesh 1.9.8%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 11,128 kB
  • sloc: cpp: 11,982; ansic: 10,158; sh: 365; makefile: 59
file content (26 lines) | stat: -rw-r--r-- 693 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function tf = insurface(node, face, points)
%
% tf=innersurf(node,face,points)
%
% test if a set of 3D points is located inside a 3D triangular surface
%
% author: Qianqian Fang, <q.fang at neu.edu>
%
% input:
%    node:  node coordinates
%    face:  surface triangle list
%    points: a set of 3D points (Nx3 array)
%
% output:
%    tf: a vector with the same length of points,
%        a value of 1 means the point is inside of the surface, and
%        a value of 0 means the point is outside of the surface.
%
% -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
%

[no, el] = fillsurf(node, face);
tf = tsearchn(no, el, points);

tf(~isnan(tf)) = 1;
tf(isnan(tf)) = 0;