File: slicesurf.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 (33 lines) | stat: -rw-r--r-- 1,239 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
27
28
29
30
31
32
33
function [bcutpos, bcutloop, bcutvalue] = slicesurf(node, face, varargin)
%
% [bcutpos, bcutloop]=slicesurf(node, face, varargin)
%
% Slice a closed surface by a plane and extract the intersection curve as a
% polyline loop
%
% author: Qianqian Fang (q.fang at neu.edu)
%
% input:
%    node: an N x 3 array defining the 3-D positions of the mesh
%    face: an N x 3 interger array specifying the surface triangle indices;
%
% output:
%    bcutpos: the nodes on the intersection curve
%    bcutloop: the sequential order of the nodes to form a polyline loop;
%          the last node is assumed to be connected to the first node; an
%          nan indicates the end of a loop; the intersection may contain
%          multiple loops; if only bcutpos is returned, the nodes will be
%          made in sequential order.
%
%
% -- this function is part of brain2mesh toolbox (http://mcx.space/brain2mesh)
%    License: GPL v3 or later, see LICENSE.txt for details
%

[bcutpos, bcutvalue, bcutedges] = qmeshcut(face(:, 1:3), node, node(:, 1), varargin{:});
[bcutpos, bcutedges] = removedupnodes(bcutpos, bcutedges);
bcutloop = extractloops(bcutedges);
if (nargout == 1)
    bcutloop(isnan(bcutloop)) = [];
    bcutpos = bcutpos(bcutloop, :);
end