Home > matGeom > meshes3d > meshBoundaryEdgeIndices.m

meshBoundaryEdgeIndices

PURPOSE ^

MESHBOUNDARYEDGEINDICES Indices of boundary edges of a mesh.

SYNOPSIS ^

function inds = meshBoundaryEdgeIndices(varargin)

DESCRIPTION ^

MESHBOUNDARYEDGEINDICES Indices of boundary edges of a mesh.

   INDS = meshBoundaryVertexIndices(V, F)
   INDS = meshBoundaryVertexIndices(V, E, F)

   Example
     % create centered icosahedron
     [v, f] = createIcosahedron;
     v(:,3) = v(:,3) - mean(v(:,3));
     % convert to simili-sphere
     [v2, f2] = subdivideMesh(v, f, 3);
     v3 = normalizeVector3d(v2);
     % clip with plane
     plane = createPlane([0 0 0], [-1 -2 3]);
     [vc, fc] = clipMeshVertices(v3, f2, plane, 'shape', 'plane');
     figure; drawMesh(vc, fc); axis equal; view(3);
     % draw boundary vertices
     ec = meshEdges(vc, fc);
     inds = meshBoundaryEdgeIndices(vc, ec, fc);
     edges = [vc(ec(inds, 1), :) vc(ec(inds, 2), :)];
     hold on; drawEdge3d(edges, 'linewidth', 2, 'color', 'b');

   See also
     meshes3d, meshBoundary, meshBoundaryVertexIndices, meshEdgeFaces

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function inds = meshBoundaryEdgeIndices(varargin)
0002 %MESHBOUNDARYEDGEINDICES Indices of boundary edges of a mesh.
0003 %
0004 %   INDS = meshBoundaryVertexIndices(V, F)
0005 %   INDS = meshBoundaryVertexIndices(V, E, F)
0006 %
0007 %   Example
0008 %     % create centered icosahedron
0009 %     [v, f] = createIcosahedron;
0010 %     v(:,3) = v(:,3) - mean(v(:,3));
0011 %     % convert to simili-sphere
0012 %     [v2, f2] = subdivideMesh(v, f, 3);
0013 %     v3 = normalizeVector3d(v2);
0014 %     % clip with plane
0015 %     plane = createPlane([0 0 0], [-1 -2 3]);
0016 %     [vc, fc] = clipMeshVertices(v3, f2, plane, 'shape', 'plane');
0017 %     figure; drawMesh(vc, fc); axis equal; view(3);
0018 %     % draw boundary vertices
0019 %     ec = meshEdges(vc, fc);
0020 %     inds = meshBoundaryEdgeIndices(vc, ec, fc);
0021 %     edges = [vc(ec(inds, 1), :) vc(ec(inds, 2), :)];
0022 %     hold on; drawEdge3d(edges, 'linewidth', 2, 'color', 'b');
0023 %
0024 %   See also
0025 %     meshes3d, meshBoundary, meshBoundaryVertexIndices, meshEdgeFaces
0026  
0027 % ------
0028 % Author: David Legland
0029 % e-mail: david.legland@inra.fr
0030 % Created: 2019-05-01,    using Matlab 8.6.0.267246 (R2015b)
0031 % Copyright 2019 INRA - Cepia Software Platform.
0032 
0033 [vertices, edges, faces] = parseMeshData(varargin{:});
0034 
0035 % Compute edge-vertex map if not specified
0036 if isempty(edges)
0037     edges = meshEdges(vertices, faces);
0038 end
0039 
0040 % compute edges to faces map
0041 edgeFaces = meshEdgeFaces(vertices, edges, faces);
0042 
0043 inds = find(sum(edgeFaces == 0, 2) > 0);

Generated on Wed 16-Feb-2022 15:10:47 by m2html © 2003-2019