Skip to content

Commit

Permalink
renamed variable names, no functional changes
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoostenveld committed Aug 6, 2020
1 parent 884d9f7 commit cc45b5e
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions plotting/private/mesh2edge.m
@@ -1,4 +1,4 @@
function [newbnd] = mesh2edge(bnd)
function [edge] = mesh2edge(mesh)

% MESH2EDGE finds the edge lines from a triangulated mesh or the edge
% surfaces from a tetrahedral or hexahedral mesh. An edge is defined as an
Expand All @@ -10,7 +10,7 @@
%
% See also POLY2TRI

% Copyright (C) 2013-2015, Robert Oostenveld
% Copyright (C) 2013-2020, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
Expand All @@ -30,33 +30,33 @@
%
% $Id$

if isfield(bnd, 'tri')
if isfield(mesh, 'tri')
% make a list of all edges
edge1 = bnd.tri(:, [1 2]);
edge2 = bnd.tri(:, [2 3]);
edge3 = bnd.tri(:, [3 1]);
edge1 = mesh.tri(:, [1 2]);
edge2 = mesh.tri(:, [2 3]);
edge3 = mesh.tri(:, [3 1]);
edge = cat(1, edge1, edge2, edge3);

elseif isfield(bnd, 'tet')
elseif isfield(mesh, 'tet')
% make a list of all triangles that form the tetraheder
tri1 = bnd.tet(:, [1 2 3]);
tri2 = bnd.tet(:, [2 3 4]);
tri3 = bnd.tet(:, [3 4 1]);
tri4 = bnd.tet(:, [4 1 2]);
tri1 = mesh.tet(:, [1 2 3]);
tri2 = mesh.tet(:, [2 3 4]);
tri3 = mesh.tet(:, [3 4 1]);
tri4 = mesh.tet(:, [4 1 2]);
edge = cat(1, tri1, tri2, tri3, tri4);

elseif isfield(bnd, 'hex')
elseif isfield(mesh, 'hex')
% make a list of all "squares" that form the cube/hexaheder
% FIXME should be checked, this is impossible without a drawing
square1 = bnd.hex(:, [1 2 3 4]);
square2 = bnd.hex(:, [5 6 7 8]);
square3 = bnd.hex(:, [1 2 6 5]);
square4 = bnd.hex(:, [2 3 7 6]);
square5 = bnd.hex(:, [3 4 8 7]);
square6 = bnd.hex(:, [4 1 5 8]);
square1 = mesh.hex(:, [1 2 3 4]);
square2 = mesh.hex(:, [5 6 7 8]);
square3 = mesh.hex(:, [1 2 6 5]);
square4 = mesh.hex(:, [2 3 7 6]);
square5 = mesh.hex(:, [3 4 8 7]);
square6 = mesh.hex(:, [4 1 5 8]);
edge = cat(1, square1, square2, square3, square4, square5, square6);

end % isfield(bnd)
end % isfield(mesh)

% soort all polygons in the same direction
% keep the original as "edge" and the sorted one as "sedge"
Expand All @@ -83,19 +83,19 @@
edge = edge(indx, :);

% replace pnt by pos
bnd = fixpos(bnd);
mesh = fixpos(mesh);

% the naming of the output edges depends on what they represent
newbnd.pos = bnd.pos;
if isfield(bnd, 'tri')
% the naming of the edges in the output depends on what they represent
edge.pos = mesh.pos;
if isfield(mesh, 'tri')
% these have two vertices in each edge element
newbnd.line = edge;
elseif isfield(bnd, 'tet')
edge.line = edge;
elseif isfield(mesh, 'tet')
% these have three vertices in each edge element
newbnd.tri = edge;
elseif isfield(bnd, 'hex')
edge.tri = edge;
elseif isfield(mesh, 'hex')
% these have four vertices in each edge element
newbnd.poly = edge;
edge.poly = edge;
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down

0 comments on commit cc45b5e

Please sign in to comment.