Code covered by the BSD License  

Highlights from

image thumbnail



David Legland (view profile)


19 Jun 2009 (Updated )

Library to handle 3D geometric primitives: create, intersect, display, and make basic computations

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

meshFace(faces, index)
function face = meshFace(faces, index)
%MESHFACE Return the vertex indices of a face in a mesh
%   FACE = meshFace(FACES, INDEX)
%   Return the vertex indices of the i-th face in the face array. This is
%   mainly an utilitary function that manages faces stored either as int
%   array (when all faces have same number of sides) or cell array (when
%   faces may have different number of edges).
%   Example
%   meshFace
%   See also
% ------
% Author: David Legland
% e-mail:
% Created: 2010-10-06,    using Matlab (R2009b)
% Copyright 2010 INRA - Cepia Software Platform.

% process mesh given as structure
if isstruct(faces)
    if isfield(faces, 'faces')
        faces = faces.faces;
        error('Mesh structure should contains a field ''faces''');

% switch between numeric or cell array
if isnumeric(faces)
    face = faces(index, :);
    face = faces{index};

Contact us