center_of_simps

PURPOSE ^

CENTER_OF_SIMPS: Calculates the Center of Mass of the Simplicies.

SYNOPSIS ^

function [center_simp]=center_of_simps(fwd_model, extraparam)

DESCRIPTION ^

 CENTER_OF_SIMPS: Calculates the Center of Mass of the Simplicies.

 Usage type #1
 [center_simp]=center_of_simps(fwd_model);
 Usage type #2
 [center_simp]=center_of_simps(simp,vtx);

 center_simp = The center of mass of simps
               [Nelems x 3] (x y z co-ordinates)

 (C) 2005 David Stephenson. Licensed under GPL Version 2
 $Id: center_of_simps.m 3060 2012-06-06 16:37:38Z aadler $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [center_simp]=center_of_simps(fwd_model, extraparam)
0002 % CENTER_OF_SIMPS: Calculates the Center of Mass of the Simplicies.
0003 %
0004 % Usage type #1
0005 % [center_simp]=center_of_simps(fwd_model);
0006 % Usage type #2
0007 % [center_simp]=center_of_simps(simp,vtx);
0008 %
0009 % center_simp = The center of mass of simps
0010 %               [Nelems x 3] (x y z co-ordinates)
0011 %
0012 % (C) 2005 David Stephenson. Licensed under GPL Version 2
0013 % $Id: center_of_simps.m 3060 2012-06-06 16:37:38Z aadler $
0014 
0015 warning('EIDORS:deprecated','CENTER_OF_SIMPS is deprecated as of 06-Jun-2012. Use FIX_MODEL instead.');
0016 
0017 if nargin==1
0018    simp= fwd_model.elems;
0019    vtx = fwd_model.nodes;
0020 else
0021    simp= fwd_model;
0022    vtx= extraparam;
0023 end
0024 
0025 x_sum=vtx(simp(:,1),1)+vtx(simp(:,2),1)+vtx(simp(:,3),1)+vtx(simp(:,4),1);
0026 y_sum=vtx(simp(:,1),2)+vtx(simp(:,2),2)+vtx(simp(:,3),2)+vtx(simp(:,4),2);
0027 z_sum=vtx(simp(:,1),3)+vtx(simp(:,2),3)+vtx(simp(:,3),3)+vtx(simp(:,4),3);
0028 
0029 x_center=x_sum/4;
0030 y_center=y_sum/4;
0031 z_center=z_sum/4;
0032 
0033 center_simp(:,1)=x_center;
0034 center_simp(:,2)=y_center;
0035 center_simp(:,3)=z_center;
0036 
0037 
0038 
0039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0040 % This is part of the EIDORS suite.
0041 % Copyright (c) D.R Stephenson 2004
0042 % Copying permitted under terms of GNU GPL
0043 % See enclosed file gpl.html for details.
0044 % EIDORS 3D version XXX
0045 % MATLAB Version 6.5.0.180913a (R13)
0046 % MATLAB License Number: 1560
0047 % Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 1)
0048 % Java VM Version: Java 1.3.1_01 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
0049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Generated on Fri 30-Dec-2022 19:44:54 by m2html © 2005